forked from getodk/briefcase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·163 lines (144 loc) · 4.89 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
plugins {
id 'application'
id 'checkstyle'
id 'de.fuerstenau.buildconfig' version '1.1.8'
id 'idea'
id 'jacoco'
}
repositories {
mavenCentral()
maven { url = 'https://oss.sonatype.org/content/groups/public' }
}
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['res']
}
}
test {
java {
srcDirs = ['test/java']
}
resources {
srcDirs = ['test/resources']
}
}
}
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
dependencies {
compile group: 'org.bouncycastle', name: 'bcprov-jdk16', version: '1.46'
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'org.bushe', name: 'eventbus', version: '1.4'
compile(group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.5') {
exclude group: 'commons-logging'
}
compile group: 'net.sf.kxml', name: 'kxml2', version: '2.3.0'
compile(group: 'org.opendatakit', name: 'opendatakit-javarosa', version: '2.15.1') {
exclude group: 'org.slf4j'
}
compile group: 'org.hsqldb', name: 'hsqldb', version: '2.4.0'
compile(group: 'com.brsanthu', name: 'google-analytics-java', version: '2.0.0') {
exclude group: 'org.slf4j'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile group: 'com.github.lgooddatepicker', name: 'LGoodDatePicker', version: '10.3.1'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.5'
compile group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.5'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile('junit:junit:4.12') {
exclude group: 'org.hamcrest'
}
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'com.github.npathai:hamcrest-optional:2.0.0'
testCompile 'org.assertj:assertj-swing-junit:3.8.0' // Required for Swing tests
testCompile "com.github.dreamhead:moco-core:0.12.0"
compile files('lib/smallsql-0.21.jar')
runtime group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile('io.sentry:sentry-logback:1.6.8') {
exclude group: 'org.slf4j'
exclude group: 'ch.qos.logback'
}
compile 'de.grundid.opendatalab:geojson-jackson:1.8'
}
jacocoTestReport {
reports {
xml.enabled = true
}
}
// Required to use fileExtensions property in checkstyle file
checkstyle {
toolVersion = '8.22'
}
ant.condition(property: 'os', value: 'windows') {
os(family: 'windows')
}
ant.condition(property: 'os', value: 'unix') {
os(family: 'unix')
}
// Use the result of git describe --tags --dirty as the version name
// From http://stackoverflow.com/questions/17097263#24121734
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
switch (ant.properties.os) {
case 'windows':
commandLine 'cmd', '/c', 'git', 'describe', '--tags', '--dirty', '--always'
break
case 'unix':
commandLine 'git', 'describe', '--tags', '--dirty', '--always'
break
}
standardOutput = stdout
}
return stdout.toString().trim()
}
catch (ignored) {
return null
}
}
String getValue(String key, String defaultValue) {
if (this.hasProperty(key))
return this.getProperty(key)
else
return defaultValue
}
buildConfig {
appName = 'ODK Briefcase'
version = getVersionName()
clsName = 'BuildConfig'
packageName = 'org.opendatakit.briefcase.buildconfig'
buildConfigField 'String', 'GOOGLE_TRACKING_ID', getValue("googleAnalytics.trackingId", "UA-91951913-3")
buildConfigField 'Boolean', 'SENTRY_ENABLED', getValue("sentry.enabled", "false")
buildConfigField 'String', 'SENTRY_DSN', getValue("sentry.dsn", "https://b6f023a5f17e44d9a46447f8827e2a41:1b1f33d68b1b4404b85cd627563d37f9@sentry.io/287258")
}
mainClassName = 'org.opendatakit.briefcase.Launcher'
jar {
archiveBaseName.set buildConfig.appName
version = buildConfig.version
archiveFileName.set "ODK-Briefcase-${version}.jar"
from configurations.runtime.collect { it }
// A single-click Java app requires a flat jar or class loader.
// Fat/Flat/uber/shadow jars won't work because BouncyCastle is signed.
// Eclipse's Jar-in-Jar loader is the most maintained.
// https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/plain/org.eclipse.jdt.ui/jar-in-jar-loader.zip
from zipTree('lib/jar-in-jar-loader.zip')
manifest {
attributes 'Main-Class': 'org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader'
attributes 'Rsrc-Main-Class': mainClassName
attributes 'Class-Path': '.'
attributes 'Rsrc-Class-Path': './ ' + (configurations.runtime.collect { it.getName() }).join(' ')
}
}
// Useful for testing
task explodedJar(type: Copy) {
into '$buildDir/libs/$jar.baseName $jar.version'
with jar
}