-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
174 lines (159 loc) · 5.6 KB
/
Copy pathbuild.gradle
File metadata and controls
174 lines (159 loc) · 5.6 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
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '2.3.20'
id 'signing'
id 'maven-publish'
}
java {
withSourcesJar()
withJavadocJar()
// Pattern-matching switch in Connection.coerceParam requires Java 21+.
// Keep this in sync with CMAKE_JAVA_COMPILE_FLAGS in CMakeLists.txt and
// the java.version / maven.compiler.{source,target} POM properties below.
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
// Kotlin must target the same JVM level as Java, otherwise Gradle refuses
// to build (inconsistent jvm-target between compileTestJava and compileTestKotlin).
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = '21'
}
}
group = 'com.ladybugdb'
def projectRoot = projectDir.parentFile.parentFile
def cmakeFileRef = new File(projectRoot, 'CMakeLists.txt')
if (!cmakeFileRef.exists()) {
cmakeFileRef = new File(projectDir.parentFile, 'ladybug/CMakeLists.txt')
}
if (cmakeFileRef.exists()) {
def cmakeFile = cmakeFileRef.text
def versionLine = cmakeFile.readLines().find { it.startsWith('project(Lbug VERSION ') }
def cmakeVersion = versionLine.split(' ')[2]
def versionParts = cmakeVersion.split('\\.')
if (versionParts.length > 3) {
version = versionParts[0] + '.' + versionParts[1] + '.' + versionParts[2] + '-SNAPSHOT'
} else {
version = cmakeVersion
}
} else {
version = providers.environmentVariable('LBUG_JAVA_VERSION').orElse('0.0.0-SNAPSHOT').get()
}
println "Project version: $version"
repositories {
mavenCentral()
}
dependencies {
implementation 'org.apache.arrow:arrow-c-data:18.2.0'
implementation 'org.apache.arrow:arrow-vector:18.2.0'
implementation 'org.apache.arrow:arrow-memory-core:18.2.0'
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.apache.arrow:arrow-memory-netty:18.2.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
if (System.getenv('SKIP_CMAKE_BUILD') != 'true') {
processResources {
dependsOn 'copyNativeLibs'
}
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = 'lbug'
description = 'Lbug is an embedded graph database built for query speed and scalability.'
url = 'http://ladybugdb.com'
inceptionYear = '2020'
properties = [
'project.build.sourceEncoding' : 'UTF-8',
'project.reporting.outputEncoding': 'UTF-8',
'java.version' : '21',
'maven.compiler.source' : '21',
'maven.compiler.target' : '21'
]
licenses {
license {
name = 'MIT License'
url = 'https://github.com/LadybugDB/ladybug/blob/master/LICENSE'
}
}
developers {
developer {
id = 'ladybugdb'
name = 'LadybugDB'
email = 'social@ladybugdb.com'
}
}
scm {
connection = 'scm:git:git://github.com/LadybugDB/ladybug.git'
developerConnection = 'scm:git:ssh://github.com/LadybugDB/ladybug.git'
url = 'https://github.com/LadybugDB/ladybug'
}
}
from components.java
}
}
repositories {
// The local repository is used for manual publishing to Maven Central
// Portal. It is located in `build/repo`.
// To publish, run `././gradlew publishMavenJavaToLocalRepo`
// This is a workaround to force Gradle handle signing and checksum
maven {
name = 'LocalRepo'
url = uri("$buildDir/repo")
}
maven {
name = 'GitHubPackages'
url = uri('https://maven.pkg.github.com/LadybugDB/ladybug')
credentials {
username = System.getenv('GITHUB_ACTOR')
password = System.getenv('GITHUB_TOKEN')
}
}
}
}
signing {
def signingKey = providers
.environmentVariable("GPG_SIGNING_KEY")
def signingPassphrase = providers
.environmentVariable("GPG_SIGNING_PASSPHRASE")
if (signingKey.isPresent() && signingPassphrase.isPresent()) {
useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
sign publishing.publications.mavenJava
} else {
println "Skipping signing, no GPG key found"
}
}
task cmake(type: Exec) {
workingDir '../..'
commandLine 'make', 'java'
environment NUM_THREADS: Runtime.getRuntime().availableProcessors()
}
task copyNativeLibs(type: Copy) {
from('build') {
include 'liblbug_java_native.*'
}
into 'src/main/resources'
dependsOn 'cmake'
}
tasks.sourcesJar {
mustRunAfter 'copyNativeLibs'
}
test {
useJUnitPlatform()
systemProperty 'ladybug.projectDir', projectDir.absolutePath
testLogging {
events 'passed', 'skipped', 'failed'
exceptionFormat = 'full'
showStandardStreams = true
}
jvmArgs(
'-XX:+UnlockDiagnosticVMOptions',
"-XX:ErrorFile=${layout.buildDirectory.file('hs_err_pid%p.log').get().asFile.absolutePath}",
'-XX:+CreateCoredumpOnCrash'
)
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}