This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
120 lines (98 loc) · 3.23 KB
/
build.gradle.kts
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
108
109
110
111
112
113
114
115
116
117
118
119
120
@file:Suppress("UnusedImport", "SpellCheckingInspection")
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
java
application
kotlin("jvm") version "1.3.70"
id("org.beryx.jlink") version "2.17.0"
id("com.github.gmazzo.buildconfig") version "1.6.2"
}
repositories {
mavenCentral()
jcenter()
maven { setUrl("https://jitpack.io") }
maven { setUrl("https://frcmaven.wpi.edu/artifactory/release") }
}
group = "pathplotter"
version = "2020.3.1"
buildConfig {
packageName("ca.warp7.pathplotter")
buildConfigField("String", "kVersion", "\"${version}\"")
}
application {
mainClassName = "ca.warp7.pathplotter.Main"
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xno-call-assertions",
"-Xno-param-assertions"
)
kotlinOptions.jvmTarget = "11"
}
}
tasks.compileKotlin {
destinationDir = tasks.compileJava.get().destinationDir
}
tasks.withType<Test> {
useJUnitPlatform {
}
}
val wpilibVersion = "2020.3.2"
val jacksonVersion = "2.10.0"
fun desktopArch(): String {
val arch: String = System.getProperty("os.arch")
return if (arch == "amd64" || arch == "x86_64") "x86-64" else "x86"
}
fun desktopOS(): String {
return when {
OperatingSystem.current().isWindows -> "windows"
OperatingSystem.current().isMacOsX -> "osx"
else -> "linux"
}
}
fun javafxOS(): String {
return when {
OperatingSystem.current().isWindows -> "win"
OperatingSystem.current().isMacOsX -> "mac"
else -> "linux"
}
}
val wpilibPlatform = desktopOS() + desktopArch()
val javafxPlatform = javafxOS()
tasks.compileJava {
doFirst {
options.compilerArgs.addAll(listOf(
"--module-path", classpath.asPath,
"--add-modules", "pathplotter"
))
classpath = files()
}
}
tasks.jar {
this.duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
dependencies {
implementation(kotlin("stdlib"))
implementation("edu.wpi.first.wpilibj:wpilibj-java:$wpilibVersion")
implementation("edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion")
implementation("edu.wpi.first.ntcore:ntcore-java:$wpilibVersion")
implementation("edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:$wpilibPlatform")
implementation("org.openjfx:javafx-base:13:$javafxPlatform")
implementation("org.openjfx:javafx-graphics:13:$javafxPlatform")
implementation("org.openjfx:javafx-controls:13:$javafxPlatform")
implementation("org.kordamp.ikonli:ikonli-javafx:11.3.5")
implementation("org.kordamp.ikonli:ikonli-materialdesign-pack:11.3.5")
implementation("org.json:json:20190722")
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = "5.6.0")
testRuntimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = "5.6.0")
testRuntimeOnly(group = "org.junit.platform", name = "junit-platform-launcher", version = "1.6.0")
}
jlink {
this.launcher {
this.jvmArgs = listOf("--add-reads", "pathplotter.merged.module=pathplotter")
}
options.addAll("--strip-debug", "--no-header-files",
"--no-man-pages")
}