mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 15:36:47 +03:00
Merge pull request #255243 from tricktron/f-refactor-buildMavenPackage
buildMavenPackage: add offline build feature flag
This commit is contained in:
commit
5bd09d53f6
@ -5,11 +5,14 @@
|
||||
|
||||
{ src
|
||||
, sourceRoot ? null
|
||||
, buildOffline ? false
|
||||
, patches ? [ ]
|
||||
, pname
|
||||
, version
|
||||
, mvnHash ? ""
|
||||
, mvnFetchExtraArgs ? { }
|
||||
, mvnDepsParameters ? ""
|
||||
, manualMvnArtifacts ? [ ]
|
||||
, mvnParameters ? ""
|
||||
, ...
|
||||
} @args:
|
||||
@ -28,9 +31,17 @@ let
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
'' + lib.optionalString buildOffline ''
|
||||
mvn dependency:go-offline -Dmaven.repo.local=$out/.m2 ${mvnDepsParameters}
|
||||
|
||||
for artifactId in ${builtins.toString manualMvnArtifacts}
|
||||
do
|
||||
echo "downloading manual $artifactId"
|
||||
mvn dependency:get -Dartifact="$artifactId" -Dmaven.repo.local=$out/.m2
|
||||
done
|
||||
'' + lib.optionalString (!buildOffline) ''
|
||||
mvn package -Dmaven.repo.local=$out/.m2 ${mvnParameters}
|
||||
|
||||
'' + ''
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
@ -65,7 +76,7 @@ stdenv.mkDerivation (builtins.removeAttrs args [ "mvnFetchExtraArgs" ] // {
|
||||
runHook preBuild
|
||||
|
||||
mvnDeps=$(cp -dpR ${fetchedMavenDeps}/.m2 ./ && chmod +w -R .m2 && pwd)
|
||||
mvn package --offline "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnParameters}
|
||||
mvn package -o -nsu "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnParameters}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user