Update gradle locking (#2758)
to align with naming in docs: https://docs.gradle.org/current/userguide/dependency_locking.html#lock_all_configurations_in_one_build_execution also, fixed an issue I was having when regenerating the lock files by moving it to java-conventions Co-authored-by: github-actions[bot] <github-action[bot]@users.noreply.github.com>
This commit is contained in:
Родитель
aa0e6d66a6
Коммит
35855c2f3b
|
@ -63,7 +63,7 @@ jobs:
|
|||
available_commands="Available commands:
|
||||
* \`/spotless\` - runs \`./gradlew spotlessApply\`
|
||||
* \`/license\` - runs \`./gradlew generateLicenseReport\`
|
||||
* \`/lockfile\` - runs \`./gradlew generateLockfiles --write-locks\`
|
||||
* \`/lockfile\` - runs \`./gradlew resolveAndLockAll --write-locks\`
|
||||
* \`/help\` - displays available commands
|
||||
"
|
||||
# TODO add thumbs up on triggering comment
|
||||
|
@ -87,13 +87,13 @@ jobs:
|
|||
git commit -m "./gradlew generateLicenseReport"
|
||||
git push
|
||||
elif [[ "$COMMAND" == "lockfile" ]]; then
|
||||
./gradlew generateLockfiles --write-locks
|
||||
./gradlew resolveAndLockAll --write-locks
|
||||
git add "*.lockfile"
|
||||
if git diff --cached --quiet; then
|
||||
gh pr comment $NUMBER --body "Already up-to-date"
|
||||
exit 0 # success
|
||||
fi
|
||||
git commit -m "./gradlew generateLockfiles --write-locks"
|
||||
git commit -m "./gradlew resolveAndLockAll --write-locks"
|
||||
git push
|
||||
elif [[ "$COMMAND" == "help" ]]; then
|
||||
gh pr comment $NUMBER --body "$available_commands"
|
||||
|
|
|
@ -16,26 +16,3 @@ subprojects {
|
|||
}
|
||||
|
||||
extra["isRelease"] = (System.getProperty("isRelease") ?: "false").toBoolean()
|
||||
|
||||
allprojects {
|
||||
|
||||
if (!path.startsWith(":smoke-tests")) {
|
||||
configurations.configureEach {
|
||||
if (name.toLowerCase().endsWith("runtimeclasspath")) {
|
||||
resolutionStrategy.activateDependencyLocking()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("generateLockfiles") {
|
||||
doFirst {
|
||||
// you must run with --write-locks parameter
|
||||
require(gradle.startParameter.isWriteDependencyLocks)
|
||||
}
|
||||
doLast {
|
||||
if (configurations.findByName("runtimeClasspath") != null) {
|
||||
configurations.named("runtimeClasspath").get().resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,3 +148,23 @@ dependencyCheck {
|
|||
skipConfigurations = listOf("errorprone", "spotbugs", "checkstyle", "annotationProcessor")
|
||||
failBuildOnCVSS = 0f // fail on any reported CVE
|
||||
}
|
||||
|
||||
if (!path.startsWith(":smoke-tests")) {
|
||||
configurations.configureEach {
|
||||
if (name.toLowerCase().endsWith("runtimeclasspath")) {
|
||||
resolutionStrategy.activateDependencyLocking()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// see https://docs.gradle.org/current/userguide/dependency_locking.html#lock_all_configurations_in_one_build_execution
|
||||
tasks.register("resolveAndLockAll") {
|
||||
doFirst {
|
||||
require(gradle.startParameter.isWriteDependencyLocks)
|
||||
}
|
||||
doLast {
|
||||
if (configurations.findByName("runtimeClasspath") != null) {
|
||||
configurations.named("runtimeClasspath").get().resolve()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче