Add extraInit and buildJdk args

This commit is contained in:
Tad Fisher
2020-12-01 16:44:44 -08:00
parent fd6a6f4693
commit 7c02e63afa
3 changed files with 298 additions and 82 deletions

View File

@@ -21,13 +21,23 @@
{ stdenv, buildEnv, fetchurl, gradleGen, writeText, writeTextDir }:
{ envSpec
{
# Path to the environment spec generated by gradle2nix (e.g. gradle-env.json).
envSpec
, pname ? null
, version ? null
, enableParallelBuilding ? true
# Arguments to Gradle used to build the project in buildPhase.
, gradleFlags ? [ "build" ]
# Gradle package to use instead of the one generated by gradle2nix.
, gradlePackage ? null
# Enable debugging for the Gradle build; this will cause Gradle to run a debug server
# and wait for a JVM debugging client to attach.
, enableDebug ? false
# Additional code to run in the Gradle init script (init.gradle).
, extraInit ? ""
# Override the default JDK used to run Gradle itself.
, buildJdk ? null
, ... } @ args:
let
@@ -243,6 +253,8 @@ let
}
}
''}
${extraInit}
'';
mkGradle = gradleSpec:
@@ -277,6 +289,7 @@ let
--info --full-stacktrace --warning-mode=all \
${optionalString enableParallelBuilding "--parallel"} \
${optionalString enableDebug "-Dorg.gradle.debug=true"} \
${optionalString (buildJdk != null) "-Dorg.gradle.java.home=${buildJdk.home}"} \
--init-script ${env.initScript} \
${optionalString (env.path != "") ''-p "${env.path}"''} \
${concatStringsSep " " flags}
@@ -299,7 +312,7 @@ in stdenv.mkDerivation (args // {
runHook preBuild
(
set -x
set -eux
# use the init script here
TMPHOME=$(mktemp -d)