-
Notifications
You must be signed in to change notification settings - Fork 134
Synchronize gradle/scripts with the uptream #1322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,8 @@ if (publishToStaging) { | |
| } | ||
| } | ||
|
|
||
| clientTimeout.set(Duration.ofMinutes(30)) | ||
|
|
||
|
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
rg -n 'import java.time.Duration' gradle/scripts/lib/common-publish.gradleRepository: line/centraldogma Length of output: 155 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- file outline ---'
ast-grep outline gradle/scripts/lib/common-publish.gradle --view expanded || true
echo
echo '--- first 120 lines ---'
sed -n '1,120p' gradle/scripts/lib/common-publish.gradle | cat -n
echo
echo '--- search for Duration usage/imports in Gradle scripts ---'
rg -n '\bDuration\b|import java\.time\.Duration|java\.time\.' gradle/scripts/lib -g '*.gradle' -g '*.groovy' || trueRepository: line/centraldogma Length of output: 5302 Import 🤖 Prompt for AI Agents |
||
| transitionCheckOptions { | ||
| maxRetries.set(100) | ||
| delayBetween.set(Duration.ofSeconds(20)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,10 @@ import java.util.concurrent.atomic.AtomicInteger | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| buildscript { | ||||||||||||||||||||||||||||||||
| repositories { | ||||||||||||||||||||||||||||||||
| def mavenCentralMirror = providers.gradleProperty('mavenCentralMirror').getOrNull() | ||||||||||||||||||||||||||||||||
| if (mavenCentralMirror) { | ||||||||||||||||||||||||||||||||
| maven { url = mavenCentralMirror } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| gradlePluginPortal() | ||||||||||||||||||||||||||||||||
| google() | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
@@ -14,17 +18,44 @@ buildscript { | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def globalShadowExclusions = [] | ||||||||||||||||||||||||||||||||
| if (rootProject.hasProperty('shadowExclusions')) { | ||||||||||||||||||||||||||||||||
| def rawShadowExclusions = rootProject.findProperty("shadowExclusions") | ||||||||||||||||||||||||||||||||
| if (!(rawShadowExclusions instanceof String)) { | ||||||||||||||||||||||||||||||||
| throw new RuntimeException("Property 'shadowExclusions' must be a String but was: ${rawShadowExclusions.getClass().name}") | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| globalShadowExclusions = rawShadowExclusions.split(",") | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Trim
Proposed fix- globalShadowExclusions = rawShadowExclusions.split(",")
+ globalShadowExclusions = rawShadowExclusions
+ .split(',')
+ .collect { it.trim() }
+ .findAll { !it.isEmpty() }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| subprojects { | ||||||||||||||||||||||||||||||||
| ext { | ||||||||||||||||||||||||||||||||
| shadowExclusions = globalShadowExclusions.collect() | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def relocatedProjects = projectsWithFlags('java', 'relocate') | ||||||||||||||||||||||||||||||||
| def numConfiguredRelocatedProjects = new AtomicInteger() | ||||||||||||||||||||||||||||||||
| configure(relocatedProjects) { | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // per-dependency shade configuration | ||||||||||||||||||||||||||||||||
| // while shade per-project shades all dependencies, shade per-dependency allows for finer control | ||||||||||||||||||||||||||||||||
| def shadeConfig = project.configurations.create("shade") { | ||||||||||||||||||||||||||||||||
| canBeResolved = true | ||||||||||||||||||||||||||||||||
| canBeConsumed = false | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| project.configurations.api.extendsFrom(shadeConfig) | ||||||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Keep
Also applies to: 369-374, 400-403 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Generate the shaded JARs. | ||||||||||||||||||||||||||||||||
| task shadedJar( | ||||||||||||||||||||||||||||||||
| type: ShadowJar, | ||||||||||||||||||||||||||||||||
| group: 'Build', | ||||||||||||||||||||||||||||||||
| description: 'Builds the shaded main JAR.', | ||||||||||||||||||||||||||||||||
| dependsOn: tasks.classes) { | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| configureShadowTask(project, delegate, true) | ||||||||||||||||||||||||||||||||
| def self = this | ||||||||||||||||||||||||||||||||
| def delegate0 = delegate | ||||||||||||||||||||||||||||||||
| project.afterEvaluate { | ||||||||||||||||||||||||||||||||
| self.configureShadowTask(project, delegate0, true) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| archiveClassifier.set('shaded') | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Exclude the legacy file listing. | ||||||||||||||||||||||||||||||||
|
|
@@ -49,14 +80,6 @@ configure(relocatedProjects) { | |||||||||||||||||||||||||||||||
| return false | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def shadowExclusions = [] | ||||||||||||||||||||||||||||||||
| if (rootProject.hasProperty('shadowExclusions')) { | ||||||||||||||||||||||||||||||||
| shadowExclusions = rootProject.findProperty('shadowExclusions').split(",") | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| shadowExclusions.each { | ||||||||||||||||||||||||||||||||
| exclude it | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Set the 'Automatic-Module-Name' property in MANIFEST.MF. | ||||||||||||||||||||||||||||||||
| if (project.ext.automaticModuleName != null) { | ||||||||||||||||||||||||||||||||
| doFirst { | ||||||||||||||||||||||||||||||||
|
|
@@ -92,7 +115,11 @@ configure(relocatedProjects) { | |||||||||||||||||||||||||||||||
| description: 'Builds the shaded test JAR.', | ||||||||||||||||||||||||||||||||
| dependsOn: tasks.testClasses) { | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| configureShadowTask(project, delegate, false) | ||||||||||||||||||||||||||||||||
| def self = this | ||||||||||||||||||||||||||||||||
| def delegate0 = delegate | ||||||||||||||||||||||||||||||||
| project.afterEvaluate { | ||||||||||||||||||||||||||||||||
| self.configureShadowTask(project, delegate0, false) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| archiveBaseName.set("test-${tasks.jar.archiveBaseName.get()}-shaded") | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -335,9 +362,18 @@ private void configureShadowTask(Project project, ShadowJar task, boolean isMain | |||||||||||||||||||||||||||||||
| // e.g. WEB-INF/lib/hello.jar | ||||||||||||||||||||||||||||||||
| exclude '**/*.jar' | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| project.ext.shadowExclusions.each { | ||||||||||||||||||||||||||||||||
| exclude it | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| configurations = [project.configurations[isMain ? 'compileClasspath' : 'testCompileClasspath']] | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def shadeConfig = project.configurations.findByName("shade") | ||||||||||||||||||||||||||||||||
| def shadedDeps = shadeConfig ? | ||||||||||||||||||||||||||||||||
| shadeConfig.dependencies.collect { "${it.group}:${it.name}" }.toSet() : | ||||||||||||||||||||||||||||||||
| [] as Set<String> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| relocations.each { props -> | ||||||||||||||||||||||||||||||||
| task.relocate props['from'], props['to'] | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
@@ -361,8 +397,10 @@ private void configureShadowTask(Project project, ShadowJar task, boolean isMain | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } else { // hasFlags('relocate') | ||||||||||||||||||||||||||||||||
| // Only want to rewrite source references, not bundle dependencies. | ||||||||||||||||||||||||||||||||
| exclude { true } | ||||||||||||||||||||||||||||||||
| // Only want to shade if explicitly specified on the dependency | ||||||||||||||||||||||||||||||||
| exclude { | ||||||||||||||||||||||||||||||||
| return !shadedDeps.contains("${it.moduleGroup}:${it.moduleName}") | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Narrow the documented scope of
mavenCentralMirror.This text promises that all
mavenCentral()declarations, includingsettings.gradleandbuildSrc, are redirected, but the wiring in this PR only touches the repositories inside the shipped Gradle scripts. As written, users can still leave directmavenCentral()calls in their ownsettings.gradle/buildSrcand hit the public repo unexpectedly. Please either scope the docs to the script-managed repositories or add the missing wiring.🤖 Prompt for AI Agents