[Git][java-team/gradle-kotlin-dsl][master] 5 commits: Link the Kotlin scripting jars into the Gradle lib directory

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Wed Sep 23 19:05:52 BST 2026



Emmanuel Bourg pushed to branch master at Debian Java Maintainers / gradle-kotlin-dsl


Commits:
c8b0c871 by Emmanuel Bourg at 2026-09-23T18:10:10+02:00
Link the Kotlin scripting jars into the Gradle lib directory

- - - - -
7c69295a by Emmanuel Bourg at 2026-09-23T18:10:10+02:00
New patch recognizing the unversioned Kotlin jars of Debian

- - - - -
a5346226 by Emmanuel Bourg at 2026-09-23T18:10:10+02:00
New patch reading the class files the way the command line compiler does

- - - - -
a2a8bd5a by Emmanuel Bourg at 2026-09-23T18:34:13+02:00
Removed 04-gradle-compatibility.patch, obsolete since Gradle 4.5

- - - - -
398bd2b7 by Emmanuel Bourg at 2026-09-23T18:34:13+02:00
Upload to unstable

- - - - -


6 changed files:

- debian/changelog
- debian/libgradle-kotlin-dsl-java.links
- − debian/patches/04-gradle-compatibility.patch
- + debian/patches/06-kotlin-jar-names.patch
- + debian/patches/07-fast-class-files-reading.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -3,8 +3,17 @@ gradle-kotlin-dsl (0.14.2-2) unstable; urgency=medium
   * New patch registering the Kotlin scripting compiler plugin, required
     since Kotlin 1.3 to have the build script definitions taken into
     account
-
- -- Emmanuel Bourg <ebourg at apache.org>  Wed, 23 Sep 2026 14:59:13 +0200
+  * Added the Kotlin scripting jars to the Gradle lib directory
+  * New patch recognizing the unversioned Kotlin jars of Debian, the
+    Kotlin standard library was missing from the build script classpath
+  * New patch reading the class files with the implementation used by
+    the Kotlin command line compiler, string concatenations were
+    rejected in the build scripts
+  * Removed 04-gradle-compatibility.patch, it reverted the source path
+    resolution to its Gradle 4.4.1 implementation and undid the renaming
+    of the kotlin-stdlib-jre8 module
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Wed, 23 Sep 2026 18:16:07 +0200
 
 gradle-kotlin-dsl (0.14.2-1) unstable; urgency=medium
 


=====================================
debian/libgradle-kotlin-dsl-java.links
=====================================
@@ -3,6 +3,10 @@ usr/share/java/gradle-kotlin-dsl-tooling-builders.jar            usr/share/gradl
 usr/share/java/gradle-kotlin-dsl-tooling-models.jar              usr/share/gradle/lib/gradle-kotlin-dsl-tooling-models.jar
 usr/share/java/org.jetbrains.annotations-common.jar              usr/share/gradle/lib/annotations-13.0.jar
 usr/share/java/kotlin-compiler-embeddable.jar                    usr/share/gradle/lib/kotlin-compiler-embeddable.jar
+usr/share/java/kotlin-scripting-compiler-embeddable.jar          usr/share/gradle/lib/kotlin-scripting-compiler-embeddable.jar
+usr/share/java/kotlin-scripting-common.jar                       usr/share/gradle/lib/kotlin-scripting-common.jar
+usr/share/java/kotlin-scripting-jvm.jar                          usr/share/gradle/lib/kotlin-scripting-jvm.jar
+usr/share/java/kotlin-scripting-impl.jar                         usr/share/gradle/lib/kotlin-scripting-impl.jar
 usr/share/java/kotlin-reflect.jar                                usr/share/gradle/lib/kotlin-reflect.jar
 usr/share/java/kotlin-sam-with-receiver-compiler-plugin.jar      usr/share/gradle/lib/kotlin-sam-with-receiver-compiler-plugin.jar
 usr/share/java/kotlin-stdlib.jar                                 usr/share/gradle/lib/kotlin-stdlib.jar


=====================================
debian/patches/04-gradle-compatibility.patch deleted
=====================================
@@ -1,142 +0,0 @@
---- a/tooling-builders/src/main/kotlin/org/gradle/kotlin/dsl/tooling/builders/KotlinLibSources.kt
-+++ b/tooling-builders/src/main/kotlin/org/gradle/kotlin/dsl/tooling/builders/KotlinLibSources.kt
-@@ -16,14 +16,14 @@
- 
- package org.gradle.kotlin.dsl.tooling.builders
- 
-+import org.gradle.api.artifacts.ModuleVersionIdentifier
- import org.gradle.api.artifacts.component.ComponentIdentifier
- import org.gradle.api.artifacts.component.ModuleComponentIdentifier
- import org.gradle.api.artifacts.dsl.DependencyHandler
--import org.gradle.api.artifacts.query.ArtifactResolutionQuery
- import org.gradle.api.artifacts.result.ResolvedArtifactResult
--
- import org.gradle.api.initialization.dsl.ScriptHandler
- import org.gradle.api.initialization.dsl.ScriptHandler.CLASSPATH_CONFIGURATION
-+import org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier
- 
- import org.gradle.internal.classpath.ClassPath
- import org.gradle.internal.classpath.DefaultClassPath
-@@ -35,19 +35,17 @@
- 
- import org.gradle.language.base.artifact.SourcesArtifact
- 
-+import org.gradle.plugins.ide.internal.resolver.DefaultIdeDependencyResolver
-+
- 
- internal
- fun sourcePathFor(scriptHandlers: List<ScriptHandler>): ClassPath {
-     var sourcePath = ClassPath.EMPTY
--
--    val resolvedDependencies = hashSetOf<ComponentIdentifier>()
-+    val resolvedDependencies = hashSetOf<ModuleVersionIdentifier>()
-     for (buildscript in scriptHandlers.asReversed()) {
--        val unresolvedDependencies = classpathDependenciesOf(buildscript).filter { it !in resolvedDependencies }
--        if (unresolvedDependencies.isNotEmpty()) {
--            sourcePath += resolveSourcesUsing(buildscript.dependencies) {
--                forComponents(unresolvedDependencies)
--            }
--            resolvedDependencies += unresolvedDependencies
-+        val classpathDependencies = classpathDependenciesOf(buildscript).filter { it !in resolvedDependencies }
-+        if (resolvedDependencies.addAll(classpathDependencies)) {
-+            sourcePath += resolveSourcesUsing(buildscript.dependencies, classpathDependencies.map { it.toModuleId() })
-         }
-     }
- 
-@@ -60,50 +58,39 @@
- 
- 
- private
--fun containsBuiltinKotlinModules(resolvedDependencies: Collection<ComponentIdentifier>): Boolean {
--    val resolvedModules = resolvedDependencies.filterIsInstance<ModuleComponentIdentifier>()
--    return builtinKotlinModules.all { kotlinModule ->
--        resolvedModules.any { resolved ->
--            resolved.module == kotlinModule && resolved.version == embeddedKotlinVersion
--        }
--    }
--}
-+fun containsBuiltinKotlinModules(resolvedDependencies: HashSet<ModuleVersionIdentifier>) =
-+    resolvedDependencies.containsAll(
-+        builtinKotlinModules.map(::kotlinModuleVersionIdentifier))
-+
-+
-+private
-+fun classpathDependenciesOf(buildscript: ScriptHandler): List<ModuleVersionIdentifier> =
-+    DefaultIdeDependencyResolver()
-+        .getIdeRepoFileDependencies(buildscript.configurations[CLASSPATH_CONFIGURATION])
-+        .map { it.id }
- 
- 
- private
--fun classpathDependenciesOf(buildscript: ScriptHandler): List<ComponentIdentifier> =
--    buildscript
--        .configurations[CLASSPATH_CONFIGURATION]
--        .incoming
--        .artifactView { it.lenient(true) }
--        .artifacts
--        .map { it.id.componentIdentifier }
-+fun ModuleVersionIdentifier.toModuleId() = moduleId(group, name, version)
- 
- 
- internal
- fun kotlinLibSourcesFor(scriptHandlers: List<ScriptHandler>): ClassPath =
-     scriptHandlers
--        .asSequence()
-         .filter { it.repositories.isNotEmpty() }
-         .map { resolveKotlinLibSourcesUsing(it.dependencies) }
-         .find { !it.isEmpty } ?: ClassPath.EMPTY
- 
--
- private
- fun resolveKotlinLibSourcesUsing(dependencyHandler: DependencyHandler): ClassPath =
--    resolveSourcesUsing(dependencyHandler) {
--        builtinKotlinModules.forEach { kotlinModule ->
--            forModule("org.jetbrains.kotlin", kotlinModule, embeddedKotlinVersion)
--        }
--    }
--
-+    resolveSourcesUsing(dependencyHandler, kotlinComponentIdentifiers)
- 
- private
--fun resolveSourcesUsing(dependencyHandler: DependencyHandler, query: ArtifactResolutionQuery.() -> Unit): ClassPath =
-+fun resolveSourcesUsing(dependencyHandler: DependencyHandler, components: List<ComponentIdentifier>): ClassPath =
-     DefaultClassPath.of(
-         dependencyHandler
-             .createArtifactResolutionQuery()
--            .apply(query)
-+            .forComponents(components)
-             .withArtifacts(JvmLibrary::class.java, SourcesArtifact::class.java)
-             .execute()
-             .resolvedComponents
-@@ -113,4 +100,30 @@
- 
- 
- private
--val builtinKotlinModules = listOf("kotlin-stdlib-jdk8", "kotlin-reflect")
-+val builtinKotlinModules = listOf("kotlin-stdlib-jre8", "kotlin-reflect")
-+
-+
-+private
-+val kotlinComponentIdentifiers by lazy {
-+    builtinKotlinModules.map(::kotlinComponent)
-+}
-+
-+
-+private
-+fun kotlinComponent(module: String): ComponentIdentifier =
-+    moduleId("org.jetbrains.kotlin", module, embeddedKotlinVersion)
-+
-+
-+private
-+fun kotlinModuleVersionIdentifier(module: String): ModuleVersionIdentifier =
-+    DefaultModuleVersionIdentifier("org.jetbrains.kotlin", module, embeddedKotlinVersion)
-+
-+
-+private
-+fun moduleId(group: String, module: String, version: String) =
-+    object : ModuleComponentIdentifier {
-+        override fun getGroup() = group
-+        override fun getModule() = module
-+        override fun getVersion() = version
-+        override fun getDisplayName() = "$group:$module:$version"
-+    }


=====================================
debian/patches/06-kotlin-jar-names.patch
=====================================
@@ -0,0 +1,19 @@
+Description: Recognize the unversioned Kotlin jars of Debian
+ The Kotlin jars of the Gradle distribution carry their version in their name,
+ for example kotlin-stdlib-1.2.21.jar, and the filter selecting them for the
+ classpath used to compile the build scripts expects the trailing dash. Debian
+ installs them without a version, as kotlin-stdlib.jar and kotlin-reflect.jar,
+ so they were all rejected and the scripts were compiled without the Kotlin
+ standard library: "Cannot access class 'kotlin.Unit'".
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/provider/src/main/kotlin/org/gradle/kotlin/dsl/provider/KotlinScriptClassPathProvider.kt
++++ b/provider/src/main/kotlin/org/gradle/kotlin/dsl/provider/KotlinScriptClassPathProvider.kt
+@@ -158,5 +158,5 @@
+ 
+ private
+ fun isKotlinJar(name: String): Boolean =
+-    name.startsWith("kotlin-stdlib-")
+-        || name.startsWith("kotlin-reflect-")
++    name.startsWith("kotlin-stdlib")
++        || name.startsWith("kotlin-reflect")


=====================================
debian/patches/07-fast-class-files-reading.patch
=====================================
@@ -0,0 +1,23 @@
+Description: Read the class files the way the command line compiler does
+ The Kotlin compiler has two implementations for reading class files, and the
+ command line compiler enables the faster one that does not go through the PSI
+ layer. The Kotlin DSL leaves the setting at its default when it embeds the
+ compiler to build the Gradle scripts, and the PSI based reader fails on
+ java.lang.String as soon as its supertypes are resolved: since Java 12 it
+ implements java.lang.constant.ConstantDesc, which the reader does not find.
+ Concatenating two strings in a build script was enough to trigger it.
+ .
+ Upstream never met the problem because Gradle 4.6 was built and run with
+ Java 8, where String has no such supertype.
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/provider/src/main/kotlin/org/gradle/kotlin/dsl/support/KotlinCompiler.kt
++++ b/provider/src/main/kotlin/org/gradle/kotlin/dsl/support/KotlinCompiler.kt
+@@ -191,6 +191,7 @@
+     CompilerConfiguration().apply {
+         addKotlinSourceRoots(sourceFiles.map { it.canonicalPath })
+         put<MessageCollector>(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
++        put(JVMConfigurationKeys.USE_FAST_CLASS_FILES_READING, true)
+     }
+ 
+ 


=====================================
debian/patches/series
=====================================
@@ -1,5 +1,6 @@
 01-kotlin-compatibility.patch
 02-generate-KotlinDependencyExtensions.patch
 03-kotlin-stdlib-jdk.patch
-04-gradle-compatibility.patch
 05-kotlin-1.3-scripting-plugin.patch
+06-kotlin-jar-names.patch
+07-fast-class-files-reading.patch



View it on GitLab: https://salsa.debian.org/java-team/gradle-kotlin-dsl/-/compare/8a490aa86e969220401e7de68d179289b17be787...398bd2b721bd6dba8ff0fa48d72c3801e4703dd9

-- 
View it on GitLab: https://salsa.debian.org/java-team/gradle-kotlin-dsl/-/compare/8a490aa86e969220401e7de68d179289b17be787...398bd2b721bd6dba8ff0fa48d72c3801e4703dd9
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20260923/234bcccf/attachment.htm>


More information about the pkg-java-commits mailing list