-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.gradle
109 lines (77 loc) · 2.48 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
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
ant.importBuild 'buildSrc/src/main/resources/codesign.xml'
def String getSystemProperty(String propertyName, String defaultValue)
{
return System.properties.getProperty(propertyName, defaultValue)
}
def String getAnanasEnv() {
return getSystemProperty('ANANAS_ENV', 'development')
}
def getPackrPlatform() {
switch(project.platform) {
case 'linux':
return 'linux64'
case 'mac':
return 'mac'
case 'win':
return 'windows64'
default:
return 'linux64'
}
}
if (!project.hasProperty('platform')) {
project.ext.platform = ''
}
if (!project.hasProperty('JDK_HOME')) {
project.ext.JDK_HOME = ''
}
task printVersion {
doLast {
println "Version: $project.version; Runner name: $project.runnerJarName"
}
}
task copyRunner(type: Copy) {
dependsOn ":runner:shadowJar"
from file("runner/build/libs/${project.runnerJarName}.jar")
into file("ui/resource")
}
task packRunner(type: Exec) {
dependsOn ":ui:cleanRunnerBinary"
dependsOn ":runner:clean"
dependsOn ":runner:shadowJar"
println "Packing settings: JDK_HOME=[${project.JDK_HOME}] for platform [${project.platform}]"
println "Jar: ${project.runnerJarName}"
workingDir "."
commandLine "java", "-jar", "buildSrc/src/main/resources/packr.jar",
"--platform", "${getPackrPlatform()}",
"--jdk", "$project.JDK_HOME",
"--executable", "ananas",
"--classpath", "runner/build/libs/${project.runnerJarName}.jar",
// "--removelibs", "runner/build/libs/${project.runnerJarName}.jar",
// "--minimizejre", "soft",
"--mainclass", "org.ananas.runner.api.Main",
"--vmargs", "Xmx4G",
"--bundle", "com.ananas.desktop",
"--output", "ui/resources/runner"
}
task pack(type: Exec) {
dependsOn ':ui:build'
dependsOn packRunner
inputs.property 'NODE_ENV', getAnanasEnv()
println "Binary version: ${project.version}"
println "Environment: ${getAnanasEnv()}"
workingDir "./ui"
environment "NODE_ENV", "${getAnanasEnv()}"
// environment "CSC_IDENTITY_AUTO_DISCOVERY", "${System.properties.getProperty('CODE_SIGN', 'false')}"
commandLine "./node_modules/.bin/electron-builder", "--${project.platform}"
}
task packMac(type: Exec) {
dependsOn ':ui:build'
// don't depend on packRunner task
inputs.property 'NODE_ENV', getAnanasEnv()
println "Binary version: ${project.version}"
println "Environment: ${getAnanasEnv()}"
workingDir "./ui"
environment "NODE_ENV", "${getAnanasEnv()}"
environment "CSC_IDENTITY_AUTO_DISCOVERY", "false"
commandLine "./node_modules/.bin/electron-builder", "--mac"
}