-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
85 lines (64 loc) · 1.7 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
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'application'
sourceCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
repositories {
jcenter()
}
dependencies {
compile('com.google.guava:guava:26.0-jre') {
transitive = false
}
compile 'com.google.code.gson:gson:2.8.5'
}
sourceSets {
main {
java {
srcDirs = ['src/java']
}
}
}
mainClassName = 'gov.usgs.earthquake.catalog.CEUSAgridCalc'
ext {
etcDir = "${projectDir}/etc"
adaptiveEtcDir = "${etcDir}/adaptive"
exeDir = "${buildDir}/exe"
adaptiveExePath = "${exeDir}/adaptiveAgrid"
fixedExePath = "${exeDir}/fixedAgrid"
agridPropsPath = "${sourceSets.main.java.getOutputDir()}/gov/usgs/earthquake/catalog/config.properties"
}
jar {
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
doFirst {
CheckPath.checkPath(etcDir)
CheckPath.checkPath(adaptiveEtcDir)
def props = new Properties();
def propsFile = new File(agridPropsPath)
propsFile.createNewFile()
props.setProperty('adaptiveEtcDir', adaptiveEtcDir)
props.setProperty('adaptiveExe', adaptiveExePath)
props.setProperty('fixedExe', fixedExePath)
props.store(propsFile.newWriter(), null)
}
}
task make(type: Exec) {
commandLine 'make'
doLast {
CheckPath.checkPath(adaptiveExePath)
CheckPath.checkPath(fixedExePath)
}
}
assemble.dependsOn make
class CheckPath {
static void checkPath(String path) {
Boolean fileExists = new File(path).exists();
if (!fileExists) {
throw new FileNotFoundException("Path not found [${path}]")
}
}
}