-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.gradle
132 lines (117 loc) · 5.19 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
plugins {
id 'application'
id 'checkstyle'
id 'idea'
id 'de.fuerstenau.buildconfig' version '1.1.8'
}
repositories {
mavenCentral()
maven { url = 'https://oss.sonatype.org/content/groups/public' }
}
sourceSets {
main {
java {
srcDirs = ['src']
exclude 'test'
}
resources {
srcDirs = ['resources']
}
}
}
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
dependencies {
compile group: 'net.sf.kxml', name: 'kxml2', version: '2.3.0'
compile (group: 'org.getodk', name: 'javarosa', version: '4.4.1')
compile group: 'org.slf4j', name: 'slf4j-nop', version: '1.7.25'
testCompile 'junit:junit:4.13.2'
testCompile 'org.hamcrest:hamcrest-all:1.3'
}
// 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 Validate'
version = getVersionName()
clsName = 'BuildConfig'
packageName = 'org.opendatakit.validate.buildconfig'
}
mainClassName = 'org.opendatakit.validate.FormValidator'
jar {
baseName = buildConfig.appName
version = buildConfig.version
archiveName = (baseName + ' ' + version + '.jar').replaceAll(" ","-")
from {
configurations.compile.collect {
if (it.isDirectory()) {
return it
} else {
if (it.path.contains("bouncycastle")) {
return zipTree(it).matching {
include '/**/*/ASN1Encodable.class', '/**/*/ASN1Object.class', '/**/*/X9ECParameters.class',
'/**/*/X9ObjectIdentifiers.class', '/**/*/CipherParameters.class', '/**/*/DefaultServiceProperties.class',
'/**/*/CryptoServiceProperties.class', '/**/*/CryptoServicePurpose.class', '/**/*/CryptoServicesConstraints.class',
'/**/*/CryptoServicesPermission.class', '/**/*/CryptoServicesRegistrar.class', '/**/*/CryptoServicesRegistrar$1.class',
'/**/*/CryptoServicesRegistrar$Property.class', '/**/*/CryptoServicesRegistrar$ThreadLocalSecureRandomProvider.class',
'/**/*/Digest.class', '/**/*/EncodableDigest.class', '/**/*/LongDigest.class', '/**/*/SHA512Digest.class',
'/**/*/Utils.class', '/**/*/Utils$DefaultPropertiesWithPRF.class', '/**/*/ExtendedDigest.class',
'/**/*/AsymmetricKeyParameter.class', '/**/*/DHParameters.class', '/**/*/DHValidationParameters.class',
'/**/*/DSAParameters.class', '/**/*/DSAValidationParameters.class', '/**/*/Ed25519PublicKeyParameters.class',
'/**/*/SecureRandomProvider.class', '/**/*/Signer.class', '/**/*/Ed25519Signer.class', '/**/*/Ed25519Signer$Buffer.class',
'/**/*/Utils.class', '/**/*/X25519Field.class', '/**/*/Codec.class', '/**/*/Ed25519.class', '/**/*/Ed25519$F.class',
'/**/*/Ed25519$PointAccum.class', '/**/*/Ed25519$PointAffine.class', '/**/*/Ed25519$PointExtended.class',
'/**/*/Ed25519$PointPrecomp.class', '/**/*/Ed25519$PointPrecompZ.class', '/**/*/Ed25519$PointTemp.class',
'/**/*/Ed25519$PublicPoint.class', '/**/*/Scalar25519.class', '/**/*/ScalarUtil.class', '/**/*/Wnaf.class',
'/**/*/Mod.class', '/**/*/Nat.class', '/**/*/Nat256.class', '/**/*/Arrays.class', '/**/*/Encodable.class',
'/**/*/DecoderException.class', '/**/*/Encoder.class', '/**/*/EncoderException.class',
'/**/*/Hex.class', '/**/*/HexEncoder.class', '/**/*/Integers.class',
'/**/*/Memoable.class', '/**/*/Pack.class'
}
} else {
return zipTree(it)
}
}
}
}
manifest {
attributes 'Main-Class': mainClassName
}
// Some of the dependencies are signed jars. When combined into a big jar, the corresponding signature files
// don't match with big jar, so the runtime refuses to run the jar. The fix is to exclude the signature files.
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
// Useful for testing
task explodedJar(type: Copy) {
into "$buildDir/libs/$jar.baseName $jar.version"
with jar
}