forked from Bram-Hub/LEGUP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
151 lines (128 loc) · 5 KB
/
build.gradle
File metadata and controls
151 lines (128 loc) · 5 KB
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
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'
}
def versionFile = file('legup-update/src/main/resources/edu.rpi.legupupdate/VERSION')
def appVersion = versionFile.exists() ? versionFile.text.trim() : 'VERSION_NOT_FOUND'
version = appVersion
processResources {
// Tell Gradle which files to process
inputs.property("version", project.version)
filesMatching(['version.properties', 'config.xml']) {
// Enable property expansion, using the 'version' property from the build script
expand(version: project.version)
}
}
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'
}
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/LegupSplash.png --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/LegupSplash.icns --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)