forked from objectbox/objectbox-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
187 lines (158 loc) · 6.99 KB
/
Copy pathbuild.gradle
File metadata and controls
187 lines (158 loc) · 6.99 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
175
176
177
178
179
180
181
182
183
184
185
186
187
buildscript {
ext {
// Typically, only edit those two:
def objectboxVersionNumber = '2.6.0' // without "-SNAPSHOT", e.g. '2.5.0' or '2.4.0-RC'
def objectboxVersionRelease = true // set to true for releasing to ignore versionPostFix to avoid e.g. "-dev" versions
// version post fix: '-<value>' or '' if not defined; e.g. used by CI to pass in branch name
def versionPostFixValue = project.findProperty('versionPostFix')
def versionPostFix = versionPostFixValue ? "-$versionPostFixValue" : ''
ob_version = objectboxVersionNumber + (objectboxVersionRelease? "" : "$versionPostFix-SNAPSHOT")
// Native library version for tests
// Be careful to diverge here; easy to forget and hard to find JNI problems
def nativeVersion = objectboxVersionNumber + (objectboxVersionRelease? "": "-dev-SNAPSHOT")
def osName = System.getProperty("os.name").toLowerCase()
def objectboxPlatform = osName.contains('linux') ? 'linux'
: osName.contains("windows")? 'windows'
: osName.contains("mac")? 'macos'
: 'unsupported'
ob_native_dep = "io.objectbox:objectbox-$objectboxPlatform:$nativeVersion"
junit_version = '4.13'
mockito_version = '3.3.3'
kotlin_version = '1.3.72'
dokka_version = '0.10.1'
println "version=$ob_version"
println "objectboxNativeDependency=$ob_native_dep"
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.0.5"
}
}
allprojects {
group = 'io.objectbox'
version = ob_version
repositories {
mavenCentral()
jcenter()
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' // SNAPSHOTS
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
def projectNamesToPublish = [
'objectbox-java-api',
'objectbox-java',
'objectbox-kotlin',
'objectbox-rxjava',
'objectbox-rxjava3'
]
def hasSigningProperties() {
return (project.hasProperty('signingKeyId')
&& project.hasProperty('signingKeyFile')
&& project.hasProperty('signingPassword'))
}
configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
apply plugin: 'maven'
apply plugin: 'signing'
configurations {
deployerJars
}
dependencies {
// Using an older version to remain compatible with Wagon API used by Gradle/Maven
deployerJars 'org.apache.maven.wagon:wagon-webdav-jackrabbit:3.2.0'
deployerJars 'org.apache.maven.wagon:wagon-ftp:3.3.2'
}
signing {
if (hasSigningProperties()) {
String signingKey = new File(signingKeyFile).text
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign configurations.archives
} else {
println "Signing information missing/incomplete for ${project.name}"
}
}
// Use afterEvaluate or all dependencies will be lost in the generated POM
afterEvaluate {
uploadArchives {
repositories {
mavenDeployer {
def preferredRepo = project.findProperty('preferredRepo')
println "preferredRepo=$preferredRepo"
if (preferredRepo == 'local') {
repository url: repositories.mavenLocal().url
println "Uploading archives to mavenLocal()."
} else if (preferredRepo != null
&& project.hasProperty('preferredUsername')
&& project.hasProperty('preferredPassword')) {
if (!hasSigningProperties()) {
throw new InvalidUserDataException("To upload to repo signing is required.")
}
configuration = configurations.deployerJars
// replace placeholders
def repositoryUrl = preferredRepo
.replace('__groupId__', project.group)
.replace('__artifactId__', project.archivesBaseName)
repository(url: repositoryUrl) {
authentication(userName: preferredUsername, password: preferredPassword)
}
println "Uploading archives to $repositoryUrl."
} else if (project.hasProperty('sonatypeUsername')
&& project.hasProperty('sonatypePassword')) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
def isSnapshot = version.endsWith('-SNAPSHOT')
def sonatypeRepositoryUrl = isSnapshot
? "https://oss.sonatype.org/content/repositories/snapshots/"
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
repository(url: sonatypeRepositoryUrl) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
println "Uploading archives to $sonatypeRepositoryUrl."
} else {
println "WARNING: preferredRepo or credentials NOT set, can not upload archives."
}
pom.project {
packaging 'jar'
url 'https://objectbox.io'
scm {
url 'https://github.com/objectbox/objectbox-java'
connection 'scm:git@github.com:objectbox/objectbox-java.git'
developerConnection 'scm:git@github.com:objectbox/objectbox-java.git'
}
developers {
developer {
id 'ObjectBox'
name 'ObjectBox'
}
}
issueManagement {
system 'GitHub Issues'
url 'https://github.com/objectbox/objectbox-java/issues'
}
organization {
name 'ObjectBox Ltd.'
url 'https://objectbox.io'
}
}
}
}
}
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}