Skip to content

SONARRUBY-125 Upgrade gradle wrapper to 9.3.1#105

Merged
rombirli merged 3 commits intomasterfrom
rombirli/upgrade-gradle-wrapper-931
Mar 13, 2026
Merged

SONARRUBY-125 Upgrade gradle wrapper to 9.3.1#105
rombirli merged 3 commits intomasterfrom
rombirli/upgrade-gradle-wrapper-931

Conversation

@rombirli
Copy link
Contributor

@rombirli rombirli commented Mar 4, 2026

No description provided.

@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Mar 4, 2026

SONARRUBY-125

@rombirli rombirli force-pushed the rombirli/upgrade-gradle-wrapper-931 branch 5 times, most recently from 2a6e376 to bc384fd Compare March 5, 2026 13:05
@rombirli rombirli marked this pull request as ready for review March 9, 2026 08:49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to adding comments explaining the code that we added to replace the JRuby Gradle plugin, we need to split the work in this PR into 2 commits:

  1. The replacement of the JRuby Gradle plugin with custom code
  2. The actual upgrade to Gradle 9.3.1

URL initParserScriptUrl = RubyConverter.class.getResource(fromRoot(SETUP_SCRIPT_PATH));

Ruby rubyRuntime = JavaEmbedUtils.initialize(Arrays.asList(raccRubygem.toString(), astRubygem.toString(), parserRubygem.toString()));
if (raccRubygem == null || astRubygem == null || parserRubygem == null || initParserScriptUrl == null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are any of these elements nullable, now?


plugins {
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'com.github.jruby-gradle.base' version '2.0.2'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting rid of the jruby plugin is a significant effort that deserves its own commit, if not ticket, that should not be squashed on its own in the end

Comment on lines +65 to +92
tasks.register("unpackDependencyGems") {
def outputDir = layout.buildDirectory.dir("dependency_gems/gems").get().asFile
def extractionDir = layout.buildDirectory.dir("tmp/unpackDependencyGems").get().asFile
outputs.dir(outputDir)
inputs.files(configurations.gems)

doLast {
delete(outputDir, extractionDir)
outputDir.mkdirs()
extractionDir.mkdirs()

configurations.gems.files.each { gemFile ->
def gemExtractionDir = new File(extractionDir, gemFile.name)
copy {
from tarTree(gemFile)
include "data.tar.gz"
into gemExtractionDir
}
}

fileTree(extractionDir).matching { include "**/data.tar.gz" }.files.each { dataTarGz ->
def gemDirectoryName = dataTarGz.parentFile.name.replaceFirst(/\.gem$/, "")
copy {
from tarTree(resources.gzip(dataTarGz))
into new File(outputDir, gemDirectoryName)
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need some comment explaining clearly what the intent is so that we don't introduce regressions by mistake

@rombirli rombirli marked this pull request as draft March 11, 2026 16:14
@rombirli rombirli force-pushed the rombirli/upgrade-gradle-wrapper-931 branch 3 times, most recently from 07e410b to d5a7e00 Compare March 12, 2026 08:11
@rombirli rombirli force-pushed the rombirli/upgrade-gradle-wrapper-931 branch from d5a7e00 to 428eaa8 Compare March 13, 2026 10:33
@rombirli rombirli force-pushed the rombirli/upgrade-gradle-wrapper-931 branch from 428eaa8 to 873da1f Compare March 13, 2026 11:18
@rombirli rombirli marked this pull request as ready for review March 13, 2026 11:37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏿 I would still add a comment about the shadowing configuration

}

shadowJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would help to add a comment about why we add this parameter. We discussed about this in other repos, but it would help not having to jump around to find the why

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the comment explaining why this duplicateStrategy was added

@sonarqube-next
Copy link

Quality Gate passed Quality Gate passed for 'Ruby'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
0 Dependency risks
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@rombirli rombirli merged commit 56a91c3 into master Mar 13, 2026
7 checks passed
@rombirli rombirli deleted the rombirli/upgrade-gradle-wrapper-931 branch March 13, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants