diff options
author | Rob Vermaas <rob.vermaas@gmail.com> | 2010-03-11 14:44:17 +0000 |
---|---|---|
committer | Rob Vermaas <rob.vermaas@gmail.com> | 2010-03-11 14:44:17 +0000 |
commit | addc98c02f96eeef1df9bd2ae138746451da2df4 (patch) | |
tree | 392d658a2a088bb38017e9defb5386747b86d237 | |
parent | 274522341409150b8f2db4c4fc98ec9facaef9c5 (diff) |
initial version for maven builder
svn path=/nixpkgs/trunk/; revision=20558
-rw-r--r-- | pkgs/build-support/release/default.nix | 4 | ||||
-rw-r--r-- | pkgs/build-support/release/maven-build.nix | 97 |
2 files changed, 101 insertions, 0 deletions
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix index 357a5227cbda0..b7a362aa9f921 100644 --- a/pkgs/build-support/release/default.nix +++ b/pkgs/build-support/release/default.nix @@ -18,6 +18,10 @@ rec { { inherit stdenv; } // args); + mvnBuild = args: import ./maven-build.nix ( + { inherit stdenv; + } // args); + nixBuild = args: import ./nix-build.nix ( { inherit stdenv; } // args); diff --git a/pkgs/build-support/release/maven-build.nix b/pkgs/build-support/release/maven-build.nix new file mode 100644 index 0000000000000..8fbd7f0677bd2 --- /dev/null +++ b/pkgs/build-support/release/maven-build.nix @@ -0,0 +1,97 @@ +{ stdenv +, name +, src +, doTest ? true +, doTestCompile ? true +, doJavadoc ? false +, doCheckstyle ? false +, doRelease ? false +, includeTestClasses ? true + +, ... +} @ args : + +let + mvnFlags = "-Dmaven.repo.local=$M2_REPO ${if doTest then "" else "-Dmaven.test.skip.exec=true"}"; +in + +stdenv.mkDerivation ( rec { + inherit name src; + phases = "setupPhase unpackPhase patchPhase mvnCompile ${if doTestCompile then "mvnTestCompile mvnTestJar" else ""} ${if doTest then "mvnTest mvnCobertura" else ""} ${if doJavadoc then "mvnJavadoc" else ""} ${if doCheckstyle then "mvnCheckstyle" else ""} mvnJar mvnAssembly mvnRelease finalPhase"; + + setupPhase = '' + runHook preSetupPhase + + ensureDir $out/nix-support + export LANG="en_US.UTF-8" + export LOCALE_ARCHIVE=$glibcLocales/lib/locale/locale-archive + export M2_REPO=$TMPDIR/repository + + runHook postSetupPhase + ''; + + mvnCompile = '' + mvn compile ${mvnFlags} + ''; + + mvnTestCompile = '' + mvn test-compile ${mvnFlags} + ''; + + mvnTestJar = '' + mvn jar:test-jar ${mvnFlags} + ''; + + mvnTest = '' + mvn test ${mvnFlags} + ''; + + mvnJavadoc = '' + mvn javadoc:javadoc ${mvnFlags} + cp -R target/site/apidocs $out/apidocs + echo "report javadoc $out/apidocs" >> $out/nix-support/hydra-build-products + ''; + + mvnCobertura = '' + mvn cobertura:cobertura ${mvnFlags} + cp -R target/site/cobertura $out/cobertura + echo "report cobertura $out/cobertura" >> $out/nix-support/hydra-build-products + ''; + + mvnCheckstyle = '' + mvn checkstyle:checkstyle ${mvnFlags} + ensureDir $out/checkstyle + cp -R target/site/checkstyle.* $out/checkstyle/ + cp -R target/site/images $out/checkstyle/images + echo "report checkstyle $out/checkstyle/checkstyle.html" >> $out/nix-support/hydra-build-products + ''; + + mvnJar = '' + mvn jar:jar ${mvnFlags} + ''; + + mvnAssembly = '' + mvn assembly:assembly ${mvnFlags} + ''; + + mvnRelease = '' + ensureDir $out/release +ls -l target/ + zip=$(ls target/*.zip| head -1) + releaseName=$(basename $zip .zip) + releaseName="$releaseName-r${toString src.rev}" + cp $zip $out/release/$releaseName.zip + + echo "$releaseName" > $out/nix-support/hydra-release-name + + ${if doRelease then '' + echo "file zip $out/release/$releaseName.zip" >> $out/nix-support/hydra-build-products + '' else ""} + ''; + + finalPhase = '' + ensureDir $out/site + cp -R src/test/site/* $out/site + ''; +} // args +) |