[Git][java-team/gradle-kotlin-dsl][master] Generate KotlinDependencyExtensions.kt with the upstream code generator

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Wed Oct 21 12:49:21 BST 2026



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


Commits:
718db228 by Emmanuel Bourg at 2026-10-21T13:41:31+02:00
Generate KotlinDependencyExtensions.kt with the upstream code generator

- - - - -


6 changed files:

- debian/changelog
- debian/clean
- + debian/generator-main.kt
- − debian/patches/02-generate-KotlinDependencyExtensions.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+gradle-kotlin-dsl (0.15.6-4) unstable; urgency=medium
+
+  * Generate KotlinDependencyExtensions.kt with the upstream code generator
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Wed, 21 Oct 2026 13:41:18 +0200
+
 gradle-kotlin-dsl (0.15.6-3) unstable; urgency=medium
 
   * Declare the dependencies of gradle-kotlin-dsl-plugins.pom


=====================================
debian/clean
=====================================
@@ -2,3 +2,5 @@ tooling-builders/target/
 tooling-models/target/
 provider/target/
 plugins/target/
+provider/src/generated/
+debian/generator/


=====================================
debian/generator-main.kt
=====================================
@@ -0,0 +1,11 @@
+// Entry point for the generator derived from the upstream Gradle task
+
+fun main(args: Array<String>) {
+    with(GenerateKotlinDependencyExtensions()) {
+        outputFile = File(args[0])
+        embeddedKotlinVersion = args[1]
+        kotlinDslPluginsVersion = args[2]
+        kotlinDslRepository = args[3]
+        generate()
+    }
+}


=====================================
debian/patches/02-generate-KotlinDependencyExtensions.patch deleted
=====================================
@@ -1,108 +0,0 @@
-Description: Generates KotlinDependencyExtensions.kt until the Gradle build can be used
-Author: Emmanuel Bourg <ebourg at apache.org>
-Forwarded: not-needed
---- /dev/null
-+++ b/provider/src/main/kotlin/org/gradle/kotlin/dsl/KotlinDependencyExtensions.kt
-@@ -0,0 +1,102 @@
-+/*
-+ * Copyright 2016 the original author or authors.
-+ *
-+ * Licensed under the Apache License, Version 2.0 (the "License");
-+ * you may not use this file except in compliance with the License.
-+ * You may obtain a copy of the License at
-+ *
-+ *      http://www.apache.org/licenses/LICENSE-2.0
-+ *
-+ * Unless required by applicable law or agreed to in writing, software
-+ * distributed under the License is distributed on an "AS IS" BASIS,
-+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+ * See the License for the specific language governing permissions and
-+ * limitations under the License.
-+ */
-+
-+package org.gradle.kotlin.dsl
-+
-+import org.gradle.api.artifacts.dsl.DependencyHandler
-+import org.gradle.api.artifacts.dsl.RepositoryHandler
-+
-+import org.gradle.api.artifacts.repositories.ArtifactRepository
-+
-+import org.gradle.plugin.use.PluginDependenciesSpec
-+import org.gradle.plugin.use.PluginDependencySpec
-+
-+
-+/**
-+ * The version of the Kotlin compiler embedded in gradle-kotlin-dsl (currently _1.1.51_).
-+ */
-+val embeddedKotlinVersion = "1.1.51"
-+
-+
-+/**
-+ * Adds the remote repository containing the Kotlin libraries embedded in gradle-kotlin-dsl.
-+ */
-+ at Deprecated("Will be removed in 1.0")
-+fun RepositoryHandler.gradleScriptKotlin(): ArtifactRepository =
-+    maven { it.setUrl("https://repo.gradle.org/gradle/repo") }
-+
-+
-+/**
-+ * Builds the dependency notation for the named Kotlin [module] at the embedded version (currently _1.1.51_).
-+ *
-+ * @param module simple name of the Kotlin module, for example "reflect".
-+ */
-+fun DependencyHandler.embeddedKotlin(module: String): Any =
-+    kotlin(module, embeddedKotlinVersion)
-+
-+
-+/**
-+ * Builds the dependency notation for the named Kotlin [module] at the given [version].
-+ *
-+ * @param module simple name of the Kotlin module, for example "reflect".
-+ * @param version optional desired version, unspecified if null.
-+ */
-+fun DependencyHandler.kotlin(module: String, version: String? = null): Any =
-+    "org.jetbrains.kotlin:kotlin-$module${version?.let { ":$version" } ?: ""}"
-+
-+
-+ at Deprecated("Will be removed in 1.0", ReplaceWith("kotlin(module, version)"))
-+fun DependencyHandler.kotlinModule(module: String, version: String? = null): Any =
-+    kotlin(module, version)
-+
-+
-+/**
-+ * Applies the given Kotlin plugin [module].
-+ *
-+ * For example: `plugins { kotlin("jvm") version "1.1.51" }`
-+ *
-+ * Visit the [plugin portal](https://plugins.gradle.org/search?term=org.jetbrains.kotlin) to see the list of available plugins.
-+ *
-+ * @param module simple name of the Kotlin Gradle plugin module, for example "jvm", "android", "kapt", "plugin.allopen" etc...
-+ */
-+fun PluginDependenciesSpec.kotlin(module: String): PluginDependencySpec =
-+    id("org.jetbrains.kotlin.$module")
-+
-+
-+/**
-+ * The `embedded-kotlin` plugin.
-+ *
-+ * Equivalent to `id("org.gradle.kotlin.embedded-kotlin") version "0.15.6"`
-+ *
-+ * You can also use `` `embedded-kotlin` version "0.15.6" `` if you want to use a different version.
-+ *
-+ * @see org.gradle.kotlin.dsl.plugins.embedded.EmbeddedKotlinPlugin
-+ */
-+val PluginDependenciesSpec.`embedded-kotlin`: PluginDependencySpec
-+    get() = id("org.gradle.kotlin.embedded-kotlin") version "0.15.6"
-+
-+/**
-+ * The `kotlin-dsl` plugin.
-+ *
-+ * Equivalent to `id("org.gradle.kotlin.kotlin-dsl") version "0.15.6"`
-+ *
-+ * You can also use `` `kotlin-dsl` version "0.15.6" `` if you want to use a different version.
-+ *
-+ * @see org.gradle.kotlin.dsl.plugins.dsl.KotlinDslPlugin
-+ */
-+val PluginDependenciesSpec.`kotlin-dsl`: PluginDependencySpec
-+    get() = id("org.gradle.kotlin.kotlin-dsl") version "0.15.6"
-+


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


=====================================
debian/rules
=====================================
@@ -6,6 +6,25 @@ include /usr/share/dpkg/pkg-info.mk
 	dh $@ --with maven-repo-helper
 
 override_dh_auto_build:
+	# KotlinDependencyExtensions.kt is generated with a Gradle task (GenerateKotlinDependencyExtensions.kt)
+	# The task is turned into a standalone program to avoid depending on Gradle
+	mkdir --parents debian/generator provider/src/generated/kotlin/org/gradle/kotlin/dsl
+	sed -e '/^open class/,$$!{/^import org\.gradle\.api/d}' \
+	    -e 's/ : DefaultTask()//' \
+	    -e '/^    @get:OutputFile$$/d' \
+	    -e '/^    @get:Input$$/d' \
+	    -e '/^    @TaskAction$$/d' \
+	    -e '/^    @Suppress("unused")$$/d' \
+	    buildSrc/src/main/kotlin/codegen/GenerateKotlinDependencyExtensions.kt \
+	    > debian/generator/generator.kt
+	cat debian/generator-main.kt >> debian/generator/generator.kt
+	kotlinc -include-runtime -d debian/generator/generator.jar debian/generator/generator.kt
+	java -jar debian/generator/generator.jar \
+	    provider/src/generated/kotlin/org/gradle/kotlin/dsl/KotlinDependencyExtensions.kt \
+	    $$(cat kotlin-version.txt) \
+	    $$(sed -n 's/^val publishedPluginsVersion by extra { "\(.*\)" }$$/\1/p' build.gradle.kts) \
+	    https://repo.gradle.org/gradle/repo
+
 	# gradle-kotlin-dsl-tooling-models
 	kotlinc \
 	    -module-name gradle-kotlin-dsl-tooling-models \
@@ -40,10 +59,11 @@ override_dh_auto_build:
 	        :/usr/share/java/gradle-tooling-api.jar' \
 	    -module-name gradle-kotlin-dsl \
 	    -d provider/target/classes \
-	    provider/src/main/
+	    provider/src/main/ provider/src/generated/kotlin/
 
 	cp -Rp provider/src/main/kotlin/*    provider/target/classes
 	cp -Rp provider/src/main/resources/* provider/target/classes
+	cp -Rp provider/src/generated/kotlin/*   provider/target/classes
 
 	printf 'projects=\nruntime=annotations-13.0.jar,gradle-kotlin-dsl-tooling-models.jar,kotlin-compiler-embeddable.jar,kotlin-scripting-compiler-embeddable.jar,kotlin-scripting-common.jar,kotlin-scripting-jvm.jar,kotlin-scripting-impl.jar,kotlin-reflect.jar,kotlin-sam-with-receiver-compiler-plugin.jar,kotlin-stdlib.jar,kotlin-stdlib-jdk7.jar,kotlin-stdlib-jdk8.jar,kotlin-script-runtime.jar,trove4j.jar' \
 	    > provider/target/classes/gradle-kotlin-dsl-classpath.properties



View it on GitLab: https://salsa.debian.org/java-team/gradle-kotlin-dsl/-/commit/718db228c8e0f6dc0a7c741cf9a7d263031aaaf1

-- 
View it on GitLab: https://salsa.debian.org/java-team/gradle-kotlin-dsl/-/commit/718db228c8e0f6dc0a7c741cf9a7d263031aaaf1
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/20261021/1b5b872e/attachment.htm>


More information about the pkg-java-commits mailing list