-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
158 lines (128 loc) · 4.2 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
apply plugin: 'java-library'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
compileJava.options.encoding = "UTF-8"
apply from: '../opensha/build-git.gradle'
dependencies {
/* no remote repo */
implementation files('python/share/py4j/py4j0.10.9.1.jar', //Py4j jar installed locally via `pip install py4j`
'lib/openmap.jar')
implementation project(path: ':opensha')
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.5.13'
}
repositories {
mavenCentral()
maven {
url "https://code.usgs.gov/api/v4/groups/1352/-/packages/maven"
name "NSHMP GitLab Group"
}
}
configurations {
apiResolvable {
description 'resolvable extension of the api classpath'
canBeResolved=true
extendsFrom api
}
}
jar {
into 'resources', {
from 'src/main/java/resources'
}
}
sourceSets {
intTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
java {
srcDirs = ['src/integration/java']
}
resources {
srcDirs = ['src/integration/resources', 'src/main/java']
}
}
smokeTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
java {
srcDirs = ['src/smokeTest/java']
}
}
}
configurations {
intTestImplementation.extendsFrom implementation
intTestRuntimeOnly.extendsFrom runtimeOnly
smokeTestImplementation.extendsFrom implementation
smokeTestRuntimeOnly.extendsFrom runtimeOnly
}
dependencies {
intTestImplementation 'junit:junit:4.12'
intTestImplementation 'com.google.jimfs:jimfs:1.1'
smokeTestImplementation 'junit:junit:4.12'
}
task fatJar(type: Jar, dependsOn: ':opensha:fatJar') {
doFirst {->
writeBuildFiles("/nzshm-build")
}
doLast {
delete new File(projectDir, "nzshm-build.githash")
delete new File(projectDir, "nzshm-build.gitbranch")
delete new File(projectDir, "nzshm-build.gitremoteurl")
delete new File(projectDir, "nzshm-build.date")
}
baseName = project.name + '-all'
from {
configurations.apiResolvable.collect { it.isDirectory() ? it : zipTree(it).matching {
exclude { it.path.contains('META-INF') }
}}
}
from(project.projectDir) {
include 'nzshm-build.githash'
include 'nzshm-build.gitbranch'
include 'nzshm-build.gitremoteurl'
include 'nzshm-build.date'
}
// include compiled source from this project
from sourceSets.main.allJava
// include upstream project fat jar
from zipTree(file('../opensha/build/libs/opensha-all.jar'))
from zipTree(file('python/share/py4j/py4j0.10.9.1.jar'))
duplicatesStrategy = 'exclude'
// from sourceSets.main.allJava
with jar
}
task integrationTest(type: Test) {
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
shouldRunAfter test
}
check.dependsOn integrationTest
task smokeTest(type: Test) {
description = 'Runs Smoke Tests.'
group = 'verification'
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
shouldRunAfter test
}
test {
exclude 'org/opensha/**'
exclude '**/DataSuite'
filter {
includeTestsMatching('*NZSHM22.*')
getIncludePatterns().remove('*Suite*')
}
}
task localTests(type: Test, dependsOn: testClasses) {
//filter { excludeTestsMatching('*.opensha.commons.*')}
filter { includeTestsMatching('*NZSHM22.*') }
filter { includeTestsMatching('*nz.cri.gns.*') }
filter { includeTestsMatching('*UCERF3.inversion.*') }
//filter { excludeTestsMatching 'generic.*' }
// excludes a whole package, "generic". NB this is not a regex:
// '*' is simply "wildcard" and dot means dot ... other more
// sophisticated "ANT-style" patterns are available in class Test
//filter { excludeTestsMatching '*_FT' }
// also exclude all test classes ending in "_FT" (e.g. for "functional test")
}