-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
90 lines (76 loc) · 2.8 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
plugins {
java
id("org.jetbrains.kotlin.jvm") version "1.8.10"
application
}
repositories {
mavenCentral()
}
var currentOS = org.gradle.internal.os.OperatingSystem.current()
var platform = "win"
var javafxVersion = "20"
if (currentOS.isWindows()) {
platform = "win"
} else if (currentOS.isLinux()) {
platform = "linux"
} else if (currentOS.isMacOsX()) {
platform = "mac"
}
val avatarJs by configurations.creating
val openjfx by configurations.creating
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.google.guava:guava:31.1-jre")
implementation("org.openjfx:javafx-base:${javafxVersion}:${platform}")
implementation("org.openjfx:javafx-graphics:${javafxVersion}:${platform}")
implementation("org.openjfx:javafx-controls:${javafxVersion}:${platform}")
implementation("org.openjfx:javafx-fxml:${javafxVersion}:${platform}")
implementation("org.openjfx:javafx-media:${javafxVersion}:${platform}")
implementation("org.openjfx:javafx-web:${javafxVersion}:${platform}")
openjfx("org.openjfx:javafx-base:${javafxVersion}:${platform}")
openjfx("org.openjfx:javafx-graphics:${javafxVersion}:${platform}")
openjfx("org.openjfx:javafx-controls:${javafxVersion}:${platform}")
openjfx("org.openjfx:javafx-fxml:${javafxVersion}:${platform}")
openjfx("org.openjfx:javafx-media:${javafxVersion}:${platform}")
openjfx("org.openjfx:javafx-web:${javafxVersion}:${platform}")
avatarJs("com.oracle:avatar-js:0.10.25-SNAPSHOT")
avatarJs("com.oracle:libavatar-js-${platform}-x64:0.10.25-SNAPSHOT")
}
application {
mainClassName = "com.zigma.App"
applicationDefaultJvmArgs = listOf(
"--module-path=fxlib",
"--add-modules=javafx.controls,javafx.fxml,javafx.web"
)
}
tasks.withType<JavaExec> {
main = "com.zigma.App"
dependsOn("copyFXLibs")
}
tasks {
register("runJs", Exec::class){
dependsOn("copyLibs")
println("runHelloWorld1")
workingDir = projectDir
// java -Djava.library.path=lib -jar lib/avatar-js.jar hello-world-server.js
commandLine(
"java",
"-Djava.library.path=lib",
"-jar", "lib\\avatar-js-0.10.25-SNAPSHOT.jar",
"smartlexer.js",
"source.sql",
"EmitListener.js"
)
println("runHelloWorld1 finished")
}
register("copyLibs", Copy::class) {
from(avatarJs)
into("lib")
rename("libavatar-js-win-x64-0.10.25-SNAPSHOT.dll", "avatar-js.dll")
}
register("copyFXLibs", Copy::class) {
from(openjfx)
into("fxlib")
}
}