-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
216 lines (175 loc) · 6.17 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
204
205
206
207
208
209
210
211
212
213
214
215
216
import org.apache.tools.ant.filters.ReplaceTokens
project.ext.schemaTargetDir = new File("$buildDir/generated-sources")
configurations {
xjc
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'build/generated-sources']
}
}
dependencies {
compile 'org.apache.james:apache-mime4j-core:0.8.3'
compile 'org.apache.commons:commons-lang3:3.9'
compile 'org.apache.santuario:xmlsec:2.1.4'
compile 'org.bouncycastle:bcpkix-jdk15on:1.64'
compile 'commons-configuration:commons-configuration:1.10'
compile 'commons-io:commons-io:2.6'
compile 'commons-jxpath:commons-jxpath:1.3'
compile 'org.slf4j:jcl-over-slf4j:1.7.26'
compile "org.glassfish.jaxb:jaxb-runtime:$jaxbVersion"
compile 'xerces:xercesImpl:2.12.0'
compile "org.eclipse.jetty:jetty-server:$jettyVersion"
compile 'ch.qos.logback:logback-classic:1.2.3'
compile ('org.quartz-scheduler:quartz:2.3.2') {
exclude module: 'c3p0'
}
compile 'joda-time:joda-time:2.10.3'
compile 'xalan:serializer:2.7.2'
compile 'org.apache.httpcomponents:httpclient:4.5.6'
compile 'org.apache.httpcomponents:httpasyncclient:4.1.4'
compile "com.typesafe.akka:akka-actor_$akkaVersion"
compile "com.typesafe.akka:akka-remote_$akkaVersion"
compile "com.typesafe.akka:akka-slf4j_$akkaVersion"
compile "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}"
compile 'com.google.code.gson:gson:2.8.5'
compile 'com.google.guava:guava:28.0-jre'
testCompile 'org.powermock:powermock-module-junit4:1.6.6'
testCompile 'org.powermock:powermock-api-mockito:1.6.6'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile project(':common-test').sourceSets.main.output
xjc "org.glassfish.jaxb:jaxb-xjc:$jaxbVersion"
xjc "org.glassfish.jaxb:jaxb-runtime:$jaxbVersion"
}
test {
jvmArgs '-Djava.library.path=../lib'
}
task createDirs() {
doLast {
project.ext.schemaTargetDir.mkdirs()
}
}
task xjc() {
inputs.files fileTree(dir: 'src/main/resources', include: '*.xsd')
outputs.dir schemaTargetDir
doLast {
ant.taskdef(name: 'xjc',
classname: 'com.sun.tools.xjc.XJCTask',
classpath: configurations.xjc.asPath)
// Generate classes for identifiers
ant.xjc(
destdir: project.ext.schemaTargetDir,
package: 'ee.ria.xroad.common.identifier',
schema: 'src/main/resources/identifiers.xsd'
)
// Generate classes for message, using identifier classes
ant.xjc(
destdir: project.ext.schemaTargetDir,
package: 'ee.ria.xroad.common.message',
schema: 'src/main/resources/message.xsd',
binding: 'src/main/resources/identifiers-bindings.xml'
)
// Generate classes for federateable global external conf
ant.xjc(
destdir: project.ext.schemaTargetDir,
package: 'ee.ria.xroad.common.conf.globalconf.sharedparameters.v2',
schema: 'src/main/resources/globalconf/shared-parameters.xsd',
binding: 'src/main/resources/identifiers-bindings.xml'
)
// Generate classes for federateable global internal conf
ant.xjc(
destdir: project.ext.schemaTargetDir,
package: 'ee.ria.xroad.common.conf.globalconf.privateparameters.v2',
schema: 'src/main/resources/globalconf/private-parameters.xsd',
binding: 'src/main/resources/identifiers-bindings.xml'
)
// Generate classes for request, using identifier classes
ant.xjc(
destdir: project.ext.schemaTargetDir,
package: 'ee.ria.xroad.common.request',
schema: 'src/main/resources/request.xsd',
binding: 'src/main/resources/identifiers-bindings.xml'
)
// Generate classes for hash chains
ant.xjc(
destdir: project.ext.schemaTargetDir,
package: 'ee.ria.xroad.common.hashchain',
schema: 'src/main/resources/hashchain.xsd',
)
// Generate classes for service metainfo
ant.xjc(
destdir: project.ext.schemaTargetDir,
package: 'ee.ria.xroad.common.metadata',
schema: 'src/main/resources/service-metainfo.xsd',
binding: 'src/main/resources/identifiers-bindings.xml'
)
}
}
task make(type: Exec) {
inputs.dir fileTree(dir: '../passwordstore', includes: ['*.c','*.h','Makefile'])
outputs.dir file('../lib')
workingDir '../'
commandLine 'make'
}
task makeClean(type: Exec) {
workingDir '../'
commandLine 'make', 'clean'
}
licenseFormatTest {
outputs.upToDateWhen { false }
}
classes.dependsOn make
clean.dependsOn makeClean
xjc.dependsOn createDirs
compileJava.dependsOn xjc
idea.module {
excludeDirs -= file(buildDir)
buildDir.listFiles({ d, f -> f != 'generated-sources' } as FilenameFilter).each { excludeDirs += it }
}
task licenseFormatJava(type:nl.javadude.gradle.plugins.license.License) {
source = fileTree('src/main/java')
}
task licenseTestJava(type:nl.javadude.gradle.plugins.license.License) {
source = fileTree('src/main/java')
check = true
}
licenseFormatMain.enabled = false
licenseMain.enabled = false
licenseFormat.dependsOn licenseFormatJava
licenseTest.dependsOn licenseTestJava
idea.module {
excludeDirs -= file(buildDir)
buildDir.listFiles({ d, f -> f != 'generated-sources' } as FilenameFilter).each { excludeDirs += it }
}
def gitCommitHash() {
def env = System.getenv()
def hash = env['GIT_COMMIT']
def cmd = "git rev-parse --short HEAD"
if (hash == null) {
try {
def proc = cmd.execute()
hash = "git" + proc.text.trim()
} catch (Exception e) {
println("Could not execute git command: " + e.message)
hash = null
}
} else {
hash = hash[0..6]
}
return hash
}
def gitCommitDate() {
def cmd = "git log -1 --date=short --pretty=format:%cd"
def date = null
try {
def proc = cmd.execute()
date = proc.text.trim().replaceAll(/-/, '')
} catch (Exception e) {
println("Could not execute git command: " + e.message)
date = null
}
return date
}
processResources {
filter(ReplaceTokens, tokens: [version: xroadVersion, buildType: xroadBuildType, gitCommitDate: gitCommitDate(), gitCommitHash: gitCommitHash()])
}