-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
114 lines (94 loc) · 2.77 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
plugins {
id 'java'
id 'jacoco'
id 'application'
}
group 'weka.finito'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
implementation 'junit:junit:4.13.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0-M1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation 'commons-io:commons-io:2.16.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'org.apache.logging.log4j:log4j-core:3.0.0-beta1'
}
// Commenting because it doesn't work well on TravisCI
test {
testLogging {
// Make sure output from
// standard out or error is shown
// in Gradle output.
showStandardStreams = true
}
// Set JVM arguments to include your agent
jvmArgs = [
'-javaagent:libs/InstrumentationAgent.jar' // Change this to your agent JAR path
]
}
// This library was built for Java 8 so it can be imported into Android as well.
// If you want to use a later version of Java, this should help point what to tweak.
gradle.projectsEvaluated {
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs << "-Xlint:deprecation,unchecked"
}
}
}
jacocoTestReport {
reports {
if (project.hasProperty("createReports")) {
xml.required = true
html.required = true
}
else {
html.required = false
xml.required = false
}
}
}
tasks.withType(JavaCompile).configureEach {
options.fork = true
options.incremental = true
}
tasks.withType(Test).configureEach {
if (project.hasProperty("createReports")) {
reports.html.required = true
reports.junitXml.required = true
}
else {
reports.html.required = false
reports.junitXml.required = false
}
}
clean {
delete 'logs/*.log'
}
check.dependsOn jacocoTestReport
application {
mainClass.set(project.findProperty("chooseRole").toString())
}
// Define a task to run your Java application with the agent
tasks.register('runWithAgent', JavaExec) {
mainClass.set(project.findProperty("chooseRole").toString())
classpath = sourceSets.main.runtimeClasspath
// Set JVM arguments to include your agent
jvmArgs = [
'-javaagent:libs/InstrumentationAgent.jar'
]
// Pass command-line arguments to your application
// gradle run -PchooseRole=PathsBob -Pargs='./data/ownroute3.txt 9000'
if (project.hasProperty('args')) {
args project.args.split(' ')
}
}
// Configure the 'run' task to depend on 'runWithAgent'
tasks.run.dependsOn('runWithAgent')