forked from Xilinx/RapidWright
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.gradle
117 lines (99 loc) · 3.72 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
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)
maven{
url additionalMavenRepo
}
}
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.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.11.4'
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'
}
//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 = "5G"
//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
}