-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
134 lines (115 loc) · 3.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
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
import org.apache.tools.ant.taskdefs.condition.Os
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'org.javamodularity.moduleplugin' version '1.7.0' apply false
id 'java-library'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
allprojects {
group = 'sqlsolver'
version = 'v1.1.0'
}
subprojects {
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
flatDir { dirs("$rootDir/lib") }
mavenCentral()
}
tasks.withType(JavaCompile) {
doFirst {
options.compilerArgs += [
'--module-path', classpath.asPath,
'-encoding', 'UTF-8'
]
}
}
tasks.withType(JavaExec) {
modularity.inferModulePath = false
doFirst {
environment 'LD_LIBRARY_PATH', "$rootDir/lib/"
jvmArgs += ["-Djava.library.path=$rootDir/lib",
'--module-path', classpath.asPath,
'-Dfile.encoding=UTF-8'
]
workingDir(rootDir)
}
}
tasks.withType(Test) {
systemProperty('java.library.path', "$rootDir/lib/")
environment('LD_LIBRARY_PATH', "$rootDir/lib/")
useJUnitPlatform()
jvmArgs += ['-Dfile.encoding=UTF-8']
workingDir(rootDir)
}
dependencies {
implementation('org.jetbrains:annotations:16.0.2')
implementation('commons-codec:commons-codec:1.15')
implementation('org.apache.commons:commons-math3:3.6.1')
implementation('org.codehaus.janino:commons-compiler:3.1.9')
implementation('org.codehaus.janino:janino:3.1.9')
implementation('com.jayway.jsonpath:json-path:2.4.0')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.6.2')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2')
testRuntimeOnly('org.junit.platform:junit-platform-launcher:1.6.2')
testRuntimeOnly('org.junit.vintage:junit-vintage-engine:5.6.2')
}
ext.download = { String url, java.nio.file.Path path, String mod = null ->
def wd = path.getParent().toAbsolutePath().toString()
def fileName = path.getFileName().toString()
if (!path.toFile().exists()) {
println("downloading $fileName to $wd")
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
exec {
workingDir(wd)
commandLine 'powershell', 'Invoke-WebRequest', "'$url'",
'-OutFile', "$fileName"
}
} else {
exec {
workingDir(wd)
commandLine 'wget', '-e', 'use_proxy=yes',
'--no-check-certificate',
"$url",
'-O', "$fileName"
}
if (mod != null)
exec {
workingDir(wd)
commandLine 'chmod', "$mod", "$fileName"
}
}
} else {
println("use cached $fileName found in $wd")
}
}
}
task cleanAll {
doFirst {
subprojects.each {
dependsOn("${it.name}:cleanAll")
}
}
}
jar {
manifest {
attributes (
'Main-Class': 'sqlsolver.api.Entry',
'Class-Path': 'lib/'
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveVersion = 'v1.1.0'
from subprojects.collect { it.sourceSets.main.output }
}
task fatJar(type: ShadowJar) {
manifest.from jar.manifest
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archivesBaseName = rootProject.name
from subprojects.collect { it.sourceSets.main.output }
from subprojects.collect { it.configurations.compileClasspath }
zip64 true
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}