11buildscript {
22 repositories {
33 mavenCentral()
4+ maven {
5+ url " https://plugins.gradle.org/m2/"
6+ }
47 }
58 dependencies {
69 classpath ' com.android.tools.build:gradle:2.3.+'
@@ -11,25 +14,48 @@ buildscript {
1114
1215plugins {
1316 id ' java'
17+ id ' scala'
18+ id ' java-library'
1419 id " com.github.johnrengelman.shadow" version " 7.1.2"
20+ id ' io.codearte.nexus-staging' version ' 0.30.0'
21+ id ' signing'
1522}
1623
1724apply plugin : ' idea'
1825apply plugin : ' eclipse'
1926apply plugin : ' java'
2027apply plugin : ' com.diffplug.spotless'
2128
29+ group ' io.tiledb'
2230version = ' 0.0.1'
2331
2432jar. enabled = false
2533
2634repositories {
2735 mavenCentral()
36+ maven {
37+ url " https://oss.sonatype.org/content/repositories/snapshots"
38+ }
39+ mavenLocal()
2840}
41+
42+ tasks. jar. configure {
43+ classifier = ' default'
44+ }
45+
46+ tasks. shadowJar. configure {
47+ classifier = null
48+ }
49+
2950sourceSets {
3051 main. java. srcDirs = [' src/main/java' ]
3152}
3253
54+ nexusStaging {
55+ username = System . getenv(' SONATYPE_USERNAME' )
56+ password = System . getenv(' SONATYPE_PASSWORD' )
57+ }
58+
3359
3460if (hasProperty(' target' ) && target == ' android' ) {
3561
@@ -158,3 +184,80 @@ spotless {
158184 importOrder()
159185 }
160186}
187+
188+
189+ import org.gradle.plugins.signing.Sign
190+ gradle. taskGraph. whenReady { taskGraph ->
191+ if (taskGraph. allTasks. any { it instanceof Sign }) {
192+ allprojects { ext. " signing.keyId" = System . getenv(' GPG_KEY_ID' ) }
193+ allprojects { ext. " signing.secretKeyRingFile" = System . getenv(' GPG_KEY_LOCATION' ) }
194+ allprojects { ext. " signing.password" = System . getenv(' GPG_PASSPHRASE' ) }
195+ }
196+ // Do not sign archives by default (a local build without gpg keyring should succeed)
197+ if (taskGraph. allTasks. any { it. name == ' build' || it. name == ' assemble' || it. name == ' publishToMavenLocal' }) {
198+ tasks. findAll { it. name == ' signArchives' || it. name == ' signDocsJar' || it. name == ' signTestJar' || it. name == ' signMavenJavaPublication' }. each { task ->
199+ task. enabled = false
200+ }
201+ }
202+ }
203+
204+ task sourceJar (type : Jar ) {
205+ classifier " sources"
206+ from sourceSets. main. allJava
207+ }
208+
209+ artifacts {
210+ archives jar
211+ archives sourceJar
212+ }
213+
214+ publishing {
215+ publications {
216+ mavenJava(MavenPublication ) {
217+ artifact jar
218+ artifact sourceJar
219+
220+ pom {
221+ name = ' TileDB Cloud Java'
222+ description = ' The Java client for the TileDB Cloud Service'
223+ url = ' https://github.com/TileDB-Inc/TileDB-Cloud-Java'
224+ licenses {
225+ license {
226+ name = ' The MIT License (MIT)'
227+ url = ' https://github.com/TileDB-Inc/TileDB-Cloud-Java/blob/master/LICENSE'
228+ }
229+ }
230+ scm {
231+ connection = ' scm:git:https://github.com/TileDB-Inc/TileDB-Cloud-Java.git'
232+ developerConnection
= ' scm:git:ssh://[email protected] /TileDB-Inc/TileDB-Cloud-Java' 233+ url = ' https://github.com/TileDB-Inc/TileDB-Cloud-Java'
234+ }
235+ developers {
236+ developer {
237+ name = ' TileDB, Inc'
238+ 239+ organization = ' TileDB, Inc.'
240+ organizationUrl = ' https://tiledb.com/'
241+ }
242+ }
243+ }
244+ }
245+ }
246+
247+ repositories {
248+ maven {
249+ def releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
250+ def snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
251+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
252+ credentials {
253+ username System . getenv(' SONATYPE_USERNAME' )
254+ password System . getenv(' SONATYPE_PASSWORD' )
255+ }
256+ }
257+ }
258+ }
259+
260+ signing {
261+ sign publishing. publications. mavenJava
262+ sign configurations. archives
263+ }
0 commit comments