forked from objectbox/objectbox-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
166 lines (146 loc) · 6 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
// Just too many sub projects, so each can reference rootProject.version
version = ob_version
buildscript {
ext {
ob_version = '2.2.0'
ob_native_version = ob_version // Be careful to diverge here; easy to forget and hard to find JNI problems
ob_expected_version = project.hasProperty('expectedVersion') ? project.property('expectedVersion') : 'UNDEFINED'
isLinux = System.getProperty("os.name").contains("Linux")
isMac = !isLinux && System.getProperty("os.name").toLowerCase().contains("mac")
isWin = System.getProperty("os.name").toLowerCase().contains("windows")
is64 = System.getProperty("sun.arch.data.model") == "64"
isLinux64 = isLinux && is64
isMac64 = isMac && is64
isWin64 = isWin && is64
}
repositories {
jcenter()
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
def projectNamesToPublish = [
'objectbox-java-api',
'objectbox-java',
'objectbox-kotlin',
'objectbox-rxjava'
]
configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
apply plugin: 'maven'
apply plugin: 'signing'
configurations {
deployerJars
}
dependencies {
deployerJars 'org.apache.maven.wagon:wagon-webdav:1.0-beta-2'
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.2'
}
signing {
if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') &&
project.hasProperty('signing.secretKeyRingFile')) {
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 {
if (project.hasProperty('preferedRepo') && preferedRepo == 'local') {
repository url: repositories.mavenLocal().url
} else if (project.hasProperty('preferedRepo') && project.hasProperty('preferedUsername')
&& project.hasProperty('preferedPassword')) {
configuration = configurations.deployerJars
// Replace for bintray's dynamic URL
preferedRepo = preferedRepo.replace('__groupId__', project.group)
preferedRepo = preferedRepo.replace('__artifactId__', project.archivesBaseName)
// println preferedRepo
repository(url: preferedRepo) {
authentication(userName: preferedUsername, password: preferedPassword)
}
} 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)
}
} else {
println "Settings sonatypeUsername/sonatypePassword missing/incomplete for ${project.name}"
}
pom.project {
packaging 'jar'
url 'http://objectbox.io'
scm {
url 'https://github.com/objectbox/objectbox-java'
connection 'scm:[email protected]:objectbox/objectbox-java.git'
developerConnection 'scm:[email protected]: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 'http://objectbox.io'
}
}
}
}
}
}
}
// this task is also used by the composite build ('objectbox-deploy'), check before making changes
task installAll {
group 'deploy'
dependsOn ':objectbox-java-api:install'
dependsOn ':objectbox-java:install'
dependsOn ':objectbox-kotlin:install'
dependsOn ':objectbox-rxjava:install'
doLast {
println("Installed version $version")
}
}
// this task is also used by the composite build ('objectbox-deploy'), check before making changes
task deployAll {
group 'deploy'
dependsOn ':objectbox-java-api:uploadArchives'
dependsOn ':objectbox-java:uploadArchives'
dependsOn ':objectbox-kotlin:uploadArchives'
dependsOn ':objectbox-rxjava:uploadArchives'
}
// this task is also used by the composite build ('objectbox-deploy'), check before making changes
task verifyVersion {
group 'verify'
dependsOn ':objectbox-java:verifyVersion'
doLast {
assert ob_expected_version == version
}
}
task wrapper(type: Wrapper) {
group 'build setup'
gradleVersion = '4.5.1'
distributionType = Wrapper.DistributionType.ALL
}