-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
203 lines (183 loc) · 6.47 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
198
199
200
201
202
203
plugins {
id "io.freefair.aggregate-javadoc" version "8.6"
}
group 'com.viam'
version '0.0.9'
repositories {
google()
mavenLocal()
mavenCentral()
}
dependencies {
javadoc project(':core:viam-core-sdk')
javadoc project(':core:services:viam-core-sdk-mlmodel-service')
javadoc project(':java:viam-java-sdk')
}
subprojects {
group = rootProject.group
version = rootProject.version
apply plugin: 'maven-publish'
apply plugin: 'signing'
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
}
}
repositories {
google()
mavenLocal()
mavenCentral()
}
ext {
min_api = 29
target_api = 34
api_version = "unreleased"
File file = rootProject.file("api_version.lock")
file.withReader { reader -> api_version = reader.readLine() }
}
def pomConfig = {
url "https://github.com/viamrobotics/viam-java-sdk"
licenses {
license {
name "The Apache Software License, Version 2.0"
url "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers {
developer {
id "viam"
name "Viam"
email "[email protected]"
}
}
scm {
url "https://github.com/viamrobotics/viam-java-sdk"
}
}
afterEvaluate { project ->
if (project.name.contains("example")) {
return
}
if (project.plugins.hasPlugin("groovy-gradle-plugin")) {
return
}
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
if (project.plugins.hasPlugin("java")) {
compileTestJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
javadoc {
title = "$project.name $version"
options.addStringOption("source", "11")
options.author true
options.author = true
options.version = true
options.links 'https://docs.oracle.com/en/java/javase/11/docs/api/'
options.encoding = 'UTF-8'
options.charSet 'UTF-8'
options.docEncoding 'UTF-8'
exclude '**/index.html', '**/*.kt', '**/test*/**'
}
tasks.register('sourcesJar', Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
tasks.register('javadocJar', Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
def root = asNode()
def displayName = project.properties.get("pomDisplayName", project.name)
root.appendNode('name', "Viam Java/Android SDK - $displayName")
root.appendNode('description', "Viam Java/Android SDK - $displayName")
root.children().last() + pomConfig
}
}
}
repositories {
maven {
name = "OSSRH"
credentials {
username = findProperty("ossrhUsername")
password = findProperty("ossrhPassword")
}
if (version.endsWith('SNAPSHOT')) {
url = snapshotsRepoUrl
} else {
url = releasesRepoUrl
}
}
}
}
signing {
required { !System.getenv("DONT_SIGN") }
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
}
if (project.plugins.hasPlugin("com.android.library")) {
publishing {
publications {
maven(MavenPublication) {
groupId = groupId
artifactId = project.name
version = version
pom.withXml {
def root = asNode()
def displayName = project.properties.get("pomDisplayName", project.name)
root.appendNode('name', "Viam Java/Android SDK - $displayName")
root.appendNode('description', "Viam Java/Android SDK - $displayName")
root.children().last() + pomConfig
}
afterEvaluate {
from components.default
}
}
}
repositories {
maven {
name = "OSSRH"
credentials {
username = findProperty("ossrhUsername")
password = findProperty("ossrhPassword")
}
if (version.endsWith('SNAPSHOT')) {
url = snapshotsRepoUrl
} else {
url = releasesRepoUrl
}
}
}
}
signing {
required { !System.getenv("DONT_SIGN") }
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
}
}
tasks.register("install") {
dependsOn 'publishToMavenLocal'
}
}
tasks.register('printVersion') {
doLast {
println project.version
}
}