-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.gradle
126 lines (103 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
124
125
126
plugins {
id "java-library"
// code coverage
id "jacoco"
id "com.adarshr.test-logger" version "2.0.0"
id "io.franzbecker.gradle-lombok" version "5.0.0"
}
apply from: "common.gradle"
allprojects {
group "org.roc-streaming.roctoolkit"
version tagVersion
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
implementation project(":commons")
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.6.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
testImplementation "org.awaitility:awaitility:3.1.6"
}
// from io.franzbecker.gradle-lombok
lombok {
version = "1.18.30"
}
ext {
targetLibraryPath = "${project.rootDir}/libs"
}
compileJava {
options.headerOutputDirectory = file(project(":roc_jni").projectDir.absolutePath + "/src/main/export")
}
["Debug", "Release"].each { variant ->
tasks.register("copyNative${variant}Deps") {
dependsOn ":roc_jni:assemble${variant}"
doLast {
copyNativeLibs(
project(":roc_jni").buildDir.absolutePath + "/${variant.toLowerCase()}",
targetLibraryPath)
}
}
}
jar.dependsOn copyNativeReleaseDeps
copyNativeDebugDeps.mustRunAfter jar
project(":roc_jni").afterEvaluate {
tasks.test.enabled = !project(":roc_jni").extensions.cmake.target.isCrossCompiling.get()
}
test {
dependsOn copyNativeDebugDeps
systemProperty "java.library.path", targetLibraryPath
useJUnitPlatform {
includeEngines "junit-jupiter"
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
}
}
testlogger {
theme "mocha"
showStandardStreams = false
slowThreshold 5000
}
// for javadoc
import io.franzbecker.gradle.lombok.task.DelombokTask
task delombok(type: DelombokTask, dependsOn: compileJava) {
ext.outputDir = file("$buildDir/delombok")
outputs.dir(outputDir)
sourceSets.main.java.srcDirs.each {
inputs.dir(it)
args(it, "-d", outputDir)
}
}
javadoc {
// run javadoc on delombok-ed sources
dependsOn delombok
source = delombok.outputDir
// disable javadoc warnings (missing comment, etc.)
options.addStringOption("Xdoclint:none", "-quiet")
}
// format C code
task clangFormat {
doLast {
def hFiles = fileTree(dir: "roc_jni", include: "**/*.h")
def cppFiles = fileTree(dir: "roc_jni", include: "**/*.cpp")
def excludedFiles = fileTree(dir: "roc_jni", include: "**/org_rocstreaming_roctoolkit_*")
hFiles = hFiles.minus(excludedFiles)
cppFiles = cppFiles.minus(excludedFiles)
hFiles.each { file ->
exec { commandLine "clang-format", "-i", file }
}
cppFiles.each { file ->
exec { commandLine "clang-format", "-i", file }
}
}
}