forked from Bram-Hub/LEGUP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
174 lines (149 loc) · 5.61 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
plugins {
id 'java'
id 'edu.sc.seis.launch4j' version '2.5.3'
id 'kr.motd.sphinx' version '2.10.0'
id 'com.diffplug.spotless' version '6.25.0'
}
version '6.0.0'
apply plugin: 'java'
apply plugin: 'application'
spotless {
enforceCheck false
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Use the default importOrder configuration
importOrder()
// Cleanthat will refactor your code, but it may break your style: apply it before your formatter
cleanthat()
googleJavaFormat('1.19.2').aosp()
formatAnnotations()
}
}
apply plugin: 'checkstyle'
application {
mainClass.set('edu.rpi.legup.Legup')
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
dependencies {
implementation 'org.jetbrains:annotations:20.1.0'
implementation 'org.jetbrains:annotations:20.1.0'
implementation 'com.formdev:flatlaf:3.+'
implementation 'com.google.firebase:firebase-admin:6.3.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.1'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
// implementation 'com.google.code.gson:gson:2.8.2'
// implementation 'commons-cli:commons-cli:1.4'
// implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.logging.log4j:log4j-api:2.17.2'
implementation 'org.apache.logging.log4j:log4j-core:2.17.2'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation 'junit:junit:4.+'
}
task customFatJar(type: Jar) {
manifest {
attributes('Implementation-Title': 'Legup',
'Implementation-Version': archiveVersion,
'Main-Class': 'edu.rpi.legup.Legup',
'SplashScreen-Image': 'edu/rpi/legup/images/Legup/LegupSplash.png')
}
archiveFileName = 'Legup.jar'
archiveBaseName = 'Legup.jar'
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.compileClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes('Implementation-Title': 'Legup',
'Implementation-Version': archiveVersion,
'Main-Class': 'edu.rpi.legup.Legup',
'SplashScreen-Image': 'edu/rpi/legup/images/Legup/LegupSplash.png')
}
archiveFileName = 'Legup.jar'
}
/*
* CREATES NATIVE WINDOWS EXECUTABLE
* Launches launch4j to create an executable (.exe) file wrapping the jar
* THIS IS NOT THE INSTALLER
* Add "icon = 'path/to/icon.ico'" to set an icon for the executable
*/
createExe() {
mainClassName = 'edu.rpi.legup.Legup'
outputDir = '../native/windows'
outfile = 'bin/Legup.exe'
bundledJrePath = 'jre'
bundledJre64Bit = true
jdkPreference = 'preferJre'
jreMinVersion = '21'
jreRuntimeBits = '64/32'
}
/*
* CREATES NATIVE WINDOWS INSTALLER -- ONLY RUNS ON WINDOWS
* Runs the shipped version of Inno Setup (6.2) to compile the installer
* Modify the setup settings in native/windows/legup_inno_setup.iss
*
* Modifications are likely required to run the setup script on your computer:
* Edit the "CHANGE ME" line in native/windows/legup_inno_setup.iss to reflect
* the path to the Java installation you want to ship inside the executable.
*/
task buildNativeWindows(type: Exec, dependsOn: 'createExe') {
jar
createExe
workingDir = "${buildDir}/../native/windows"
commandLine 'cmd', '/c', 'make_windows_installer.bat'
}
repositories {
mavenCentral()
}
tasks.register("jpackage") {
group("jpackage")
doLast {
var operatingSystem = System.getProperty("os.name").toLowerCase()
if (operatingSystem.contains("windows")) {
exec {
commandLine 'cmd', '/c', 'jpackage', '--input', 'build/libs', '--main-jar', 'Legup.jar', '--win-dir-chooser', '--win-shortcut-prompt', '--win-shortcut', '--dest', 'build/installer', '-n', "LEGUP", '--app-version', "${project.version}", '--icon', "src/main/resources/edu/rpi/legup/images/Legup/logo.ico"
}
} else if (operatingSystem.contains("linux")) {
exec {
commandLine 'sh', '-c', "jpackage --input build/libs --main-jar Legup.jar --dest build/installer -n LEGUP --icon src/main/resources/edu/rpi/legup/images/Legup/logo.ico --app-version ${project.version}"
}
} else if (operatingSystem.contains("mac")) {
exec {
commandLine 'bash', '-c', "jpackage --input build/libs --main-jar Legup.jar --dest build/installer -n \"LEGUP\" --icon src/main/resources/edu/rpi/legup/images/Legup/logo.ico --app-version ${project.version}"
}
} else {
println("JPackage task is not set up for " + System.getProperty("os.name"))
}
}
}
tasks.register('copyInstaller', Sync) {
group("jpackage")
from ("build/installer/")
into("installer")
rename("LEGUP-${project.version}", "LEGUP-installer-${project.version}")
}
copyInstaller.dependsOn(jpackage)