-
Notifications
You must be signed in to change notification settings - Fork 32
/
build.gradle
146 lines (126 loc) · 3.81 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
import org.gradle.internal.jvm.Jvm
plugins {
id 'java-library'
id 'c'
id 'maven-publish'
}
group "cloud.unum.ustore"
version = file("VERSION").text.trim()
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDir "java/"
exclude "test/"
}
}
test {
java {
srcDir "java/test"
}
}
}
dependencies {
testImplementation('junit:junit:4.13.2')
}
model {
buildTypes{
ucset
rocksdb
leveldb
}
components {
ustore(NativeLibrarySpec) {
sources {
c {
source {
srcDirs "java/cloud/unum/ustore"
include "**/*.c"
}
exportedHeaders {
srcDirs "include", "${Jvm.current().javaHome}/include"
}
}
}
binaries.withType(StaticLibraryBinarySpec) {
buildable = false
}
binaries.withType(SharedLibraryBinarySpec) {
if (targetPlatform.operatingSystem.linux) {
cCompiler.args '-I', "${Jvm.current().javaHome}/include/linux"
cCompiler.args '-D_FILE_OFFSET_BITS=64'
}
if (buildType == buildTypes.ucset) {
linker.args '-L', "${projectDir}/build/lib", "-l", "ustore_ucset_bundle", "-l", "c"
} else if (buildType == buildTypes.rocksdb) {
linker.args '-L', "${projectDir}/build/lib", "-l", "ustore_rocksdb_bundle", "-l", "c"
} else if (buildType == buildTypes.leveldb) {
linker.args '-L', "${projectDir}/build/lib", "-l", "ustore_leveldb_bundle", "-l", "c"
}
}
}
}
}
test {
forkEvery 1
dependsOn jar
// Rearrange test classpath, add compiled JAR instead of main classes
classpath = project.sourceSets.test.output + configurations.testRuntimeClasspath + files(jar.archiveFile)
}
jar {
dependsOn("ustoreUcsetSharedLibrary")
dependsOn("ustoreRocksdbSharedLibrary")
dependsOn("ustoreLeveldbSharedLibrary")
into("ucset") {
from("$buildDir/libs/ustore/shared/ucset/libustore.so")
}
into("rocksdb") {
from("$buildDir/libs/ustore/shared/rocksdb/libustore.so")
}
into("leveldb") {
from("$buildDir/libs/ustore/shared/leveldb/libustore.so")
}
}
publishing {
publications {
library(MavenPublication) {
from components.java
pom {
name = "UStore"
description = "Universal Key-Value store interface for both in-memory and persistent transactional collections for Java"
url = "https://github.com/unum-cloud/ustore"
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
// Publishing to GitHub is much easier ;)
// repositories {
// maven {
// name = "OSSRH"
// url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
// credentials {
// username = System.getenv("MAVEN_USERNAME")
// password = System.getenv("MAVEN_PASSWORD")
// }
// }
// }
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/unum-cloud/ustore"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}