Skip to content

Migrate ant based serial library to Gradle #1103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion java/libraries/serial/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
ant.importBuild("build.xml")
plugins {
java
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

val coreJarPath = layout.projectDirectory.file("../../../core/library/core.jar")
val jsscJarPath = layout.projectDirectory.file("library/jssc.jar")
val binDir = layout.projectDirectory.dir("bin")
val serialJarOutputDir = layout.projectDirectory.dir("library")

dependencies {
implementation(files(coreJarPath))
implementation(files(jsscJarPath))
}

tasks.register("checkCore") {
doFirst {
if (!coreJarPath.asFile.exists()) {
throw GradleException("Missing core.jar at $coreJarPath. Please build the core module first.")
}
}
}

tasks.register<Jar>("buildSerial") {
dependsOn("checkCore")
archiveFileName.set("serial.jar")
destinationDirectory.set(file("library"))
from(sourceSets.main.get().output)
}

tasks.named<Delete>("clean") {
delete(binDir)
delete(serialJarOutputDir.file("serial.jar"))
}