Skip to content

Pin the plugin's Kotlin language level on 2.0 #1448

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

Merged
merged 5 commits into from
May 28, 2025

Conversation

Goooler
Copy link
Member

@Goooler Goooler commented May 28, 2025

```diff
OLD: shadow-9.0.0-SNAPSHOT-before.jar
NEW: shadow-9.0.0-SNAPSHOT-after.jar

 JAR   │ old       │ new       │ diff
───────┼───────────┼───────────┼────────────
 class │   456 KiB │ 557.2 KiB │ +101.2 KiB
 other │  14.4 KiB │  14.4 KiB │        0 B
───────┼───────────┼───────────┼────────────
 total │ 470.4 KiB │ 571.6 KiB │ +101.2 KiB

 CLASSES │ old  │ new  │ diff
─────────┼──────┼──────┼─────────────────
 classes │   76 │  120 │ +44 (+45 -1)
 methods │ 1191 │ 1288 │ +97 (+197 -100)
  fields │  201 │  257 │ +56 (+58 -2)
```

```diff
2,3c2,3
< @metadata(mv = {2, 2, 0}, k = 1, xi = 48, d1 = {"��\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0002\b&\u0018��2\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0007¢\u0006\u0004\b\u0003\u0010\u0004J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0002H\u0016¨\u0006\b"}, d2 = {"Lcom/github/jengelman/gradle/plugins/shadow/ShadowPlugin;", "Lorg/gradle/api/Plugin;", "Lorg/gradle/api/Project;", "<init>", "()V", "apply", "", "project", "shadow"})
< /* loaded from: shadow-9.0.0-SNAPSHOT-before.jar:com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.class */
---
> @metadata(mv = {1, 8, 0}, k = 1, xi = 48, d1 = {"��\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\b&\u0018��2\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0002H\u0016¨\u0006\u0007"}, d2 = {"Lcom/github/jengelman/gradle/plugins/shadow/ShadowPlugin;", "Lorg/gradle/api/Plugin;", "Lorg/gradle/api/Project;", "()V", "apply", "", "project", "shadow"})
> /* loaded from: shadow-9.0.0-SNAPSHOT-after.jar:com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.class */
```
@Goooler Goooler force-pushed the g/20250528/pin-kotlin-lang-version branch from e1791bd to c3457ea Compare May 28, 2025 08:01
@Goooler Goooler requested a review from Copilot May 28, 2025 08:03
Copilot

This comment was marked as outdated.

@Goooler Goooler changed the title Pin Kotlin's languageVersion on KOTLIN_1_8 Pin the plugin's Kotlin language level on 1.8 May 28, 2025
build.gradle.kts Outdated
Comment on lines 205 to 206
apiVersion = KotlinVersion.KOTLIN_1_8
languageVersion = apiVersion
Copy link
Member Author

Choose a reason for hiding this comment

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

When we go back to 1.8, something is wrong in the tests

* What went wrong:	
A problem occurred configuring project ':main'.	
> class com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar: inline fun relocate(): compile avoidance is not supported with public inline functions	

https://scans.gradle.com/s/jisjgaaam5e22/tests/overview?outcome=FAILED

Copy link
Member Author

Choose a reason for hiding this comment

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

CC @wolfs

If we can bump the lang level to KOTLIN_2_0? Everything works well after that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know. It is very hard to make a plugin written in Kotlin compatible with multiple Gradle versions for the reasons we are seeing here.

Copy link
Member Author

Choose a reason for hiding this comment

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

The upcoming Gradle 9 requires KOTLIN_2_0, and KOTLIN_1_8 is required by Gradle 8.x versions. But the only thing we rely on KOTLIN_2_0 is Kotlin enum's entries, seems safe to merge this. This should fix your issue about Kotlin metadata.

https://docs.gradle.org/current/userguide/compatibility.html#kotlin

@Goooler Goooler changed the title Pin the plugin's Kotlin language level on 1.8 Pin the plugin's Kotlin language level on 2.0 May 28, 2025
@Goooler Goooler force-pushed the g/20250528/pin-kotlin-lang-version branch from 30520c2 to 93ff41d Compare May 28, 2025 09:20
@Goooler
Copy link
Member Author

Goooler commented May 28, 2025

image

@Goooler Goooler enabled auto-merge (squash) May 28, 2025 09:38
@Goooler Goooler merged commit 8fbfafd into main May 28, 2025
9 checks passed
@Goooler Goooler deleted the g/20250528/pin-kotlin-lang-version branch May 28, 2025 09:42
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.

9.0.0-beta14 breaks when used with Gradle 8.14 Trouble compiling against older kotlin versions
2 participants