Skip to content

Commit f9d24a0

Browse files
Upload to Maven additions to build.gradle
1 parent f3939af commit f9d24a0

File tree

1 file changed

+104
-2
lines changed

1 file changed

+104
-2
lines changed

build.gradle

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
buildscript {
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,47 @@ buildscript {
1114

1215
plugins {
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

1724
apply plugin: 'idea'
1825
apply plugin: 'eclipse'
1926
apply plugin: 'java'
2027
apply plugin: 'com.diffplug.spotless'
2128

29+
group 'io.tiledb'
2230
version = '0.0.1'
2331

24-
jar.enabled = false
25-
2632
repositories {
2733
mavenCentral()
34+
maven {
35+
url "https://oss.sonatype.org/content/repositories/snapshots"
36+
}
37+
mavenLocal()
38+
}
39+
40+
tasks.shadowJar.configure {
41+
classifier = null
2842
}
43+
44+
tasks.jar.configure {
45+
classifier = 'default'
46+
}
47+
48+
2949
sourceSets {
3050
main.java.srcDirs = ['src/main/java']
3151
}
3252

53+
nexusStaging {
54+
username = System.getenv('SONATYPE_USERNAME')
55+
password = System.getenv('SONATYPE_PASSWORD')
56+
}
57+
3358

3459
if(hasProperty('target') && target == 'android') {
3560

@@ -158,3 +183,80 @@ spotless {
158183
importOrder()
159184
}
160185
}
186+
187+
188+
import org.gradle.plugins.signing.Sign
189+
gradle.taskGraph.whenReady { taskGraph ->
190+
if (taskGraph.allTasks.any { it instanceof Sign }) {
191+
allprojects { ext."signing.keyId" = System.getenv('GPG_KEY_ID') }
192+
allprojects { ext."signing.secretKeyRingFile" = System.getenv('GPG_KEY_LOCATION') }
193+
allprojects { ext."signing.password" = System.getenv('GPG_PASSPHRASE') }
194+
}
195+
// Do not sign archives by default (a local build without gpg keyring should succeed)
196+
if (taskGraph.allTasks.any { it.name == 'build' || it.name == 'assemble' || it.name == 'publishToMavenLocal'}) {
197+
tasks.findAll { it.name == 'signArchives' || it.name == 'signDocsJar' || it.name == 'signTestJar' || it.name == 'signMavenJavaPublication'}.each { task ->
198+
task.enabled = false
199+
}
200+
}
201+
}
202+
203+
task sourceJar(type: Jar) {
204+
classifier "sources"
205+
from sourceSets.main.allJava
206+
}
207+
208+
artifacts {
209+
archives jar
210+
archives sourceJar
211+
}
212+
213+
publishing {
214+
publications {
215+
mavenJava(MavenPublication) {
216+
artifact jar
217+
artifact sourceJar
218+
219+
pom {
220+
name = 'TileDB Cloud Java'
221+
description = 'The Java client for the TileDB Cloud Service'
222+
url = 'https://github.com/TileDB-Inc/TileDB-Cloud-Java'
223+
licenses {
224+
license {
225+
name = 'The MIT License (MIT)'
226+
url = 'https://github.com/TileDB-Inc/TileDB-Cloud-Java/blob/master/LICENSE'
227+
}
228+
}
229+
scm {
230+
connection = 'scm:git:https://github.com/TileDB-Inc/TileDB-Cloud-Java.git'
231+
developerConnection = 'scm:git:ssh://[email protected]/TileDB-Inc/TileDB-Cloud-Java'
232+
url = 'https://github.com/TileDB-Inc/TileDB-Cloud-Java'
233+
}
234+
developers {
235+
developer {
236+
name = 'TileDB, Inc'
237+
238+
organization = 'TileDB, Inc.'
239+
organizationUrl = 'https://tiledb.com/'
240+
}
241+
}
242+
}
243+
}
244+
}
245+
246+
repositories {
247+
maven {
248+
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
249+
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
250+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
251+
credentials {
252+
username System.getenv('SONATYPE_USERNAME')
253+
password System.getenv('SONATYPE_PASSWORD')
254+
}
255+
}
256+
}
257+
}
258+
259+
signing {
260+
sign publishing.publications.mavenJava
261+
sign configurations.archives
262+
}

0 commit comments

Comments
 (0)