Skip to content

Conversation

gabrielfeo
Copy link
Owner

@gabrielfeo gabrielfeo commented Aug 23, 2025

Add a new test case that verifies running the example Kotlin script against the current library code, i.e. a SNAPSHOT artifact compiled just before the tests and published to Maven local.

Prevents regresions like #426 (Kotlin notebooks issue) for Kotlin scripts. Follow-up to #432 for example-scripts.

@gabrielfeo gabrielfeo requested a review from Copilot August 23, 2025 19:32
@gabrielfeo gabrielfeo marked this pull request as ready for review August 23, 2025 19:47
@gabrielfeo gabrielfeo merged commit e4ba799 into main Aug 23, 2025
7 checks passed
@gabrielfeo gabrielfeo deleted the gf/snapshot-script-testing branch August 23, 2025 19:48
gabrielfeo added a commit that referenced this pull request Aug 23, 2025
Add a new test case that verifies running the example Kotlin **project**
against the current library code, i.e. a SNAPSHOT artifact compiled just
before the tests and published to Maven local.

Prevents regressions like #426 (Kotlin notebooks issue) for Kotlin
projects. Follow-up to #432 and #456 for example-project.

This concludes the migration to the `examplesTest` suite.
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