-
Notifications
You must be signed in to change notification settings - Fork 55
fix: use custom Gradle distribution in schema generator tests #1585
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
Conversation
|
A new generated diff is ready to view.
|
| .withProjectDir(testProjectDir) | ||
| .withPluginClasspath() | ||
| .withGradleVersion("8.5") // TODO parameterize | ||
| .withGradleDistribution("https://d2pjps8lqszrgq.cloudfront.net/gradle-8.12.1-bin.zip") // TODO Parameterize Gradle versions |
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.
Question: Do we need to parameterize the Gradle version or do we really want to match the Gradle version already running? Because our CI updates gradle/wrapper/gradle-wrapper.properties with the distribution URL. It seems like we could reuse that for this runner configuration:
private fun detectGradleWrapperDistro(): URI {
val propertiesFile = File("../../../gradle/wrapper/gradle-wrapper.properties")
val properties = propertiesFile
.readLines()
.map { it.trim() }
.filterNot { it.isBlank() || it.startsWith("#") }
.associate { it.split("=", limit = 2).run { get(0).trim() to getOrNull(1)?.trim() } }
return URI(requireNotNull(properties["distributionUrl"]))
}
...
runner = GradleRunner
.create()
.withProjectDir(testProjectDir)
.withPluginClasspath()
.withGradleDistribution(detectGradleWrapperDistro())
.forwardOutput()
.withArguments("--info", "build")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.
I think you originally gave me feedback that we should test across multiple Gradle versions to ensure compatibility. I'm not too concerned about that, but I think synchronizing with gradle-wrapper.properties would be good
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.
Nevermind, you gave the same feedback back then that you just did now 😆
#1385 (comment)
I'll try to update this to pull the version from gradle-wrapper.properties
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.
What happens if we don't use withGradleVersion or withGradleDistribution. According to the Gradle runner docs:
By default, the runner will attempt to find a Gradle distribution based on where the GradleRunner class was loaded from
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.
Nice suggestion, it seems to work locally, let's try it in CI...
|
|
A new generated diff is ready to view.
|
Affected ArtifactsNo artifacts changed size |



Issue #
Description of changes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.