Skip to content
This repository was archived by the owner on Feb 25, 2024. It is now read-only.

Commit 2a38d42

Browse files
committed
Update Gradle settings
1 parent 303e1aa commit 2a38d42

3 files changed

Lines changed: 69 additions & 53 deletions

File tree

build.gradle

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
buildscript {
2+
repositories.gradlePluginPortal()
3+
dependencies.classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.20.0"
4+
}
5+
16
apply plugin: 'java-library'
7+
apply plugin: 'groovy'
28

39
group 'de.kaleidox'
4-
version '0.3.2-SHNAPSHOT'
10+
version '0.3.2'
11+
12+
apply from: 'gradle/vars.gradle'
513

614
sourceCompatibility = 1.7
715
targetCompatibility = 1.7
@@ -11,29 +19,36 @@ task wrapper(type: Wrapper) {
1119
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
1220
}
1321

22+
task sourcesJar(type: Jar) {
23+
from sourceSets.main.allJava
24+
classifier = "sources"
25+
}
26+
27+
task javadocJar(type: Jar) {
28+
javadoc
29+
from javadoc.destinationDir
30+
classifier = "javadoc"
31+
}
32+
1433
javadoc {
1534
source = sourceSets.main.java
1635
options.encoding = 'UTF-8'
1736
options.destinationDirectory(file("./docs/"))
1837
}
1938

39+
compileJava.options.encoding = 'UTF-8'
2040
repositories.jcenter()
2141

2242
dependencies {
23-
compileOnly 'com.intellij:annotations:12.0'
24-
25-
testImplementation "junit:junit:4.12"
26-
}
43+
compileOnly 'org.jetbrains:annotations:17.0.0'
2744

28-
sourceSets {
29-
main.java.srcDirs = ["src/main/java"]
30-
test.java.srcDirs = ["src/test/java"]
45+
testImplementation 'junit:junit:4.12'
46+
testCompile 'org.codehaus.groovy:groovy-all:2.4.14'
3147
}
3248

33-
if (!isTravis()) {
34-
apply from: 'gradle/publishing.gradle'
49+
sourceSets {
50+
main.java.srcDirs = ["src\\main\\java"]
51+
test.groovy.srcDirs = ["src\\test\\groovy"]
3552
}
3653

37-
static boolean isTravis() {
38-
return System.getenv().containsKey("TRAVIS")
39-
}
54+
apply from: 'gradle/publishing.gradle'

gradle/publishing.gradle

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
11
apply plugin: 'maven-publish'
22
apply plugin: 'signing'
3+
apply plugin: "io.codearte.nexus-staging"
34

45
publishing {
5-
boolean snapshotPublication = rootProject.version.endsWith("SNAPSHOT")
6+
test
67

78
repositories {
89
maven {
9-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
10-
def releasesRepoUrl = "https://oss.sonatype.org/content/repositories/releases"
11-
url = snapshotPublication ? snapshotsRepoUrl : releasesRepoUrl
10+
url = snapshot
11+
? "https://oss.sonatype.org/content/repositories/snapshots"
12+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2"
1213
name = "Sonatype"
1314

1415
credentials {
15-
def uName = ""
16-
def passwd = ""
17-
int r
18-
def stream = new FileInputStream(fileOrTempFile(".credentials/sonatype-username.cred"))
19-
while ((r = stream.read()) != -1) uName = (uName + (char) r)
20-
stream = new FileInputStream(fileOrTempFile(".credentials/sonatype-password.cred"))
21-
while ((r = stream.read()) != -1) passwd = (passwd + (char) r)
22-
23-
username uName
24-
password passwd
16+
username sonatypeUsername
17+
password sonatypePassword
2518
}
2619
}
2720
}
2821

2922
publications {
3023
mavenJava(MavenPublication) {
31-
artifactId = 'vban-api'
32-
artifact jar
33-
version = rootProject.version
34-
24+
artifactId = artifactName
25+
from components.java
26+
27+
artifact sourcesJar
28+
artifact javadocJar
29+
3530
pom {
36-
name = "VBAN-API"
37-
description = "Java Library for handling VB-Audio's VBAN API"
31+
name = projectName
32+
description = projectDescription
3833
inceptionYear = '2019'
3934

4035
licenses {
@@ -51,32 +46,24 @@ publishing {
5146
email = "burdoto@outlook.com"
5247
}
5348
}
54-
55-
scm {
56-
connection = 'scm:git:https://github.com/burdoto/VBAN-API/VBAN-API.git'
57-
developerConnection = 'scm:git:git@github.com:burdoto/VBAN-API.git'
58-
url = 'https://github.com/burdoto/VBAN-API'
59-
}
60-
61-
issueManagement {
62-
system = 'GitHub'
63-
url = 'https://github.com/burdoto/VBAN-API/issues'
64-
}
6549
}
6650
}
6751
}
6852
}
6953

54+
task generateGitHubPom(type: GenerateMavenPom) {
55+
destination = "pom.xml"
56+
pom = publishing.publications.mavenJava.pom
57+
}
58+
7059
signing {
71-
if (new File(".credentials/sonatype-password.cred").exists()) {
72-
useGpgCmd()
73-
for (def pub : publishing.publications)
74-
sign pub
75-
}
60+
useGpgCmd()
61+
sign publishing.publications.mavenJava
7662
}
7763

78-
static File fileOrTempFile(String name) {
79-
def file = new File(name)
80-
if (file.exists()) return file
81-
return File.createTempFile(name, "")
64+
tasks.removeAll([promoteRepository, closeAndPromoteRepository, getStagingProfile])
65+
66+
nexusStaging {
67+
username sonatypeUsername
68+
password sonatypePassword
8269
}

gradle/vars.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import static java.lang.System.getenv
2+
3+
ext {
4+
artifactName = "vban"
5+
projectName = "VBAN-API"
6+
projectDescription = "Java 7 compatible Library for communicating with the VB-Audio VBAN interface"
7+
8+
snapshot = project.version.endsWith("-SNAPSHOT")
9+
10+
sonatypeUsername = getenv("sonatypeUsername")
11+
sonatypePassword = getenv("sonatypePassword")
12+
}
13+
14+
ext."signing.password" = getenv("gpgKeyPassword")

0 commit comments

Comments
 (0)