Repository navigation
Expand file tree
/
Copy pathcommon.gradle
More file actions
213 lines (191 loc) · 7.52 KB
/
Copy pathcommon.gradle
File metadata and controls
213 lines (191 loc) · 7.52 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
apply plugin: 'application'
apply plugin: 'java-library'
apply plugin: "java-test-fixtures"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_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.ortools:ortools-java:9.14.6206'
api 'com.google.protobuf:protobuf-java:4.31.1'
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.20.0'
api 'com.google.guava:guava:33.5.0-jre'
api 'com.xilinx.rapidwright:qtjambi-'+os+':4.5.2_01'
api 'com.xilinx.rapidwright:jupyter-kernel-jsr223:1.0.1'
if (JavaVersion.current() < JavaVersion.VERSION_17) {
// Eclipse ELK doesn't compile to support JDK8 anymore
api 'com.xilinx.rapidwright:org.eclipse.elk-deps-jdk8:0.10.0-rc1'
} else {
api 'org.eclipse.elk:org.eclipse.elk.core:0.10.0'
api 'org.eclipse.elk:org.eclipse.elk.graph:0.10.0'
api 'org.eclipse.elk:org.eclipse.elk.alg.layered:0.10.0'
}
api 'com.xilinx.rapidwright:jacl:1.4.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()) {
application {
applicationDefaultJvmArgs = ["--add-exports=java.base/sun.nio.ch=ALL-UNNAMED"]
}
}
if(project.hasProperty('limitToSingleProc') && limitToSingleProc.equals("single-threaded")) {
application {
applicationDefaultJvmArgs << "-XX:ActiveProcessorCount=1"
}
}
tasks.withType(Test) {
maxHeapSize = "10G"
application {
// 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
}
// Run the examples as smoke tests, since CI otherwise only compiles them.
// Args are closures because some point into the RapidWrightDCP submodule.
// That submodule is only initialized once the task graph runs.
def rwDcp = { String name -> file("test/RapidWrightDCP/${name}").toString() }
ext.exampleRuns = [
[name: 'Lesson1'],
[name: 'CustomRouting'],
[name: 'DecomposeLUT'],
[name: 'ExampleNetlistCreation'],
[name: 'AddSubGenerator'],
[name: 'CounterGenerator'],
[name: 'MultGenerator'],
[name: 'PipelineGenerator'],
[name: 'SLRCrosserGenerator'],
[name: 'PipelineGeneratorWithRouting'],
[name: 'PolynomialGenerator', args: { -> ['x^2+3*x+5', '16'] }],
[name: 'CountRoutedNets', args: { -> [rwDcp('picoblaze_ooc_X10Y235.dcp')] }],
[name: 'FindBlackBoxes', args: { -> [rwDcp('picoblaze_ooc_X10Y235.dcp')] }],
[name: 'ReportTimingExample', args: { -> [rwDcp('picoblaze_ooc_X10Y235.dcp')] }],
[name: 'PrintEDIFInstances', args: { -> [rwDcp('duplicateCellNames.edf'), 'instnames.txt'] }],
[name: 'PartRetargeter', args: { -> [rwDcp('picoblaze_ooc_X10Y235.dcp'), 'retargeted.dcp', 'xcvu9p-flgb2104-2-i', '0'] }],
[name: 'RelocateHierarchy', args: { -> [rwDcp('picoblaze_ooc_X10Y235.dcp'), '', '0', '5', 'relocated.dcp'] }],
[name: 'PicoBlazeArray', args: { -> [rwDcp('PicoBlazeArray'), 'xcvu3p-ffvc1517-2-i', 'picoblaze_array.dcp', '--no_hand_placer'] }],
]
def exampleTasks = ext.exampleRuns.collect { ex ->
tasks.register("runExample${ex.name}", JavaExec) {
group = "verification"
description = "Run the ${ex.name} example as a smoke test"
classpath = sourceSets.main.runtimeClasspath
mainClass = "com.xilinx.rapidwright.examples.${ex.name}"
jvmArgs application.applicationDefaultJvmArgs
def exWorkingDir = file("${buildDir}/examples/${ex.name}")
workingDir = exWorkingDir
// Without this, FileTools.getRapidWrightPath() falls back to build/classes/java.
// Examples using the timing model then can't find the repo's timing data directory.
environment 'RAPIDWRIGHT_PATH', projectDir.toString()
dependsOn initSubmodules
doFirst {
project.mkdir(exWorkingDir)
if (ex.args) {
args = ex.args.call()
}
}
}
}
task runExamples {
group = "verification"
description = "Run the examples listed in exampleRuns as smoke tests"
dependsOn exampleTasks
}
task testJar(type: Jar) {
archiveClassifier = '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)
}
}