-
-
Notifications
You must be signed in to change notification settings - Fork 970
Upgrade to Gradle 9.4.1 and Micronaut 4 #15365
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
base: 8.0.x
Are you sure you want to change the base?
Changes from all commits
9fb6826
b8dfcfd
df9f655
852effb
80ee39c
dce09db
0460397
4ea8427
7ce8d2b
64541cd
1dae938
3409dfd
1eeb45f
081028b
a0cd73a
66f6229
5afdf6d
34c0f9d
b5a833a
53a5312
f235047
6949ed3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,7 @@ class SbomPlugin implements Plugin<Project> { | |
| 'pkg:maven/org.jline/jline@3.23.0?type=jar' : 'BSD-2-Clause', // maps incorrectly because of https://github.com/CycloneDX/cyclonedx-core-java/issues/205 | ||
| 'pkg:maven/org.liquibase.ext/liquibase-hibernate5@4.27.0?type=jar': 'Apache-2.0', // maps incorrectly because of https://github.com/liquibase/liquibase/issues/2445 & the base pom does not define a license | ||
| 'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.1?type=pom': 'UPL-1.0', // does not have map based on license id | ||
| 'pkg:maven/com.oracle.coherence.ce/coherence-bom@25.03.2?type=pom': 'UPL-1.0', // does not have map based on license id | ||
| 'pkg:maven/com.oracle.coherence.ce/coherence-bom@22.06.2?type=pom': 'UPL-1.0', // does not have map based on license id | ||
| 'pkg:maven/opensymphony/sitemesh@2.6.0?type=jar' : 'OpenSymphony', // custom license approved by legal LEGAL-707 | ||
| 'pkg:maven/org.jruby/jzlib@1.1.5?type=jar' : 'BSD-3-Clause'// https://web.archive.org/web/20240822213507/http://www.jcraft.com/jzlib/LICENSE.txt shows it's a 3 clause | ||
|
|
@@ -208,6 +209,12 @@ class SbomPlugin implements Plugin<Project> { | |
|
|
||
| // cyclonedx does not support "choosing" the license placed in the sbom | ||
| // see: https://github.com/CycloneDX/cyclonedx-gradle-plugin/issues/16 | ||
| // Capture project name at configuration time to avoid deprecated Task.project access at execution time | ||
| // See: https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution | ||
| def projectName = project.name | ||
| def projectPath = project.path | ||
| boolean isReproducibleBuild = lookupProperty(project, 'isReproducibleBuild') | ||
|
Contributor
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. This should be a provider, that's still looked up at execution time. |
||
| ZonedDateTime buildDate = lookupProperty(project, 'buildDate') | ||
|
Contributor
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. This should be a provider that's still looked up at execution time. |
||
| doLast { | ||
| // json schema is documented here: https://cyclonedx.org/docs/1.6/json/ | ||
| def rewriteSbom = { File f -> | ||
|
|
@@ -217,9 +224,8 @@ class SbomPlugin implements Plugin<Project> { | |
| // Use a fixed epoch when SOURCE_DATE_EPOCH is not set so the SBOM is identical between | ||
| // builds. This prevents the non-reproducible timestamp from changing the jar checksum | ||
| // and cascading cache misses through the compile classpath of downstream projects. | ||
| boolean isReproducibleBuild = lookupProperty(project, 'isReproducibleBuild') | ||
| ZonedDateTime sbomTimestamp = isReproducibleBuild ? | ||
| lookupProperty(project, 'buildDate') as ZonedDateTime : | ||
| buildDate : | ||
| Instant.EPOCH.atZone(ZoneOffset.UTC) | ||
| bom['metadata']['timestamp'] = DateTimeFormatter.ISO_INSTANT.format(sbomTimestamp.truncatedTo(ChronoUnit.SECONDS)) | ||
|
|
||
|
|
@@ -228,7 +234,7 @@ class SbomPlugin implements Plugin<Project> { | |
| comps.each { c -> | ||
| // .licenses => choose a license that is compatible with ASF policy if multiple licensed | ||
| if (c instanceof Map && c.licenses instanceof List && !(c.licenses as List).empty) { | ||
| def chosen = pickLicense(task, c['bom-ref'] as String, c.licenses as List) | ||
| def chosen = pickLicense(logger, projectName, c['bom-ref'] as String, c.licenses as List) | ||
| if (chosen != null) { | ||
| c.licenses = [chosen] | ||
| } | ||
|
|
@@ -261,7 +267,7 @@ class SbomPlugin implements Plugin<Project> { | |
|
|
||
| f.setText(JsonOutput.prettyPrint(JsonOutput.toJson(bom)), StandardCharsets.UTF_8.name()) | ||
|
|
||
| logger.info('Rewrote JSON SBOM ({}) to pick preferred license', project.relativePath(f)) | ||
| logger.info('Rewrote JSON SBOM ({}) to pick preferred license', projectPath) | ||
| } | ||
|
|
||
| sbomOutputLocation.get().with { rewriteSbom(it.asFile) } | ||
|
|
@@ -278,29 +284,40 @@ class SbomPlugin implements Plugin<Project> { | |
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Picks the most appropriate license for a dependency from a list of license choices. | ||
| * This method is called at execution time and should not access Task.project. | ||
| * | ||
| * @param logger the logger to use for logging | ||
| * @param projectName the name of the project (captured at configuration time) | ||
| * @param bomRef the bom reference for the dependency | ||
| * @param licenseChoices the list of license choices | ||
| * @return the chosen license | ||
| */ | ||
| @CompileDynamic | ||
| private static Object pickLicense(CycloneDxTask task, String bomRef, List licenseChoices) { | ||
| private static Object pickLicense(org.gradle.api.logging.Logger logger, String projectName, String bomRef, List licenseChoices) { | ||
| if (!bomRef) { | ||
| throw new GradleException("No bomRef found for a dependency of ${task.project.name}, cannot pick license") | ||
| throw new GradleException("No bomRef found for a dependency of ${projectName}, cannot pick license") | ||
| } | ||
|
|
||
| task.logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size()) | ||
| logger.info('Picking license for {} from {} choices', bomRef, licenseChoices.size()) | ||
| if (LICENSE_MAPPING.containsKey(bomRef)) { | ||
| // There are several reasons that cyclone will get the license wrong, usually due to upstream not publishing information or publishing it incorrectly | ||
| // see the licenseMapping map above for details | ||
| def licenseId = LICENSE_MAPPING[bomRef] | ||
| task.logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId) | ||
| logger.lifecycle('Forcing license for {} to {}', bomRef, licenseId) | ||
|
|
||
| def licenseBlock = LICENSES[licenseId] | ||
| if (!licenseBlock) { | ||
| throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${task.project.name}") | ||
| throw new GradleException("Cannot find license information for id ${licenseId} to use for bomRef ${bomRef} in project ${projectName}") | ||
| } | ||
|
|
||
| return licenseBlock | ||
| } | ||
|
|
||
| if (!(licenseChoices instanceof List) || licenseChoices.isEmpty()) { | ||
| throw new GradleException("No License was found for dependency: ${bomRef} in project ${task.project.name}") | ||
| throw new GradleException("No License was found for dependency: ${bomRef} in project ${projectName}") | ||
| } | ||
|
|
||
| def licenseIds = licenseChoices.findAll { it instanceof Map && it.license instanceof Map && it.license.id } | ||
|
|
@@ -312,13 +329,13 @@ class SbomPlugin implements Plugin<Project> { | |
| def defaultLicense = licenseChoices[0] // pick the first one found | ||
| def defaultLicenseId = defaultLicense.license.id as String | ||
| if (defaultLicenseId == null) { | ||
| throw new GradleException("Could not determine License id for dependency: ${bomRef} in project ${task.project.name} for value ${defaultLicense}") | ||
| throw new GradleException("Could not determine License id for dependency: ${bomRef} in project ${projectName} for value ${defaultLicense}") | ||
| } | ||
| if (!(defaultLicenseId in PREFERRED_LICENSES)) { | ||
| def projectLicenseExemptions = LICENSE_EXCEPTIONS[task.project.name] ?: [:] | ||
| def projectLicenseExemptions = LICENSE_EXCEPTIONS[projectName] ?: [:] | ||
| def permittedLicense = projectLicenseExemptions.get(bomRef) == defaultLicenseId | ||
| if (!permittedLicense) { | ||
| throw new GradleException("Unpermitted License found for bom dependency: ${bomRef} in project ${task.project.name} : ${defaultLicenseId}") | ||
| throw new GradleException("Unpermitted License found for bom dependency: ${bomRef} in project ${projectName} : ${defaultLicenseId}") | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ expectitCoreVersion=0.9.0 | |
| gparsVersion=1.2.1 | ||
| # Keep gradle version synced with .sdkmanrc, all gradle-wrapper.properties files, | ||
| # and grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/build/gradle/templates/gradleWrapperProperties.rocker.raw | ||
| gradleToolingApiVersion=8.14.4 | ||
| gradleToolingApiVersion=9.4.1 | ||
| hibernate5Version=5.6.15.Final | ||
| javassistVersion=3.30.2-GA | ||
| jnrPosixVersion=3.1.20 | ||
|
|
@@ -54,15 +54,15 @@ gradleChecksumPluginVersion=1.4.0 | |
| gradleCycloneDxPluginVersion=2.4.1 | ||
|
Contributor
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. 2.4.1 does not officially support gradle 9.x. 3.0.0 is a requirement to upgrade to Gradle 9. |
||
|
|
||
| # micronaut libraries not in the bom due to the potential for spring mismatches | ||
| micronautPlatformVersion=4.9.2 | ||
| micronautPlatformVersion=4.10.10 | ||
|
|
||
| # Libraries only specific to test apps, these should not be exposed | ||
| ersatzVersion=4.0.1 | ||
| grailsSpringSecurityVersion=7.0.2-SNAPSHOT | ||
| jbossTransactionApiVersion=2.0.0.Final | ||
| # Note: we do not import the micronaut bom in our tests to avoid spring version mismatches | ||
| micronautHttpClientVersion=4.9.9 | ||
| micronautSerdeJacksonVersion=2.11.0 | ||
| micronautHttpClientVersion=4.10.18 | ||
| micronautSerdeJacksonVersion=2.16.2 | ||
|
|
||
| # build dependencies for code quality checks | ||
| checkstyleVersion=11.0.0 | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
We should update this comment, you just have to update the bootstrap project and it will copy these to the right locations, only the api update is needed.