-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.gradle
46 lines (38 loc) · 1.37 KB
/
build.gradle
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
import org.gradle.util.GradleVersion
import org.javamodularity.moduleplugin.tasks.ModularJavaExec
import org.javamodularity.moduleplugin.tasks.ModularCreateStartScripts
plugins {
id 'application'
}
dependencies {
implementation project(':greeter.api')
runtimeOnly project(':greeter.provider')
}
modularity {
patchModule('java.annotation', 'jsr250-api-1.0.jar')
patchModule('java.annotation', 'jsr305-3.0.2.jar')
}
application {
if(GradleVersion.current().compareTo(GradleVersion.version("6.4")) < 0) {
mainClassName = 'greeter.startscripts/startscripts.MainDemo'
} else {
mainClass = 'startscripts.MainDemo'
mainModule = 'greeter.startscripts'
}
applicationName = 'demo'
applicationDefaultJvmArgs = ['-Xmx128m']
}
new File("$projectDir/src/main/java/startscripts").eachFileMatch(~/Demo.*\.java/) { file ->
def demoClassName = file.name - '.java'
def runDemo = task("run$demoClassName", type: ModularJavaExec) {
group = 'Demo'
description = "Run the $demoClassName program"
main = "greeter.startscripts/startscripts.$demoClassName"
jvmArgs = ['-Xmx128m']
}
def createScripts = task("createStartScripts$demoClassName", type: ModularCreateStartScripts) {
runTask = runDemo
applicationName = demoClassName.uncapitalize()
}
installDist.finalizedBy createScripts
}