forked from getodk/briefcase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·127 lines (110 loc) · 3.92 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
plugins {
id 'application'
id 'checkstyle'
id 'de.fuerstenau.buildconfig' version '1.1.8'
}
repositories {
mavenCentral()
maven { url = 'https://oss.sonatype.org/content/groups/public' }
}
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['res']
}
}
test {
java {
srcDirs = ['test']
}
}
}
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
configurations.all {
exclude group: 'commons-logging', module: 'commons-logging'
}
dependencies {
compile group: 'org.bouncycastle', name: 'bcprov-jdk16', version: '1.46'
compile group: 'commons-cli', name: 'commons-cli', version: '1.3.1'
compile group: 'commons-io', name:'commons-io', version: '2.5'
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
compile group: 'org.bushe', name: 'eventbus', version: '1.4'
compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.2'
compile group: 'net.sf.kxml', name: 'kxml2', version: '2.3.0'
compile group: 'org.opendatakit', name: 'opendatakit-javarosa', version: '2.5.1'
compile group: 'org.hsqldb', name: 'hsqldb', version: '2.4.0'
compile group: 'com.brsanthu', name: 'google-analytics-java', version: '1.1.2'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.10.0'
compile files('lib/smallsql-0.21.jar')
compile files('lib/threetenbp-1.3.1.jar')
compile files('lib/LGoodDatePicker-10.3.1-backport.jar')
runtime group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.5'
runtime group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.5'
}
// Required to use fileExtensions property in checkstyle file
checkstyle {
toolVersion = '7.6.1'
}
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;
}
}
buildConfig {
appName = 'ODK Briefcase'
version = getVersionName()
clsName = 'BuildConfig'
packageName = 'org.opendatakit.briefcase.buildconfig'
buildConfigField 'String', 'GOOGLE_TRACKING_ID', "UA-91951913-3"
}
mainClassName = 'org.opendatakit.briefcase.ui.MainBriefcaseWindow'
jar {
baseName = buildConfig.appName
version = buildConfig.version
archiveName = baseName + ' ' + 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
}