-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
107 lines (86 loc) · 3.08 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
107 lines (86 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import java.util.*
plugins {
kotlin("jvm") version "2.0.0"
application
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven {
url = uri("https://packages.atlassian.com/mvn/maven-atlassian-external/")
}
}
dependencies {
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.apache.commons:commons-math3:3.6.1")
implementation("com.fazecast:jSerialComm:[2.0.0,3.0.0)")
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.2")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2")
implementation("com.formdev:flatlaf:3.7.1")
implementation("com.formdev:flatlaf-extras:3.7.1")
implementation("com.fifesoft:rsyntaxtextarea:3.6.2")
// Needed for AssemblyScript source mapping:
//implementation("com.atlassian.sourcemap:sourcemap:2.0.0")
implementation("com.google.code.gson:gson:2.11.0")
// Logging
implementation("ch.qos.logback:logback-classic:1.5.32")
}
tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(21)
}
application {
mainClass.set("be.ugent.topl.mio.MainKt")
}
tasks.register<Jar>("fatJar") {
archiveFileName.set("mio.jar")
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes["Main-Class"] = "be.ugent.topl.mio.MainKt"
attributes["Implementation-Version"] = project.version
}
}
val wdcliPath = projectDir.absolutePath + "/WARDuino/build-emu/wdcli"
tasks.register<Exec>("cmakeWARDuino") {
val buildDir = File(File(wdcliPath).parent)
buildDir.mkdirs()
workingDir(buildDir)
commandLine("sh", "-c", "cmake .. -DBUILD_EMULATOR=ON")
}
tasks.register<Exec>("makeWARDuino") {
dependsOn("cmakeWARDuino")
val buildDir = File(File(wdcliPath).parent)
buildDir.mkdirs()
workingDir(buildDir)
commandLine("sh", "-c", "make")
}
fun setDefaultZephyrWasmBinary() {
val zephyrBuildDir = File(projectDir.absolutePath + "/WARDuino/platforms/Zephyr")
File(projectDir.absolutePath + "/examples/binary-counter/upload.wasm").copyTo(File(zephyrBuildDir.absolutePath + "/upload.wasm"), overwrite = true)
File(projectDir.absolutePath + "/examples/binary-counter/upload.wasm.map").copyTo(File(zephyrBuildDir.absolutePath + "/upload.wasm.map"), overwrite = true)
}
tasks.register("setup") {
dependsOn("fatJar")
dependsOn("makeWARDuino")
doLast {
setDefaultZephyrWasmBinary()
// Setup configuration file.
val file = File("${System.getenv("HOME")}/.mio/debugger.properties")
if (!file.exists()) {
file.parentFile.mkdirs()
println("Generating a default configuration file ${file.absolutePath}")
val properties = Properties()
properties.setProperty("wdcli", wdcliPath)
properties.store(file.writer(), null)
}
}
}