ksim65/build.gradle.kts

114 lines
3.2 KiB
Plaintext
Raw Permalink Normal View History

2019-09-11 00:17:59 +00:00
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2019-09-27 20:38:36 +00:00
import java.util.*
2019-09-14 16:58:45 +00:00
import kotlin.math.max
2019-09-11 00:17:59 +00:00
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
2023-08-30 11:59:16 +00:00
kotlin("jvm") version "1.9.10"
2019-09-26 20:00:40 +00:00
`maven-publish`
application
2021-07-06 21:37:19 +00:00
java
2019-09-11 00:17:59 +00:00
}
2021-07-06 21:37:19 +00:00
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
allprojects {
val versionProps = Properties().also {
it.load(File("$projectDir/src/main/resources/version.properties").inputStream())
}
version = versionProps["version"] as String
group = "net.razorvine"
2023-05-26 18:14:55 +00:00
// base.archivesBaseName = "ksim65"
repositories {
// You can declare any Maven/Ivy/file repository here.
mavenLocal()
2021-07-06 21:37:19 +00:00
mavenCentral()
maven("https://jitpack.io")
}
2019-09-11 00:17:59 +00:00
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
2022-08-13 19:24:12 +00:00
implementation("org.jetbrains.kotlin:kotlin-reflect")
2019-09-11 00:17:59 +00:00
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit5 integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
2023-08-15 11:23:19 +00:00
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
subprojects.forEach {
2021-07-06 21:37:19 +00:00
implementation(it)
}
2019-09-11 00:17:59 +00:00
}
2019-09-26 20:00:40 +00:00
tasks {
named<Test>("test") {
useJUnitPlatform()
dependsOn("cleanTest")
testLogging.events("failed")
// parallel tests.
systemProperty("junit.jupiter.execution.parallel.enabled", "true")
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
2019-10-12 14:59:58 +00:00
maxParallelForks = max(1, Runtime.getRuntime().availableProcessors()/2)
2019-09-26 20:00:40 +00:00
}
2019-09-26 20:00:40 +00:00
withType<KotlinCompile> {
2020-12-19 13:58:48 +00:00
kotlinOptions.jvmTarget = "11"
2019-09-26 20:00:40 +00:00
}
2019-09-11 00:17:59 +00:00
}
2019-09-26 20:00:40 +00:00
val c64emuScript by tasks.registering(CreateStartScripts::class) {
2023-10-30 19:24:14 +00:00
outputDir = project.layout.buildDirectory.dir("bin").get().asFile
2019-09-26 20:00:40 +00:00
applicationName = "c64emu"
2021-07-06 21:37:19 +00:00
mainClass.set("razorvine.c64emu.C64MainKt")
2019-10-12 14:59:58 +00:00
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
2019-09-11 00:17:59 +00:00
}
2019-09-26 20:00:40 +00:00
val ehbasicScript by tasks.registering(CreateStartScripts::class) {
2023-10-30 19:24:14 +00:00
outputDir = project.layout.buildDirectory.dir("bin").get().asFile
2019-09-26 20:00:40 +00:00
applicationName = "ehbasic"
2021-07-06 21:37:19 +00:00
mainClass.set("razorvine.examplemachines.EhBasicMainKt")
2019-10-12 14:59:58 +00:00
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
2019-09-26 20:00:40 +00:00
}
application {
applicationName = "ksim65vm"
2021-07-06 21:37:19 +00:00
mainClass.set("razorvine.examplemachines.MachineMainKt")
2019-09-26 20:00:40 +00:00
applicationDistribution.into("bin") {
from(c64emuScript, ehbasicScript)
fileMode = 493
}
2019-09-11 00:17:59 +00:00
}
val sourcesJar by tasks.registering(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
publishing {
repositories {
mavenLocal()
}
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
}
}
}