forked from RPTools/TokenTool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
203 lines (171 loc) · 6.33 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.1/userguide/tutorial_java_projects.html
*/
import org.gradle.plugins.ide.eclipse.model.AccessRule
buildscript {
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.7.0"
}
repositories {
jcenter()
mavenCentral()
}
}
// Apply the java plugin to add support for Java
apply plugin: 'base'
apply plugin: 'application'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'com.diffplug.gradle.spotless'
// Definitions
defaultTasks 'clean', 'build'
sourceCompatibility = 1.8
targetCompatibility = 1.8
// Don't fail build if tests fail until tests are cleaned up
test.ignoreFailures = true
// Used by gradle assemble & run tasks
mainClassName = 'net.rptools.tokentool.client.TokenTool'
// Current Build version
version = '2.0'
// Custom properties
ext {
vendor = "RPTools" // Change to RPTools or "" for official builds
preloaderClassName = 'net.rptools.tokentool.client.SplashScreenLoader'
msiVersion = '2.0.0'
}
// Default parameters for gradle run command
run {
args = [ '-v='+version, '-vendor='+vendor ]
applicationDefaultJvmArgs = [ "-Djavafx.preloader=" + preloaderClassName, "-Dsentry.environment=Development" ]
if(System.getProperty("exec.args") != null) {
args System.getProperty("exec.args").split()
}
}
spotless {
java {
licenseHeaderFile 'spotless.license.java'
eclipse().configFile('build-resources/eclipse.prefs.formatter.xml')
removeUnusedImports()
}
format 'misc', {
target '**/*.gradle', '**/.gitignore'
// spotless has built-in rules for most basic formatting tasks
trimTrailingWhitespace()
// or spaces. Takes an integer argument if you don't like 4
indentWithTabs()
}
}
// Set eclipse natures, access rules, and other settings
// https://docs.gradle.org/current/dsl/org.gradle.plugins.ide.eclipse.model.EclipseProject.html
eclipse {
project {
natures 'org.eclipse.buildship.core.gradleprojectnature'
buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
}
classpath {
file {
withXml {
def node = it.asNode()
node.appendNode('classpathentry', [kind: 'con', path: 'org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER'])
}
whenMerged {
def jre = entries.find { it.path.contains 'org.eclipse.jdt.launching.JRE_CONTAINER' }
jre.accessRules.add(new AccessRule('0', 'javafx/**'))
}
}
}
}
// In this section you declare where to find the dependencies of your project
repositories {
jcenter()
mavenCentral()
maven { url = 'http://maptool.craigs-stuff.net/repo/' }
maven { url = 'http://www.nerps.net/repo/' }
mavenLocal()
}
// In this section you declare the dependencies for your production and test code
dependencies {
// For Sentry bug reporting
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.8.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.8.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.8.2' // Bridges v1 to v2 for other code in other libs
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
compile group: 'io.sentry', name: 'sentry', version: '1.6.1'
compile group: 'io.sentry', name: 'sentry-log4j2', version: '1.6.1'
// Image processing lib
compile group: 'com.twelvemonkeys.imageio', name: 'imageio-core', version: '3.3.2' // https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-core
compile group: 'com.twelvemonkeys.imageio', name: 'imageio-psd', version: '3.3.2' // https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-psd
// Other public libs
compile group: 'commons-io', name: 'commons-io', version: '2.6' // https://mvnrepository.com/artifact/commons-io/commons-io
compile group: 'commons-cli', name: 'commons-cli', version: '1.4' // https://mvnrepository.com/artifact/commons-cli/commons-cli
compile group: 'org.reflections', name: 'reflections', version: '0.9.10' // https://mvnrepository.com/artifact/commons-cli/commons-cli
}
task uberJar(type: Jar) {
group = 'distribution'
description = 'Create uber jar for native installers'
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': version,
'Implementation-Vendor': vendor,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Source-Compatibility': project.sourceCompatibility,
'Target-Compatibility': project.targetCompatibility,
'Main-Class': project.mainClassName,
'JavaFX-Preloader-Class' : preloaderClassName
}
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
task copyLicense(type: Copy) {
from('license')
into('build/libs/')
include('*')
}
task deploy(dependsOn: [uberJar, copyLicense]) {
group = 'distribution'
description = 'Create native installers'
tasks.findByName('copyLicense').mustRunAfter 'uberJar'
doLast {
// Using the -deploy Command with Bundler Arguments
// javapackager -deploy -native exe -BsystemWide=true -BjvmOptions=-Xmx128m -BjvmOptions=-Xms128m -outdir packages -outfile BrickBreaker -srcdir dist
// -srcfiles BrickBreaker.jar -appclass brickbreaker.Main -name BrickBreaker -title "BrickBreaker demo"
// *Note: You can specify a JRE using "-Bruntime=../../../deploy-ready-jre"
// It will bundle system/workspace JDK by default
def javapackager_deploy = exec {
workingDir "${project.projectDir.absolutePath}"
commandLine "javapackager",
"-deploy", "-v",
"-native", "installer",
"-appclass", mainClassName,
"-preloader", preloaderClassName,
"-srcdir", "build/libs",
"-srcfiles", jar.archiveName,
"-srcfiles", "COPYING.AFFERO",
"-outdir", "releases/release-"+version,
"-outfile", project.name,
"-name", project.name,
"-title", project.name,
"-vendor", vendor,
"-BinstalldirChooser=true",
"-BsystemWide=false",
"-BmenuHint=true",
"-Bwin.menuGroup=" + vendor,
"-BshortcutHint=true",
"-BappVersion=" + version,
"-Bwin.msi.productVersion=" + msiVersion,
"-BlicenseFile=COPYING.AFFERO",
"-BlicenseType=GNU AFFERO GENERAL PUBLIC LICENSE",
"-Bcategory=Graphics",
"-Bemail=tokentool@" + vendor + ".net"
}
}
}