-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
140 lines (122 loc) · 3.68 KB
/
Copy pathbuild.gradle
File metadata and controls
140 lines (122 loc) · 3.68 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
plugins {
id "java-library"
id "maven-publish"
id "signing"
id "com.diffplug.spotless" version "8.3.0"
id "jacoco"
}
group = "com.dynatrace.vectorscan4j"
version = "0.3.1"
repositories {
mavenCentral()
}
jacoco {
toolVersion = "0.8.14"
}
jacocoTestReport {
dependsOn test
reports {
html.required.set(true)
}
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(25)
withSourcesJar()
withJavadocJar()
}
dependencies {
testImplementation platform("org.junit:junit-bom:5.10.0")
testImplementation "org.junit.jupiter:junit-jupiter"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.7.1"
}
test {
useJUnitPlatform()
}
tasks.withType(Test).configureEach {
jvmArgs = [
"--enable-native-access=ALL-UNNAMED"
]
systemProperty "vs4j.native.countMatches",
layout.buildDirectory.file("native/libvs4j_count_matches.so").get().asFile.absolutePath
}
// Build a tiny native shared library used by tests that exercise the
// no-upcall scan path (see NativeMatchHandler). Skipped silently if cc is missing.
tasks.register('buildTestNativeCallback', Exec) {
def srcDir = file("src/test/native")
def outDir = layout.buildDirectory.dir("native").get().asFile
inputs.dir(srcDir)
outputs.dir(outDir)
doFirst { outDir.mkdirs() }
ignoreExitValue = true
commandLine 'sh', '-c',
"command -v cc >/dev/null 2>&1 && " +
"cc -std=c11 -O3 -fPIC -shared " +
"-o ${outDir}/libvs4j_count_matches.so " +
"${srcDir}/count-matches-native.c || " +
"echo 'cc not available or build failed; native-callback tests will be skipped.'"
}
tasks.named('test').configure { dependsOn 'buildTestNativeCallback' }
spotless {
java {
palantirJavaFormat("2.90.0")
licenseHeaderFile rootProject.file('spotless/HEADER.java')
}
}
tasks.named("jar") {
from("THIRD_PARTY_NOTICES.md") {
into("META-INF")
rename { "THIRD_PARTY_NOTICES.txt" }
}
from("LICENSE") {
into("META-INF")
}
exclude("native/vectorscan.h")
}
tasks.named("sourcesJar") {
exclude("native/vectorscan.h")
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = "vectorscan4j"
description = "A Java wrapper for the Vectorscan pattern matching engine"
url = "https://github.com/dynatrace-oss/vectorscan4j"
licenses {
license {
name = "Apache License 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "Dynatrace"
name = "Dynatrace LLC"
email = "opensource@dynatrace.com"
}
}
scm {
connection = "scm:git:git://github.com/dynatrace-oss/vectorscan4j.git"
developerConnection = "scm:git:ssh://github.com/dynatrace-oss/vectorscan4j.git"
url = "https://github.com/dynatrace-oss/vectorscan4j"
}
}
}
}
repositories {
maven {
url = "$projectDir/build/mavencentral/repo"
}
}
}
signing {
useGpgCmd()
sign publishing.publications.mavenJava
}
tasks.register("createRepoForUploadToMavenCentral", Zip) {
dependsOn build, publish
from "$projectDir/build/mavencentral/repo"
destinationDirectory = file("$projectDir/build/mavencentral")
archiveFileName = "repo.zip"
}