forked from Satergo/Satergo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
153 lines (132 loc) · 4.97 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
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
import com.satergo.build.SatergoBuildPlugin
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
apply plugin: SatergoBuildPlugin
java {
sourceCompatibility = JavaLanguageVersion.of(17)
}
group 'com.satergo'
version '0.0.2'
application {
mainClass = "com.satergo.Launcher"
applicationName = project.name
}
repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
content {
includeGroup 'com.github.ergoplatform'
}
}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
// for org.jetbrains.pty4j:purejavacomm:0.12.5, which is used by pty4j
maven {
url 'https://packages.jetbrains.team/maven/p/ij/intellij-dependencies'
content {
includeGroup 'org.jetbrains.pty4j'
}
}
}
String platform
if (project.hasProperty("platform") && project.findProperty("platform") != "auto") {
// for releasing
platform = project.findProperty("platform")
} else {
// for running
def currentOs = org.gradle.internal.os.OperatingSystem.current()
if (currentOs.isLinux()) platform = "linux"
else if (currentOs.isMacOsX()) platform = "mac"
else if (currentOs.isWindows()) platform = "win"
else throw new IllegalArgumentException("unknown operating system")
def arch = System.getProperty("os.arch")
if (arch != "amd64") platform += "-" + arch
if (currentOs.isLinux() && arch == "arm32") throw new IllegalArgumentException("linux arm32 is not supported")
}
def javaFxVersion = '17'
def javaFxModules = [ 'base', 'controls', 'fxml', 'swing', 'graphics' ]
dependencies {
implementation ('org.jfxtras:jmetro:11.6.15') {
exclude group: 'org.openjfx'
exclude group: 'org.controlsfx'
}
implementation 'com.github.ergoplatform:ergo-appkit:d07973367c'
implementation 'org.slf4j:slf4j-simple:1.7.33'
implementation 'com.grack:nanojson:1.7' // used for numerous HTTP APIs and ProgramData saving
implementation 'org.jetbrains.pty4j:pty4j:0.12.7' // for running node
implementation 'info.debatty:java-string-similarity:2.0.0' // used for mnemonic phrase words
implementation 'com.google.zxing:core:3.4.1' // used for qr codes
implementation 'net.java.dev.jna:jna:5.10.0' // used for running the registration of ergo uri with admin privileges on Windows
implementation 'net.java.dev.jna:jna-platform:5.10.0' // used for running the registration of ergo uri with admin privileges on Windows
javaFxModules.forEach({ md -> implementation "org.openjfx:javafx-$md:$javaFxVersion:$platform" })
}
satergoRuntime {
extraModules = ["jdk.crypto.ec", "java.naming"]
extraJlinkOptions = ["--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages"]
cleanupRuntimeContent = true
cacheRuntimes = true
runProguard = !project.hasProperty("dontshrink")
proguardConfig = "proguard.pro"
proguardOutputName = "Satergo-${project.version}-${platform}-shrunk.jar"
includeJarInRuntime = true
launcherScript {
type = platform == "win" ? "bat" : "sh"
name = "Satergo"
mainClass = application.mainClass.get()
defaultJvmOpts = ['-Dsatergo.launcher={APP_HOME}/bin/Satergo',
'-Dsatergo.platform=' + platform ]
}
switch (platform) {
case "linux": {
platformName = "linux-x64"
jdkRuntimeURI = URI.create("https://download.java.net/java/GA/jdk17.0.1/2a2082e5a09d4267845be086888add4f/12/GPL/openjdk-17.0.1_linux-x64_bin.tar.gz")
break
}
case "linux-aarch64": {
platformName = "linux-aarch64"
jdkRuntimeURI = URI.create("https://download.java.net/java/GA/jdk17.0.1/2a2082e5a09d4267845be086888add4f/12/GPL/openjdk-17.0.1_linux-aarch64_bin.tar.gz")
break
}
case "win": {
platformName = "windows-x64"
jdkRuntimeURI = URI.create("https://download.java.net/java/GA/jdk17.0.1/2a2082e5a09d4267845be086888add4f/12/GPL/openjdk-17.0.1_windows-x64_bin.zip")
break
}
case "mac": {
platformName = "mac-x64"
jdkRuntimeURI = URI.create("https://download.java.net/java/GA/jdk17.0.1/2a2082e5a09d4267845be086888add4f/12/GPL/openjdk-17.0.1_macos-x64_bin.tar.gz")
break
}
case "mac-aarch64": {
platformName = "mac-aarch64"
jdkRuntimeURI = URI.create("https://download.java.net/java/GA/jdk17.0.1/2a2082e5a09d4267845be086888add4f/12/GPL/openjdk-17.0.1_macos-aarch64_bin.tar.gz")
break
}
default: throw new IllegalArgumentException()
}
createArchive = true
archiveOutputPath = file("runtimes/${project.name}-v${project.version}-${platformName}.zip").toPath()
// Create a convenient run file in the top level
doBeforeArchival {
if (platform == "win") {
def runFile = file("${buildDir}/${runtimeDirectoryName}/run.bat")
runFile.write("@start %~dp0\\bin\\${project.name}.bat %*")
} else {
def runFile = file("${buildDir}/${runtimeDirectoryName}/run.${platform.startsWith("mac") ? "command" : "sh"}")
runFile.write('#!/bin/sh\n' +
'eval "\\"$(dirname $0)/bin/' + project.name + '\\" $*"')
runFile.setExecutable(true)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
// Make builds reproducible
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}