-
Notifications
You must be signed in to change notification settings - Fork 108
/
common.gradle
145 lines (126 loc) · 4.77 KB
/
common.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
135
136
137
138
139
140
141
142
143
144
145
apply plugin: 'application'
apply plugin: 'java-library'
apply plugin: "java-test-fixtures"
sourceCompatibility = 8
targetCompatibility = 8
repositories {
if (project.hasProperty('additionalMavenRepo')) {
project.logger.lifecycle('Adding Maven Repository at '+additionalMavenRepo)
exclusiveContent {
forRepository {
maven {
url additionalMavenRepo
}
}
filter {
includeModule("com.xilinx.rapidwright", "rapidwright-api-lib")
}
}
}
if (project.hasProperty('useMavenLocal') && useMavenLocal == "True") {
project.logger.lifecycle('Using Maven Local Repository')
mavenLocal()
}
mavenCentral()
}
ext.os = System.getProperty("os.name").toLowerCase().contains("windows") ?
"win64-msvc2005x64" : "linux64-gcc"
dependencies {
api 'com.github.luben:zstd-jni:1.5.5-1'
api 'com.esotericsoftware:kryo:5.2.1'
api 'org.jgrapht:jgrapht-core:1.3.0'
api 'org.capnproto:runtime:0.1.13'
api 'net.sf.jopt-simple:jopt-simple:5.0.4'
api 'org.python:jython-standalone:2.7.2'
api 'com.google.protobuf:protobuf-java:3.25.0'
api 'org.jetbrains:annotations:20.1.0'
api 'org.zeromq:jeromq:0.5.2'
api 'commons-cli:commons-cli:1.2'
api 'org.json:json:20160810'
api 'com.jcraft:jzlib:1.1.3'
api 'commons-io:commons-io:2.11.0'
api 'com.xilinx.rapidwright:qtjambi-'+os+':4.5.2_01'
api 'com.xilinx.rapidwright:jupyter-kernel-jsr223:1.0.1'
testFixturesApi 'org.junit.jupiter:junit-jupiter-api:5.7.1'
testFixturesApi 'org.junit.jupiter:junit-jupiter-engine:5.7.1'
testFixturesApi 'org.junit.jupiter:junit-jupiter-params:5.7.1'
testFixturesImplementation group: 'org.junit.platform', name: 'junit-platform-console', version: '1.7.1'
}
//Kryo needs to access sun.nio.ch.DirectBuffer. This is forbidden by default in Java 16 and up. Check if we need to add a jvm arg.
if (org.gradle.api.JavaVersion.current().isJava10Compatible()) {
applicationDefaultJvmArgs = ["--add-exports=java.base/sun.nio.ch=ALL-UNNAMED"]
}
if(project.hasProperty('limitToSingleProc') && limitToSingleProc.equals("single-threaded")) {
applicationDefaultJvmArgs << "-XX:ActiveProcessorCount=1"
}
configurations.implementation.canBeResolved = true
configurations.testImplementation.canBeResolved = true
configurations.testFixturesImplementation.canBeResolved = true
configurations.api.canBeResolved = true
tasks.withType(Test) {
maxHeapSize = "10G"
//Propagate JVM settings to test JVM
jvmArgs applicationDefaultJvmArgs
environment 'RAPIDWRIGHT_PATH', gradle.ext.rapidwrightDir
//We need to rerun tests when the data files change
if (new File(gradle.ext.rapidwrightDir, 'data').exists()) {
inputs.dir new File(gradle.ext.rapidwrightDir, 'data')
}
}
task testJava(type:Test) {
group = "verification"
description = "Runs the Java unit tests."
useJUnitPlatform()
systemProperty("junit.jupiter.extensions.autodetection.enabled", true)
}
test {
dependsOn testJava
}
gradle.taskGraph.whenReady {
if (!project.test.filter.commandLineIncludePatterns.isEmpty()) {
throw new InvalidUserDataException("'test' task does not support filters (i.e. '--tests' option); please apply filters directly to 'testJava'/'testPython' tasks instead.")
}
}
task updateSubmodules(type:Exec) {
group = "build setup"
description = "Update Git submodules"
executable = 'git'
args = ['submodule', 'update', '--init', '--recursive']
}
task initSubmodules {
group = "build setup"
description = "Init Git submodules (first time only)"
if (!file("test/RapidWrightDCP/.git").exists()) {
dependsOn updateSubmodules
}
}
task remindSubmodules {
onlyIf {
testJava.state.failure != null || (project.tasks.findByName('testPython') && testPython.state.failure != null)
}
doLast {
logger.warn('Failed tests detected. Some tests depend on DCPs from the git submodule at test/RapidWrightDCP, consider checking its status and updating with \'gradlew updateSubmodules\'')
}
}
tasks.withType(Test) {
dependsOn initSubmodules
finalizedBy remindSubmodules
}
task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
dependsOn project.tasks.findByName('testFixturesJar')
dependsOn project.tasks.findByName('jar')
}
task testLsf(type: JavaExec) {
group = "verification"
description = "Run the tests on lsf"
//Using a closure here, otherwise the test classpath gets messed up and compileTestClasses fails.
classpath = files( { -> project.configurations.testRuntimeClasspath.getFiles() + project.tasks.findByName('testJar').getArchiveFile().get() })
mainClass = "com.xilinx.rapidwright.util.lsf.LaunchTestsOnLsf"
workingDir = file("build/test-lsf")
args project.tasks.findByName('testJar').getArchiveFile().get()
doFirst {
project.mkdir(workingDir)
}
}