Update build; improve caching; improve tests

This commit is contained in:
Tad Fisher
2020-11-22 16:22:22 -08:00
parent 2ad217b878
commit beb157cf18
83 changed files with 3732 additions and 1771 deletions

View File

@@ -27,7 +27,7 @@ dependencies {
}
application {
mainClassName = "org.nixos.gradle2nix.MainKt"
mainClass.set("org.nixos.gradle2nix.MainKt")
applicationName = "gradle2nix"
applicationDefaultJvmArgs += "-Dorg.nixos.gradle2nix.share=@APP_HOME@/share"
applicationDistribution

33
app/gradle.lockfile Normal file
View File

@@ -0,0 +1,33 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.christophsturm:filepeek:0.1.2=testRuntimeClasspath
com.github.ajalt:clikt:2.8.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.squareup.moshi:moshi-adapters:1.11.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.squareup.moshi:moshi-kotlin:1.11.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.squareup.moshi:moshi:1.11.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.squareup.okio:okio:2.9.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.github.classgraph:classgraph:4.8.37=testRuntimeClasspath
io.strikt:strikt-core:0.28.0=testCompileClasspath,testRuntimeClasspath
net.swiftzer.semver:semver:1.1.1=runtimeClasspath,testRuntimeClasspath
org.apiguardian:apiguardian-api:1.1.0=testRuntimeClasspath
org.gradle:gradle-tooling-api:6.8-milestone-2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jetbrains.kotlin:kotlin-reflect:1.4.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jetbrains.kotlin:kotlin-stdlib:1.4.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.3=testRuntimeClasspath
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9=testRuntimeClasspath
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9=testRuntimeClasspath
org.jetbrains:annotations:13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.6.0=testRuntimeClasspath
org.junit.platform:junit-platform-engine:1.6.0=testRuntimeClasspath
org.junit:junit-bom:5.6.0=testRuntimeClasspath
org.opentest4j:opentest4j:1.2.0=testCompileClasspath,testRuntimeClasspath
org.slf4j:slf4j-api:2.0.0-alpha1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.slf4j:slf4j-simple:2.0.0-alpha1=runtimeClasspath,testRuntimeClasspath
org.spekframework.spek2:spek-dsl-jvm:2.0.14=testCompileClasspath,testRuntimeClasspath
org.spekframework.spek2:spek-runner-junit5:2.0.14=testRuntimeClasspath
org.spekframework.spek2:spek-runtime-jvm:2.0.14=testRuntimeClasspath
empty=

View File

@@ -1,16 +0,0 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.github.ajalt:clikt:2.6.0
com.squareup.moshi:moshi-adapters:1.9.2
com.squareup.moshi:moshi-kotlin:1.9.2
com.squareup.moshi:moshi:1.9.2
com.squareup.okio:okio:2.6.0
org.gradle:gradle-tooling-api:6.3
org.jetbrains.kotlin:kotlin-reflect:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.70
org.jetbrains.kotlin:kotlin-stdlib:1.3.70
org.jetbrains:annotations:13.0
org.slf4j:slf4j-api:2.0.0-alpha1

View File

@@ -1,18 +0,0 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.github.ajalt:clikt:2.6.0
com.squareup.moshi:moshi-adapters:1.9.2
com.squareup.moshi:moshi-kotlin:1.9.2
com.squareup.moshi:moshi:1.9.2
com.squareup.okio:okio:2.6.0
net.swiftzer.semver:semver:1.1.1
org.gradle:gradle-tooling-api:6.3
org.jetbrains.kotlin:kotlin-reflect:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.70
org.jetbrains.kotlin:kotlin-stdlib:1.3.70
org.jetbrains:annotations:13.0
org.slf4j:slf4j-api:2.0.0-alpha1
org.slf4j:slf4j-simple:2.0.0-alpha1

View File

@@ -1,20 +0,0 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.christophsturm:filepeek:0.1.2
com.github.ajalt:clikt:2.6.0
com.squareup.moshi:moshi-adapters:1.9.2
com.squareup.moshi:moshi-kotlin:1.9.2
com.squareup.moshi:moshi:1.9.2
com.squareup.okio:okio:2.6.0
io.strikt:strikt-core:0.25.0
org.gradle:gradle-tooling-api:6.3
org.jetbrains.kotlin:kotlin-reflect:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.70
org.jetbrains.kotlin:kotlin-stdlib:1.3.70
org.jetbrains:annotations:13.0
org.opentest4j:opentest4j:1.2.0
org.slf4j:slf4j-api:2.0.0-alpha1
org.spekframework.spek2:spek-dsl-jvm:2.0.10

View File

@@ -1,31 +0,0 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.christophsturm:filepeek:0.1.2
com.github.ajalt:clikt:2.6.0
com.squareup.moshi:moshi-adapters:1.9.2
com.squareup.moshi:moshi-kotlin:1.9.2
com.squareup.moshi:moshi:1.9.2
com.squareup.okio:okio:2.6.0
io.github.classgraph:classgraph:4.8.37
io.strikt:strikt-core:0.25.0
net.swiftzer.semver:semver:1.1.1
org.apiguardian:apiguardian-api:1.1.0
org.gradle:gradle-tooling-api:6.3
org.jetbrains.kotlin:kotlin-reflect:1.3.71
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.71
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.71
org.jetbrains.kotlin:kotlin-stdlib:1.3.71
org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.3
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5
org.jetbrains:annotations:13.0
org.junit.platform:junit-platform-commons:1.6.0
org.junit.platform:junit-platform-engine:1.6.0
org.junit:junit-bom:5.6.0
org.opentest4j:opentest4j:1.2.0
org.slf4j:slf4j-api:2.0.0-alpha1
org.slf4j:slf4j-simple:2.0.0-alpha1
org.spekframework.spek2:spek-dsl-jvm:2.0.10
org.spekframework.spek2:spek-runner-junit5:2.0.10
org.spekframework.spek2:spek-runtime-jvm:2.0.10

View File

@@ -36,8 +36,8 @@ let
concatStringsSep;
inherit (stdenv.lib)
versionOlder unique mapAttrs last concatMapStringsSep removeSuffix
optionalString groupBy' readFile hasSuffix;
versionOlder unique mapAttrs mapAttrsToList last concatMapStringsSep
removeSuffix optionalString groupBy' readFile hasSuffix;
mkDep = depSpec: stdenv.mkDerivation {
inherit (depSpec) name;
@@ -230,7 +230,7 @@ let
};
mkProjectEnv = projectSpec: {
inherit (projectSpec) name version;
inherit (projectSpec) name path version;
initScript = mkInitScript projectSpec;
gradle = args.gradlePackage or mkGradle projectSpec.gradle;
};
@@ -243,6 +243,23 @@ let
pname = args.pname or projectEnv.name;
version = args.version or projectEnv.version;
buildProject = env: flags: ''
gradle --offline --no-daemon --no-build-cache \
--info --full-stacktrace --warning-mode=all \
${optionalString enableParallelBuilding "--parallel"} \
${optionalString enableDebug "-Dorg.gradle.debug=true"} \
--init-script ${env.initScript} \
${optionalString (env.path != "") ''-p "${env.path}"''} \
${concatStringsSep " " flags}
'';
buildIncludedProjects =
concatStringsSep "\n" (mapAttrsToList
(_: env: buildProject env [ "build" ])
(removeAttrs gradleEnv [ "" ]));
buildRootProject = buildProject projectEnv gradleFlags;
in stdenv.mkDerivation (args // {
inherit pname version;
@@ -260,13 +277,9 @@ in stdenv.mkDerivation (args // {
mkdir -p $TMPHOME/init.d
cp ${projectEnv.initScript} $TMPHOME/init.d
env \
"GRADLE_USER_HOME=$TMPHOME" \
gradle --offline --no-daemon --no-build-cache \
--info --full-stacktrace --warning-mode=all \
${optionalString enableParallelBuilding "--parallel"} \
${optionalString enableDebug "-Dorg.gradle.debug=true"} \
${concatStringsSep " " gradleFlags}
export "GRADLE_USER_HOME=$TMPHOME"
${buildIncludedProjects}
${buildRootProject}
)
runHook postBuild