diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/NativeDistributions.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/NativeDistributions.kt index c6c5db6114..2718409e44 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/NativeDistributions.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/NativeDistributions.kt @@ -34,6 +34,7 @@ open class NativeDistributions @Inject constructor( fun modules(vararg modules: String) { this.modules.addAll(modules.toList()) } + var includeAllModules: Boolean = false var targetFormats: Set = EnumSet.noneOf(TargetFormat::class.java) fun targetFormats(vararg formats: TargetFormat) { diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureApplication.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureApplication.kt index e3f9b41585..10bd7a862b 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureApplication.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureApplication.kt @@ -69,6 +69,8 @@ internal fun Project.configurePackagingTasks(apps: Collection) { dependsOn(checkRuntime) javaHome.set(provider { app.javaHomeOrDefault() }) modules.set(provider { app.nativeDistributions.modules }) + includeAllModules.set(provider { app.nativeDistributions.includeAllModules }) + javaRuntimePropertiesFile.set(checkRuntime.flatMap { it.javaRuntimePropertiesFile }) destinationDir.set(project.layout.buildDirectory.dir("compose/tmp/${app.name}/runtime")) } diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJLinkTask.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJLinkTask.kt index 7d48693239..3a4a14410b 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJLinkTask.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJLinkTask.kt @@ -1,10 +1,14 @@ package org.jetbrains.compose.desktop.application.tasks +import org.gradle.api.file.RegularFileProperty import org.gradle.api.provider.ListProperty import org.gradle.api.provider.Property import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.Optional import org.jetbrains.compose.desktop.application.dsl.RuntimeCompressionLevel +import org.jetbrains.compose.desktop.application.internal.* +import org.jetbrains.compose.desktop.application.internal.JavaRuntimeProperties import org.jetbrains.compose.desktop.application.internal.cliArg import org.jetbrains.compose.desktop.application.internal.notNullProperty import org.jetbrains.compose.desktop.application.internal.nullableProperty @@ -16,6 +20,12 @@ abstract class AbstractJLinkTask : AbstractJvmToolOperationTask("jlink") { @get:Input val modules: ListProperty = objects.listProperty(String::class.java) + @get:Input + val includeAllModules: Property = objects.notNullProperty() + + @get:InputFile + val javaRuntimePropertiesFile: RegularFileProperty = objects.fileProperty() + @get:Input internal val stripDebug: Property = objects.notNullProperty(true) @@ -33,7 +43,11 @@ abstract class AbstractJLinkTask : AbstractJvmToolOperationTask("jlink") { internal val compressionLevel: Property = objects.nullableProperty() override fun makeArgs(tmpDir: File): MutableList = super.makeArgs(tmpDir).apply { - modules.get().forEach { m -> + val modulesToInclude = + if (includeAllModules.get()) { + JavaRuntimeProperties.readFromFile(javaRuntimePropertiesFile.ioFile).availableModules + } else modules.get() + modulesToInclude.forEach { m -> cliArg("--add-modules", m) }