This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
123 lines (106 loc) · 2.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
plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building an application
id 'application'
// Plugin for building C executables
id 'c'
}
// Define the main class for the application
mainClassName = 'test.C'
if (project.hasProperty('main')) {
mainClassName = main
}
// Define arguments for the Java Agent
def agentArgString = '-P=test/'
if (project.hasProperty('agentArgs')) {
agentArgString = agentArgs
}
// Other application info
applicationDefaultJvmArgs = ["-Dgreeting.language=en"]
executableDir = "/build/bin"
dependencies {
// Use JUnit test framework
testCompile 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
}
jar {
manifest {
attributes('Premain-Class': 'vedebug.core.VideoAgent',
'Can-Redefine-Classes': 'true',
'Can-Retransform-Classes': 'true',
'Can-Set-Native-Method-Prefix': 'true')
}
}
// Add agent.jar as an argument to the execution
run.doFirst {
def cleared = new File('.vedebug').deleteDir()
assert cleared
if (agentArgString != null) {
jvmArgs "-javaagent:$libsDir/vedebug.jar=$agentArgString"
} else {
jvmArgs "-javaagent:$libsDir/vedebug.jar"
}
}
// Remove .vedebug when running clean task
clean.doFirst {
def cleared = new File('.vedebug').deleteDir()
assert cleared
}
// In this section you declare where to find the dependencies of your project
repositories {
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
}
sourceSets {
main {
java {
exclude '*.swp'
}
}
}
model {
toolChains {
gcc(Gcc)
}
components {
main(NativeExecutableSpec) {
sources {
c {
source {
exclude '*.swp'
}
}
}
binaries {
all {
if (toolChain in Gcc) {
cCompiler.args "-std=gnu99"
linker.args "-lncurses"
}
}
}
}
}
}
// Add agent.jar as an argument to test
test {
// if (agentArgString != null) {
// jvmArgs "-javaagent:$libsDir/vedebug.jar=$agentArgString"
// } else {
// jvmArgs "-javaagent:$libsDir/vedebug.jar"
// }
testLogging {
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
}
}
// Forces tests to output to console
outputs.upToDateWhen {false}
showStandardStreams = true
// To fix gradle bugs with Java 11
targetCompatibility = '8'
sourceCompatibility = '8'
}
}