-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
86 lines (65 loc) · 2.1 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
plugins {
id("java")
application
}
group = "dev.ultreon.pythonvm"
version = "1.0.0"
base {
archivesName.set("python-vm")
}
repositories {
mavenCentral()
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
useJUnitPlatform()
}
tasks.register<JavaExec>("compilePython") {
doFirst {
delete(file("build/libs/example-1.0.jar"))
delete(file("build/tmp/compilePython/"))
}
finalizedBy(":testing:compileJava")
classpath = project(":compiler").sourceSets["main"].runtimeClasspath
mainClass.set("dev.ultreon.pythonc.App")
args = listOf("-o", file("build/libs/example-1.0.jar").path, file("src/main/python").path, file("src/main/resources").path)
group = "python-vm"
inputs.files("src/main/python", "src/main/resources", "build.gradle.kts", "build/tmp/compilePython")
notCompatibleWithConfigurationCache("Dynamically compiles python")
outputs.file("build/libs/example-1.0.jar")
outputs.dir("build/tmp/compilePython")
}
tasks.register<Jar>("jarPython") {
dependsOn("compilePython")
finalizedBy(":testing:compileJava")
archiveClassifier.set("dist")
inputs.files(file("build/libs/example-1.0.jar"))
group = "python-vm"
from(zipTree("build/libs/example-1.0.jar"))
from(project(":pylib").sourceSets["main"].output)
}
tasks.jar {
dependsOn("compilePython")
finalizedBy(":testing:compileJava", "sourcesJar")
inputs.files(file("build/libs/example-1.0.jar"))
group = "python-vm"
from(zipTree("build/libs/example-1.0.jar"))
}
tasks.register<Jar>("sourcesJar") {
dependsOn("compilePython")
finalizedBy(":testing:compileJava")
inputs.files(file("testing/src/main/python"))
group = "python-vm"
from("src/main/python")
archiveClassifier.set("sources")
}
tasks.register<JavaExec>("runPython") {
dependsOn("compilePython")
classpath = project(":testing").sourceSets["main"].runtimeClasspath
mainClass.set("dev.ultreon.test.Main")
args = listOf("Hello World")
group = "python-vm"
}