-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.gradle
68 lines (61 loc) · 1.97 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
subprojects {
apply plugin: 'groovy'
apply plugin: 'java-library'
dependencies {
api "org.codehaus.groovy:groovy:${groovyVersion}"
api "org.codehaus.groovy:groovy-jsr223:${groovyVersion}"
api "org.codehaus.groovy:groovy-json:${groovyVersion}"
api "com.h2database:h2:1.4.200"
api "org.codehaus.groovy:groovy-sql:${groovyVersion}"
}
compileGroovy {
groovyOptions.optimizationOptions.indy = false
sourceCompatibility = project.sourceCompatibility
targetCompatibility = project.targetCompatibility
options.compilerArgs += project.compilerArgs
options.deprecation = true
options.encoding = 'UTF-8'
}
compileJava {
sourceCompatibility = project.sourceCompatibility
targetCompatibility = project.targetCompatibility
options.compilerArgs += project.compilerArgs
options.deprecation = true
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
doLast {
stripJar(it.archivePath)
}
}
tasks.withType(Jar) {
metadataCharset = "US-ASCII"
}
}
import java.util.jar.*
import java.nio.file.*
void stripJar(File file) {
if (file.getName().endsWith('.tar'))
return
println "stripping $file"
File newFile = new File(file.parent, 'tmp-' + file.name)
newFile.withOutputStream { fout ->
JarOutputStream out = new JarOutputStream(fout)
JarFile jf = new JarFile(file)
jf.entries().unique {it.name}.sort {it.name}.each {
def copy = new JarEntry(it.name)
copy.time = 1001
out.putNextEntry(copy)
out << jf.getInputStream(it)
}
out.finish()
jf.close()
}
Files.copy(newFile.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING)
newFile.delete()
}