@@ -3,10 +3,29 @@ plugins {
3
3
}
4
4
apply plugin : ' jacoco'
5
5
6
+ repositories {
7
+ mavenCentral()
8
+ maven { url ' https://jitpack.io' }
9
+ maven {
10
+ url = uri(' https://maven.pkg.github.com/UnitTestBot/usvm' )
11
+ credentials {
12
+ username = project. githubActor // System.getenv("GITHUB_ACTOR")
13
+ password = project. githubToken // System.getenv("GITHUB_TOKEN")
14
+ }
15
+ }
16
+ }
17
+
6
18
configurations {
7
19
fetchInstrumentationJar
20
+ approximations
21
+ usvmApproximationsApi
22
+ usvmInstrumentationCollector
23
+ usvmInstrumentationRunner
8
24
}
9
25
26
+ def approximationsRepo = " com.github.UnitTestBot.java-stdlib-approximations"
27
+ def approximationsVersion = " 53ceeb23ea"
28
+
10
29
compileJava {
11
30
options. compilerArgs << ' -XDignore.symbol.file'
12
31
}
@@ -44,7 +63,10 @@ sourceSets {
44
63
45
64
test {
46
65
useJUnit()
47
- jvmArgs = [
66
+ if (JavaVersion . current() < JavaVersion . VERSION_1_9 ) {
67
+ jvmArgs = []
68
+ } else {
69
+ jvmArgs = [
48
70
" --add-opens" , " java.base/java.util.concurrent.atomic=ALL-UNNAMED" ,
49
71
" --add-opens" , " java.base/java.lang.invoke=ALL-UNNAMED" ,
50
72
" --add-opens" , " java.base/java.util.concurrent=ALL-UNNAMED" ,
@@ -95,7 +117,8 @@ test {
95
117
" --add-opens" , " java.base/jdk.internal.util.xml.impl=ALL-UNNAMED" ,
96
118
" --add-opens" , " java.base/jdk.internal.vm=ALL-UNNAMED" ,
97
119
" --add-opens" , " java.base/jdk.internal.vm.annotation=ALL-UNNAMED"
98
- ]
120
+ ]
121
+ }
99
122
finalizedBy jacocoTestReport
100
123
}
101
124
@@ -136,16 +159,19 @@ dependencies {
136
159
implementation group : ' io.github.microutils' , name : ' kotlin-logging' , version : kotlinLoggingVersion
137
160
implementation group : ' org.jsoup' , name : ' jsoup' , version : ' 1.6.2'
138
161
implementation ' org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1'
162
+ implementation group : ' com.google.guava' , name : ' guava' , version : guavaVersion
139
163
// need for tests
140
164
implementation group : ' org.mockito' , name : ' mockito-core' , version : mockitoVersion
141
165
implementation group : ' org.mockito' , name : ' mockito-inline' , version : mockitoInlineVersion
142
166
implementation ' junit:junit:4.13.2'
143
167
144
168
implementation " org.burningwave:core:12.62.7"
145
169
146
- implementation(' org.usvm:usvm-core' )
147
- implementation(' org.usvm:usvm-jvm' )
148
- implementation(' org.usvm:usvm-jvm-instrumentation' )
170
+ implementation group : " org.usvm" , name : " usvm-core" , version : usvmVersion
171
+ implementation group : " org.usvm" , name : " usvm-jvm" , version : usvmVersion
172
+ implementation group : " org.usvm" , name : " usvm-jvm-api" , version : usvmVersion
173
+ implementation group : " org.usvm" , name : " usvm-jvm-instrumentation" , version : usvmVersion
174
+ implementation group : " org.usvm" , name : " usvm-jvm-instrumentation-collectors" , version : usvmVersion
149
175
150
176
implementation group : " org.jacodb" , name : " jacodb-core" , version : jacoDbVersion
151
177
implementation group : " org.jacodb" , name : " jacodb-analysis" , version : jacoDbVersion
@@ -160,6 +186,12 @@ dependencies {
160
186
testImplementation files(' src/main/resources/evosuite/evosuite-standalone-runtime-1.2.0.jar' )
161
187
162
188
fetchInstrumentationJar project(path : ' :utbot-instrumentation' , configuration : ' instrumentationArchive' )
189
+
190
+ approximations " $approximationsRepo :approximations:$approximationsVersion "
191
+ usvmApproximationsApi " org.usvm:usvm-jvm-api:$usvmVersion "
192
+ usvmInstrumentationCollector " org.usvm:usvm-jvm-instrumentation-collectors:$usvmVersion "
193
+ usvmInstrumentationRunner " org.usvm:usvm-jvm-instrumentation:$usvmVersion "
194
+ usvmInstrumentationRunner " org.usvm:usvm-jvm-instrumentation-collectors:$usvmVersion "
163
195
}
164
196
165
197
processResources {
@@ -214,3 +246,48 @@ task monitoringJar(type: Jar) {
214
246
215
247
duplicatesStrategy = DuplicatesStrategy . EXCLUDE
216
248
}
249
+
250
+ // TODO usvm-sbft-saloed: replace with runner from usvm (unavailable due to huge jar size)
251
+ task usvmInstrumentationRunnerJar (type : Jar ) {
252
+ archiveBaseName = " usvm-instrumentation-runner"
253
+ duplicatesStrategy = DuplicatesStrategy . EXCLUDE
254
+ manifest {
255
+ attributes(
256
+ " Main-Class" : " org.usvm.instrumentation.rd.InstrumentedProcessKt" ,
257
+ " Premain-Class" : " org.usvm.instrumentation.agent.Agent" ,
258
+ " Can-Retransform-Classes" : " true" ,
259
+ " Can-Redefine-Classes" : " true"
260
+ )
261
+ }
262
+
263
+ from {
264
+ configurations. usvmInstrumentationRunner. collect {
265
+ it. isDirectory() ? it : zipTree(it)
266
+ }
267
+ }
268
+ }
269
+
270
+ task run (type : JavaExec ) {
271
+ mainClass. set(" org.utbot.contest.ContestEstimatorKt" )
272
+ classpath = sourceSets. main. runtimeClasspath
273
+ workingDir = project. rootProject. projectDir
274
+
275
+ def usvmApproximationJarPath = configurations. approximations. resolvedConfiguration. files. find()
276
+ def usvmApproximationApiJarPath = configurations. usvmApproximationsApi. resolvedConfiguration. files. find()
277
+ environment " usvm.jvm.api.jar.path" , usvmApproximationApiJarPath. absolutePath
278
+ environment " usvm.jvm.approximations.jar.path" , usvmApproximationJarPath. absolutePath
279
+
280
+ def usvmInstrumentationCollectorJarPath = configurations. usvmInstrumentationCollector. resolvedConfiguration. files. find()
281
+ environment " usvm-jvm-collectors-jar" , usvmInstrumentationCollectorJarPath. absolutePath
282
+
283
+ dependsOn(usvmInstrumentationRunnerJar)
284
+ environment " usvm-jvm-instrumentation-jar" , usvmInstrumentationRunnerJar. outputs. files. singleFile
285
+
286
+ // "JAVA_HOME" specifies Java path for instrumented process and JacoDB,
287
+ // while `System.getProperty('java.home')` is Java used by this process.
288
+ // We want both of them to be the same and we also need JDK (not JRE), since we use `javac` to compile tests.
289
+ def javaHome = System . getProperty(' java.home' )
290
+ def jreSuffix = " ${ File.separatorChar} jre"
291
+ if (javaHome. endsWith(jreSuffix)) javaHome = javaHome. dropRight(jreSuffix. length())
292
+ environment " JAVA_HOME" , javaHome
293
+ }
0 commit comments