forked from mattbdean/JRAW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
107 lines (88 loc) · 3 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
apply plugin: 'idea'
allprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
version = '0.3.0'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.+'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.+'
testCompile group: 'org.testng', name: 'testng', version: '6.1.1'
}
test {
// TestNG instead of default JUnit
useTestNG()
// Show stderr and stdout (useful for exceptions)
testLogging.showStandardStreams = true
}
}
dependencies {
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.3'
}
def generatedJavaSrcName = "generated-src"
def generatedJavaSrc = file("$buildDir/$generatedJavaSrcName")
def endpointsJsonMd5 = file("endpoints/src/main/resources/endpoints.json.md5")
def releaseDest = new File((File) project.buildDir, "releases")
def genJavaClass = file("$generatedJavaSrc/net/dean/jraw/Endpoints.java").absolutePath
def genEndpointsMd = file("ENDPOINTS.md").absolutePath
// Add the generated source to the main Java source directories
sourceSets.main.java.srcDir generatedJavaSrc
project(':endpoints') {
dependencies {
compile 'org.javassist:javassist:3.18.2-GA'
compile 'org.reflections:reflections:0.9.8'
compile project(':')
}
task update(type: JavaExec, dependsOn: compileJava) {
main = "net.dean.jraw.endpoints.EndpointAnalyzer"
classpath = sourceSets.main.runtimeClasspath
File parent = file(genJavaClass).parentFile
parent.exists() || parent.mkdirs()
args = [
"java=$genJavaClass",
"md=$genEndpointsMd",
"md5sum=$endpointsJsonMd5"
]
}
}
clean {
delete generatedJavaSrc
}
task fatJar(type: Jar, dependsOn: assemble) {
classifier = 'fat'
destinationDir = releaseDest
from(
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) },
sourceSets.main.output
)
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
destinationDir = releaseDest
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
destinationDir = releaseDest
from sourceSets.main.allSource
}
task release(type: Jar, dependsOn: ['fatJar', 'javadocJar', 'sourcesJar']) {
from sourceSets.main.output
destinationDir = releaseDest
}
idea {
module {
// Exclude everything in the build dir except for the generated source folder
excludeDirs = buildDir.listFiles(new FilenameFilter() {
@Override
boolean accept(File file, String s) {
return !s.equals(generatedJavaSrcName)
}
})
sourceDirs += file(generatedJavaSrc)
}
}
defaultTasks "check"