-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
176 lines (154 loc) · 5.15 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import java.nio.file.Files
import java.nio.file.Paths
import java.util.spi.ToolProvider
//import com.google.protobuf.gradle.*
import org.gradle.kotlin.dsl.provider.gradleKotlinDslOf
/*buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.openjfx:javafx-plugin:0.0.8'
}
}*/
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.18")
}
}
plugins {
id("java")
id("application")
id("com.palantir.graal") version "0.9.0"
id("org.openjfx.javafxplugin") version "0.0.13"
//id("com.github.johnrengelman.shadow") version "7.1.2"
}
/*protobuf {
protoc { artifact = "com.google.protobuf:protoc:3.21.1" }
plugins { grpc { artifact = "io.grpc:protoc-gen-grpc-java:1.46.0" } }
generateProtoTasks { ofSourceSet("main")*.plugins { grpc {} } }
}*/
/*ext {
javaMainClass = "org.simmi.distann.DistAnn"
}*/
application {
mainClass.set("org.simmi.distann.DistAnn")
//mainClassName = "org.simmi.distann.DistAnn"
}
/*tasks.register("fat_build") {
dependsOn.addAll(listOf("compileJava", "processResources")) // We need this for Gradle optimization to work
archiveClassifier.set("genset") // Naming the jar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { attributes(mapOf("Main-Class" to application.mainClass)) } // Provided we set it up in the application plugin configuration
val sourcesMain = sourceSets.main.get()
val contents = configurations.runtimeClasspath.get()
.map { if (it.isDirectory) it else zipTree(it) } +
sourcesMain.output
from(contents)
}*/
/*tasks {
val fatJar = register<Jar>("fatJar") {
dependsOn.addAll(listOf("compileJava", "processResources")) // We need this for Gradle optimization to work
archiveClassifier.set("genset") // Naming the jar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { attributes(mapOf("Main-Class" to application.mainClass)) } // Provided we set it up in the application plugin configuration
val sourcesMain = sourceSets.main.get()
val contents = configurations.runtimeClasspath.get()
.map { if (it.isDirectory) it else zipTree(it) } +
sourcesMain.output
from(contents)
}
build {
dependsOn(fatJar) // Trigger fat jar creation during build
}
}*/
/*allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'org.openjfx.javafxplugin'
ext.getProjectFullName = {
return 'distann' + project.path.replace(':', '-')
}
}*/
//mainClassName='org.simmi.distann.DistannFX'
/*tasks {
named<ShadowJar>("shadowJar") {
archiveBaseName.set("jarFileNmae")
}
}*/
/*tasks {
jar {
manifest {
attributes(mapOf(
"Main-Class" to "org.simmi.distann.DistannFX"
))
}
}
shadowJar {
manifest.inheritFrom(jar.get().manifest) //will make your shadowJar (produced by jar task) runnable
}
}*/
/*jar {
manifest {
attributes["Main-Class"] = "org.simmi.distann.DistannFX"
}
//exclude("META-INF/.RSA", "META-INF/.SF','META-INF/.DSA")
}*/
fun resolveJpackage(): ToolProvider {
return ToolProvider.findFirst("jpackage").orElseThrow {
val javaVersion = System.getProperty("java.version")
IllegalStateException("jpackage not found (expected JDK version: 14 or above, detected: $javaVersion)")
}
}
fun runJpackage(ENDING: String, VERSION: String): String {
println("Creating GeneSet package installer")
val jpackage = resolveJpackage()
val exitval: Int = jpackage.run(System.out, System.err, "--type", ENDING, "-i", "$rootDir/distann/build/install/distann", "-n", "genset", "--app-version", VERSION, "--dest", "$rootDir",
"--main-jar",
"lib/distann.jar",
"--main-class",
"org.simmi.distann.DistAnn",
"--java-options",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--java-options",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--verbose",
"--file-associations",
"file-association.txt",
"--file-associations",
"file-association2.txt")
//"--mac-package-name", "Genset",
System.err.println(exitval)
return ""
}
tasks.register("genset_build") {
val VERSION = Files.readString(Paths.get("$rootDir").resolve("VERSION")).trim()
val ENDING: String = project.findProperty("ENDING").toString() ?: "deb"
runJpackage(ENDING, VERSION)
}
subprojects {
repositories {
//jcenter()
mavenCentral()
gradlePluginPortal()
/*maven {
url("https://plugins.gradle.org/m2/")
}*/
}
/*task fatJar(type: Jar) {
baseName = getProjectFullName() + '-all'
destinationDir = file("${buildDir}/distributions")
manifest {
attributes 'Main-Class': 'org.simmi.distann.DistannFX'
}
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } } {
}
with jar
}*/
}