Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ksp-version = "2.1.0-1.0.29" # Keep in sync with kotlin-version

dokka-version = "1.9.10"

aws-kotlin-repo-tools-version = "0.4.22"
aws-kotlin-repo-tools-version = "0.4.23"

# libs
coroutines-version = "1.9.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SchemaGeneratorPluginTest {
.create()
.withProjectDir(testProjectDir)
.withPluginClasspath()
.withGradleVersion("8.5") // TODO parameterize
.withGradleDistribution("https://d2pjps8lqszrgq.cloudfront.net/gradle-8.12.1-bin.zip") // TODO Parameterize Gradle versions
Copy link
Contributor

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")

Copy link
Member Author

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

Copy link
Member Author

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

Copy link
Contributor

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

Copy link
Member Author

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...

.forwardOutput()
.withArguments("--info", "build")
}
Expand Down
Loading