-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.gradle
197 lines (173 loc) · 5.35 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
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
plugins {
id 'java'
id 'jacoco'
id 'java-library'
id 'maven-publish'
id 'signing'
}
group 'com.surrealdb'
version '0.2.2-SNAPSHOT'
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
sourceSets {
integrationTest {
java
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
integrationTestImplementation files("build/libs/surrealdb-0.2.2-SNAPSHOT.jar")
}
jacoco {
toolVersion = "0.8.12"
}
test {
useJUnitPlatform()
systemProperty 'java.library.path', file('target/debug').absolutePath
testLogging {
events "passed"
}
}
jacocoTestReport {
dependsOn test
finalizedBy jacocoTestCoverageVerification
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.5
}
}
}
}
artifacts {
archives javadocJar, sourcesJar
}
tasks.register('createCombinedReport') {
dependsOn jacocoTestReport
dependsOn javadoc
doLast {
// Copy the javadoc
def javadocSource = file("build/docs/javadoc")
def javadocDestination = file("build/reports/javadoc")
// Ensure destination exists and copy
delete javadocDestination // Clean old docs if present
mkdir javadocDestination
copy {
from javadocSource
into javadocDestination
}
def indexFile = file("build/reports/index.html")
indexFile.text = """
<!DOCTYPE html>
<html>
<head>
<title>Combined Test, Coverage, and Javadoc Report</title>
</head>
<body>
<h1>Combined Test, Coverage, and Javadoc Report</h1>
<ul>
<li><a href="./tests/test/index.html">Test Report</a></li>
<li><a href="./jacoco/test/html/index.html">JaCoCo Coverage Report</a></li>
<li><a href="./javadoc/index.html">Javadoc</a></li>
</ul>
</body>
</html>
"""
}
}
tasks.register('integrationTest', Test) {
useJUnitPlatform()
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
testLogging {
showStandardStreams = true
events "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat = 'full'
showCauses = true
showStackTraces = true
}
}
project.afterEvaluate {
def key = System.getenv('SIGNING_KEY')
def _pass = System.getenv('SIGNING_KEY_PASS')
signing {
useInMemoryPgpKeys(key, _pass)
sign publishing.publications.mavenJava
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/surrealdb/surrealdb.java")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
// maven {
// name = "OSSRH"
// def releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
// def snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// credentials {
// username = System.getenv("MAVEN_USERNAME")
// password = System.getenv("MAVEN_PASSWORD")
// }
// }
}
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = project.rootProject.name
version = project.version
from components.java
pom {
name = 'SurrealDB Driver'
packaging = 'jar'
description = 'The driver for accessing a SurrealDB instance.'
url = 'https://surrealdb.com/docs/integration/libraries/java'
scm {
connection = 'scm:git:[email protected]:surrealdb/surrealdb.java.git'
url = 'https://github.com/surrealdb/surrealdb.java'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'tobiemh'
name = 'Tobie Morgan Hitchcock'
email = '[email protected]'
}
developer {
id = 'phughk'
name = 'Hugh Kaznowski'
email = '[email protected]'
}
developer {
id = 'emmanuel-keller'
name = 'Emmanuel Keller'
email = '[email protected]'
}
}
}
}
}
}