From 02dca20f8d8ce5ffa0a5532a90386827033b84b4 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 26 Sep 2019 22:00:40 +0200 Subject: [PATCH] create more start scripts --- build.gradle.kts | 74 +++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index cb79f79..a726d62 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.api.internal.plugins.UnixStartScriptGenerator +import org.gradle.api.internal.plugins.WindowsStartScriptGenerator import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import kotlin.math.max @@ -7,10 +9,10 @@ import java.util.Properties plugins { // Apply the Kotlin JVM plugin to add support for Kotlin on the JVM. kotlin("jvm") version "1.3.50" + `maven-publish` + application id("org.jetbrains.dokka") version "0.9.18" id("com.jfrog.bintray") version "1.7.3" - id("maven-publish") - id("application") } val versionProps = Properties().also { @@ -40,31 +42,51 @@ dependencies { testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.1.0") } +tasks { + named("test") { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + // Always run tests, even when nothing changed. + dependsOn("cleanTest") + // Show test results. + testLogging.events("failed") + + // parallel tests. + systemProperty("junit.jupiter.execution.parallel.enabled", "true") + systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") + maxParallelForks = max(1, Runtime.getRuntime().availableProcessors() / 2) + } + + withType { + kotlinOptions.jvmTarget = "1.8" + } + + named("dokka") { + outputFormat = "html" + outputDirectory = "$buildDir/kdoc" + skipEmptyPackages = true + } +} + +val c64emuScript by tasks.registering(CreateStartScripts::class) { + outputDir = File(project.buildDir, "bin") + applicationName = "c64emu" + mainClassName = "razorvine.c64emu.C64MainKt" + classpath = project.tasks["jar"].outputs.files + project.configurations.runtimeClasspath.get() +} + +val ehbasicScript by tasks.registering(CreateStartScripts::class) { + outputDir = File(project.buildDir, "bin") + applicationName = "ehbasic" + mainClassName = "razorvine.examplemachines.EhBasicMainKt" + classpath = project.tasks["jar"].outputs.files + project.configurations.runtimeClasspath.get() +} + application { applicationName = "ksim65vm" mainClassName = "razorvine.examplemachines.MachineMainKt" -} - -tasks.named("test") { - // Enable JUnit 5 (Gradle 4.6+). - useJUnitPlatform() - // Always run tests, even when nothing changed. - dependsOn("cleanTest") - // Show test results. - testLogging.events("failed") - - // parallel tests. - systemProperty("junit.jupiter.execution.parallel.enabled", "true") - systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") - maxParallelForks = max(1, Runtime.getRuntime().availableProcessors() / 2) -} - -tasks.withType { - kotlinOptions.jvmTarget = "1.8" -} - -tasks.named("dokka") { - outputFormat = "html" - outputDirectory = "$buildDir/kdoc" - skipEmptyPackages = true + applicationDistribution.into("bin") { + from(c64emuScript, ehbasicScript) + fileMode = 493 + } }