-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Model parameters using org.gradlex.build-parameters (#3170)
Introduces the org.gradlex.build-parameters plugin to model parameters that can be supplied to this build. For this the existing build logic in gradle/plugins is moved to a submodule called 'common' and a new module called 'build-parameters' is introduced. This way, build logic can access build parameters using the `buildParameters` pre-compiled accessor in Kotlin. Occurences of project.findProperty as well as project.hasProperty are replaced by properly modeled build parameters. Since validation of parameters is not turned off, the build-parameters plugin will fail the build is a parameter is supplied which is not modeled. For that reason, any other parameters, such as signing or deployment parameters that are supplied by developers only during releasing need to be added before this can be merged.
- Loading branch information
Showing
43 changed files
with
136 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[*.{kt,kts}] | ||
ij_kotlin_allow_trailing_comma = false | ||
ij_kotlin_allow_trailing_comma_on_call_site = false | ||
|
||
[*.kts] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
plugins { | ||
id("org.gradlex.build-parameters") version "1.4.3" | ||
} | ||
|
||
group = "junitbuild" | ||
|
||
buildParameters { | ||
pluginId("junitbuild.build-parameters") | ||
bool("ci") { | ||
description.set("Whether or not this build is running in a CI environment") | ||
defaultValue.set(false) | ||
fromEnvironment() | ||
} | ||
integer("javaToolchainVersion") { | ||
description.set("Defines the Java toolchain version to use for compiling code") | ||
} | ||
group("buildCache") { | ||
string("username") { | ||
description.set("Username to authenticate with the remote build cache") | ||
fromEnvironment() | ||
} | ||
string("password") { | ||
description.set("Password to authenticate with the remote build cache") | ||
fromEnvironment() | ||
} | ||
string("url") { | ||
description.set("URL to the remote build cache") | ||
fromEnvironment() | ||
} | ||
} | ||
group("documentation") { | ||
description.set("Parameters controlling how the documentation is built") | ||
bool("replaceCurrentDocs") { | ||
description.set("The documentation that is being deployed will replace what's currently deployed as 'current'") | ||
defaultValue.set(false) | ||
} | ||
} | ||
group("enterprise") { | ||
description.set("Parameters controlling Gradle Enterprise features") | ||
group("predictiveTestSelection") { | ||
bool("enabled") { | ||
description.set("Whether or not to use Predictive Test Selection for selecting tests to execute") | ||
defaultValue.set(true) | ||
} | ||
} | ||
group("testDistribution") { | ||
bool("enabled") { | ||
description.set("Whether or not to use Test Distribution for executing tests") | ||
defaultValue.set(false) | ||
fromEnvironment() | ||
} | ||
integer("maxLocalExecutors") { | ||
description.set("How many local executors to use for executing tests") | ||
defaultValue.set(1) | ||
} | ||
integer("maxRemoteExecutors") { | ||
description.set("How many remote executors to request for executing tests") | ||
} | ||
} | ||
} | ||
group("testing") { | ||
description.set("Testing related parameters") | ||
bool("enableJaCoCo") { | ||
description.set("Enables JaCoCo test coverage reporting") | ||
defaultValue.set(false) | ||
} | ||
bool("enableJFR") { | ||
description.set("Enables Java Flight Recorder functionality") | ||
defaultValue.set(false) | ||
} | ||
integer("retries") { | ||
description.set("Configures the number of times failing test are retried") | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
withType<JavaCompile>().configureEach { | ||
options.release.set(11) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions
5
.../junitbuild.jacoco-conventions.gradle.kts → .../junitbuild.jacoco-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
plugins { | ||
jacoco | ||
id("junitbuild.build-parameters") | ||
} | ||
|
||
val enableJaCoCo = project.hasProperty("enableJaCoCo") | ||
|
||
jacoco { | ||
toolVersion = requiredVersionFromLibs("jacoco") | ||
} | ||
|
||
tasks.withType<JacocoReport>().configureEach { | ||
enabled = enableJaCoCo | ||
enabled = buildParameters.testing.enableJaCoCo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions
7
...ild.java-toolchain-conventions.gradle.kts → ...ild.java-toolchain-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include("build-parameters") | ||
include("common") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.