Browse Source
This change speeds up incremental build of an application image. For example, for one (relatively small) tested application the overall time spent on creating binary images in incremental case (after one file change) went from ~5 seconds down to 1.4 seconds (non-rigorous benchmark using a relatively fast 8-core 2.3Ghz i9 MBP).pull/224/head
Alexey Tsvetkov
4 years ago
committed by
Alexey Tsvetkov
8 changed files with 124 additions and 33 deletions
@ -0,0 +1,9 @@ |
|||||||
|
package org.jetbrains.compose.desktop.application.dsl |
||||||
|
|
||||||
|
internal enum class RuntimeCompressionLevel(internal val id: Int) { |
||||||
|
// For ID values see the docs on "--compress" https://docs.oracle.com/javase/9/tools/jlink.htm |
||||||
|
|
||||||
|
NO_COMPRESSION(0), |
||||||
|
CONSTANT_STRING_SHARING(1), |
||||||
|
ZIP(2) |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
package org.jetbrains.compose.desktop.application.internal |
||||||
|
|
||||||
|
import org.gradle.api.file.FileSystemLocation |
||||||
|
import org.gradle.api.provider.Provider |
||||||
|
import java.io.File |
||||||
|
|
||||||
|
internal val <T : FileSystemLocation> Provider<T>.ioFile: File |
||||||
|
get() = get().asFile |
||||||
|
|
||||||
|
internal val <T : FileSystemLocation> Provider<T>.ioFileOrNull: File? |
||||||
|
get() = orNull?.asFile |
@ -0,0 +1,48 @@ |
|||||||
|
package org.jetbrains.compose.desktop.application.tasks |
||||||
|
|
||||||
|
import org.gradle.api.provider.ListProperty |
||||||
|
import org.gradle.api.provider.Property |
||||||
|
import org.gradle.api.tasks.Input |
||||||
|
import org.gradle.api.tasks.Optional |
||||||
|
import org.jetbrains.compose.desktop.application.dsl.RuntimeCompressionLevel |
||||||
|
import org.jetbrains.compose.desktop.application.internal.cliArg |
||||||
|
import org.jetbrains.compose.desktop.application.internal.notNullProperty |
||||||
|
import org.jetbrains.compose.desktop.application.internal.nullableProperty |
||||||
|
import java.io.File |
||||||
|
|
||||||
|
// todo: public DSL |
||||||
|
// todo: deduplicate if multiple runtimes are created |
||||||
|
abstract class AbstractJLinkTask : AbstractJvmToolOperationTask("jlink") { |
||||||
|
@get:Input |
||||||
|
val modules: ListProperty<String> = objects.listProperty(String::class.java) |
||||||
|
|
||||||
|
@get:Input |
||||||
|
internal val stripDebug: Property<Boolean> = objects.notNullProperty(true) |
||||||
|
|
||||||
|
@get:Input |
||||||
|
internal val noHeaderFiles: Property<Boolean> = objects.notNullProperty(true) |
||||||
|
|
||||||
|
@get:Input |
||||||
|
internal val noManPages: Property<Boolean> = objects.notNullProperty(true) |
||||||
|
|
||||||
|
@get:Input |
||||||
|
internal val stripNativeCommands: Property<Boolean> = objects.notNullProperty(true) |
||||||
|
|
||||||
|
@get:Input |
||||||
|
@get:Optional |
||||||
|
internal val compressionLevel: Property<RuntimeCompressionLevel?> = objects.nullableProperty() |
||||||
|
|
||||||
|
override fun makeArgs(tmpDir: File): MutableList<String> = super.makeArgs(tmpDir).apply { |
||||||
|
modules.get().forEach { m -> |
||||||
|
cliArg("--add-modules", m) |
||||||
|
} |
||||||
|
|
||||||
|
cliArg("--strip-debug", stripDebug) |
||||||
|
cliArg("--no-header-files", noHeaderFiles) |
||||||
|
cliArg("--no-man-pages", noManPages) |
||||||
|
cliArg("--strip-native-commands", stripNativeCommands) |
||||||
|
cliArg("--compress", compressionLevel.orNull?.id ) |
||||||
|
|
||||||
|
cliArg("--output", destinationDir) |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue