Skip to content

Conversation

gabrielfeo
Copy link
Owner

@gabrielfeo gabrielfeo commented Aug 20, 2025

Add a tested example to support the use case of a Gradle build. Related to #404 aiming to prevent regressions around this use case.

@gabrielfeo gabrielfeo enabled auto-merge (squash) August 20, 2025 21:21
@gabrielfeo gabrielfeo merged commit 2cdbfb3 into main Aug 20, 2025
7 checks passed
@gabrielfeo gabrielfeo deleted the gf/gradle-build-logic-example branch August 20, 2025 21:28
gabrielfeo added a commit that referenced this pull request Aug 24, 2025
Updates the test case that verifies running the example Kotlin **plugin
project** (a Gradle task which uses the API, added in #452) against the
current library code, i.e. a SNAPSHOT artifact compiled just before the
tests and published to Maven local.

To fix #404, language version had been downgraded to 1.8. To fully
restore compatibility of the latest code, which has since been updated
to use Kotlin plugin 2.2.x (with 1.8 language version, but 2.2.x
stdlib), stdlib and okhttp are downgraded. This restores compatibility
with Gradle 8.11 <= v < 9.0.0.

This [build scan][1] demonstrates the compiler version (not language
version) incompatibility that is now fixed:

```
e: file:///Users/gfeo/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp-jvm/5.1.0/c17340f19b33c1d28a47b8dc4ae15018aff6dc10/okhttp-jvm-5.1.0.jar!/META-INF/okhttp.kotlin_module Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0.	
e: file:///Users/gfeo/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.2.10/30de6faa127a4a012db8e71bf1b9c0a99b1402b2/kotlin-stdlib-2.2.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0.	
e: file:///Users/gfeo/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.2.10/30de6faa127a4a012db8e71bf1b9c0a99b1402b2/kotlin-stdlib-2.2.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0.	
e: file:///Users/gfeo/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.2.10/30de6faa127a4a012db8e71bf1b9c0a99b1402b2/kotlin-stdlib-2.2.10.jar!/META-INF/kotlin-stdlib.kotlin_module Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0.
```

Prevents regressions like #404. Follow-up to #432, #456 and #458 for
example-gradle-task.

ExampleProjectTest is also refactored to use the init script introduced
here. A smoke test verifying that the example is properly forced to use
the published `SNAPSHOT` is added to both tests. `buildSrc` is used in
`example-gradle-task` because
`pluginManagement.repositories.exclusiveContent` set via init script
rules don't seem to apply to build dependencies resolved from included
builds.

[1]:
https://scans.gradle.com/s/hxgfny2ssyugo/tests/task/:library:examplesTest/details/com.gabrielfeo.develocity.api.example.gradle.ExampleGradleTaskTest/smokeTest()?focused-execution=1&top-execution=1#L0-L3
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.

1 participant