-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
128 lines (107 loc) · 3.36 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
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
id "java"
id "application"
id "io.freefair.lombok" version "6.4.3" // apply false
}
repositories {
mavenCentral()
//mavenLocal()
}
// Global variables for all modules
ext {
lo4jVersion = "2.17.1" // <2.15="CVE-2021-44228 Log4j 2 Vulnerability"
junitVersion = "5.8.2"
os = DefaultNativePlatform.currentOperatingSystem;
architecture = DefaultNativePlatform.currentArchitecture;
}
dependencies {
// Tests
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testRuntimeOnly "org.junit.platform:junit-platform-launcher" // https://github.com/gradle/gradle/issues/18627
// Logging
testImplementation "org.apache.logging.log4j:log4j-core:$lo4jVersion"
testImplementation "org.apache.logging.log4j:log4j-api:$lo4jVersion"
// JSON
testImplementation "com.google.code.gson:gson:2.8.9"
// Modules
implementation "tech.deplant.java4ever:java4ever-binding:1.1.1"
implementation "tech.deplant.java4ever:java4ever-framework:1.1.1"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
compileJava {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
doFirst {
options.compilerArgs += [
'--module-path', classpath.asPath
]
classpath = files()
}
}
tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}
options.compilerArgs += "--enable-preview"
}
tasks.withType(JavaExec).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
jvmArgs += "--enable-preview"
}
compileTestJava {
doFirst {
options.compilerArgs += [
'--module-path', classpath.asPath
]
classpath = files()
}
}
test {
println name
def pathToLibs = System.getProperty("user.dir")
def processor = architecture.getName()
if (os.isWindows()) {
pathToLibs += "/lib/win"
} else if(os.isMacOsX()) {
pathToLibs += "/lib/macosx"
if (
processor == "x86" || processor == "i386" || processor == "ia-32" ||
processor == "i686" || processor == "x86_64" || processor == "amd64" ||
processor == "x64" || processor == "x86-64"
) {
pathToLibs += "/x86_64"
} else {
pathToLibs += "/aarch64"
}
} else if(os.isLinux()) {
pathToLibs += "/lib/linux"
}
println "EVER-SDK Library path: " + pathToLibs
systemProperty("java.library.path",pathToLibs)
useJUnitPlatform {
excludeTags 'server' // exclude some tags
}
// Show test results.
testLogging {
showStandardStreams = true
//exceptionFormat = TestExceptionFormat.FULL
events "passed", "skipped", "failed"
}
//javaLauncher = javaToolchains.launcherFor {
// languageVersion = JavaLanguageVersion.of(17)
//}
jvmArgs += "--add-modules=jdk.incubator.foreign"
jvmArgs += "--enable-native-access=java4ever.binding"
//jvmArgs += "-Djava.library.path=c:/opt/sdk/"
}