Rename nativeExecutables to nativeDistributions

This commit is contained in:
Alexey Tsvetkov
2020-10-27 16:07:16 +03:00
committed by Alexey Tsvetkov
parent 927abf0d03
commit 991b7ff6a7
4 changed files with 12 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ compose.desktop {
application {
mainClass = "example.imageviewer.MainKt"
nativeExecutables {
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "ImageViewer"
modules("jdk.crypto.ec")

View File

@@ -73,7 +73,7 @@ internal fun Project.configurePackagingTasks(apps: Collection<Application>) {
}
internal fun Project.configurePackagingTasks(app: Application): TaskProvider<DefaultTask> {
val packageFormats = app.nativeExecutables.targetFormats.map { targetFormat ->
val packageFormats = app.nativeDistributions.targetFormats.map { targetFormat ->
tasks.composeTask<AbstractJPackageTask>(
taskName("package", app, targetFormat.name),
args = listOf(targetFormat)
@@ -91,7 +91,7 @@ internal fun AbstractJPackageTask.configurePackagingTask(app: Application) {
val targetPlatformSettings = when (targetOS) {
OS.Linux -> {
app.nativeExecutables.linux.also { linux ->
app.nativeDistributions.linux.also { linux ->
linuxShortcut.set(provider { linux.shortcut })
linuxAppCategory.set(provider { linux.appCategory })
linuxAppRelease.set(provider { linux.appRelease })
@@ -103,7 +103,7 @@ internal fun AbstractJPackageTask.configurePackagingTask(app: Application) {
}
}
OS.Windows -> {
app.nativeExecutables.windows.also { win ->
app.nativeDistributions.windows.also { win ->
winConsole.set(provider { win.console })
winDirChooser.set(provider { win.dirChooser })
winPerUserInstall.set(provider { win.perUserInstall })
@@ -115,7 +115,7 @@ internal fun AbstractJPackageTask.configurePackagingTask(app: Application) {
}
}
OS.MacOS -> {
app.nativeExecutables.macOS.also { mac ->
app.nativeDistributions.macOS.also { mac ->
macPackageName.set(provider { mac.packageName })
macPackageIdentifier.set(provider { mac.packageIdentifier })
macSign.set(provider { mac.signing.sign })
@@ -127,7 +127,7 @@ internal fun AbstractJPackageTask.configurePackagingTask(app: Application) {
}
}
app.nativeExecutables.let { executables ->
app.nativeDistributions.let { executables ->
packageName.set(provider { executables.packageName ?: project.name })
packageDescription.set(provider { executables.description })
packageCopyright.set(provider { executables.copyright })
@@ -138,7 +138,7 @@ internal fun AbstractJPackageTask.configurePackagingTask(app: Application) {
})
}
destinationDir.set(app.nativeExecutables.outputBaseDir.map { it.dir("${app.name}/${targetFormat.id}") })
destinationDir.set(app.nativeDistributions.outputBaseDir.map { it.dir("${app.name}/${targetFormat.id}") })
javaHome.set(provider { app.javaHomeOrDefault() })
launcherMainJar.set(app.mainJar.orNull)
@@ -159,7 +159,7 @@ internal fun AbstractJPackageTask.configurePackagingTask(app: Application) {
files.from(project.configurations.named(target.runtimeElementsConfigurationName))
}
}
modules.set(provider { app.nativeExecutables.modules })
modules.set(provider { app.nativeDistributions.modules })
launcherMainClass.set(provider { app.mainClass })
launcherJvmArgs.set(provider { app.jvmArgs })
launcherArgs.set(provider { app.args })

View File

@@ -56,8 +56,8 @@ open class Application @Inject constructor(
this.jvmArgs.addAll(jvmArgs)
}
val nativeExecutables: NativeExecutables = objects.newInstance(NativeExecutables::class.java)
fun nativeExecutables(fn: Action<NativeExecutables>) {
fn.execute(nativeExecutables)
val nativeDistributions: NativeDistributions = objects.newInstance(NativeDistributions::class.java)
fun nativeDistributions(fn: Action<NativeDistributions>) {
fn.execute(nativeDistributions)
}
}

View File

@@ -7,7 +7,7 @@ import org.gradle.api.model.ObjectFactory
import java.util.*
import javax.inject.Inject
open class NativeExecutables @Inject constructor(
open class NativeDistributions @Inject constructor(
objects: ObjectFactory,
layout: ProjectLayout
) {