finalizing the maven central release.
This commit is contained in:
parent
4b30ce12c9
commit
330be87338
130
build.gradle
130
build.gradle
|
@ -1,6 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id "jacoco"
|
id "jacoco"
|
||||||
|
id "com.vanniktech.maven.publish" version "0.28.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
|
@ -20,12 +21,17 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
archivesBaseName = 'Primitive Collections'
|
archivesBaseName = 'Primitive Collections'
|
||||||
version = '0.9.0';
|
version = RELEASE_VERSION;
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current();
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current();
|
||||||
|
|
||||||
System.out.println("Java Version: "+compileJava.sourceCompatibility)
|
System.out.println("Java Version: "+compileJava.sourceCompatibility)
|
||||||
|
|
||||||
|
java {
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
options.tags = [ "implSpec", "note" ]
|
options.tags = [ "implSpec", "note" ]
|
||||||
}
|
}
|
||||||
|
@ -100,26 +106,12 @@ task generateLimitSource(type: JavaExec) {
|
||||||
args = ['silent', 'load']
|
args = ['silent', 'load']
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar) {
|
|
||||||
from javadoc
|
|
||||||
archiveClassifier = 'javadoc'
|
|
||||||
}
|
|
||||||
|
|
||||||
task srcJar(type: Jar) {
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
archiveClassifier = 'sources'
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava.dependsOn generateGithubSource
|
compileJava.dependsOn generateGithubSource
|
||||||
|
|
||||||
javadoc.failOnError = false
|
javadoc.failOnError = false
|
||||||
javadoc.options.memberLevel = JavadocMemberLevel.PUBLIC
|
javadoc.options.memberLevel = JavadocMemberLevel.PUBLIC
|
||||||
javadoc.options.quiet()
|
javadoc.options.quiet()
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives javadocJar
|
|
||||||
archives srcJar
|
|
||||||
}
|
|
||||||
|
|
||||||
task testBooleans(type: Test) {
|
task testBooleans(type: Test) {
|
||||||
group 'tests'
|
group 'tests'
|
||||||
|
@ -269,40 +261,18 @@ jacocoTestReport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task publishToMavenCentral() {
|
|
||||||
dependsOn publish
|
|
||||||
group 'publishing'
|
|
||||||
description 'Publishes to Maven Central'
|
|
||||||
doLast {
|
|
||||||
System.out.println("Published To Maven Central")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def isPublishingToMavenCentral() {
|
|
||||||
return gradle.startParameter.taskNames.contains('publishToMavenCentral');
|
|
||||||
}
|
|
||||||
|
|
||||||
signing {
|
|
||||||
if(isPublishingToMavenCentral()) {
|
|
||||||
useGpgCmd()
|
|
||||||
sign configurations.archives
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
def isMavenCentral = isPublishingToMavenCentral()
|
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
personal(MavenPublication) {
|
||||||
pom {
|
pom {
|
||||||
name = 'Primitive Collections'
|
name = 'Primitive Collections'
|
||||||
description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
||||||
url = 'https://github.com/Speiger/Primitive-Collections'
|
url = 'https://github.com/Speiger/Primitive-Collections'
|
||||||
version = project.version
|
version = project.version
|
||||||
artifactId = project.archivesBaseName.replace(" ", "-")
|
artifactId = project.archivesBaseName.replace(" ", "-")
|
||||||
groupId = isMavenCentral ? 'io.github.speiger' : 'de.speiger'
|
groupId = 'de.speiger'
|
||||||
from components.java
|
from components.java
|
||||||
artifact tasks.srcJar
|
|
||||||
artifact tasks.javadocJar
|
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name = 'The Apache License, Version 2.0'
|
name = 'The Apache License, Version 2.0'
|
||||||
|
@ -327,15 +297,7 @@ publishing {
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
if(isMavenCentral) {
|
name = "Speiger_Maven"
|
||||||
def auth = System.getenv("Maven_Central_Auth")?.split(';');
|
|
||||||
url version.endsWith('SNAPSHOT') ? "https://s01.oss.sonatype.org/content/repositories/snapshots/" : "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
|
||||||
credentials {
|
|
||||||
username auth?[0]
|
|
||||||
password auth?[1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
def auth = System.getenv("Speiger_Maven_Auth")?.split(';');
|
def auth = System.getenv("Speiger_Maven_Auth")?.split(';');
|
||||||
url version.endsWith('SNAPSHOT') ? "https://maven.speiger.com/repository/debug" : "https://maven.speiger.com/repository/main"
|
url version.endsWith('SNAPSHOT') ? "https://maven.speiger.com/repository/debug" : "https://maven.speiger.com/repository/main"
|
||||||
credentials(PasswordCredentials) {
|
credentials(PasswordCredentials) {
|
||||||
|
@ -344,5 +306,77 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(PublishToMavenRepository) {
|
||||||
|
def predicate = provider {
|
||||||
|
(repository == publishing.repositories.mavenCentral && publication == publishing.publications.maven) ||
|
||||||
|
(repository != publishing.repositories.mavenCentral && publication != publishing.publications.maven)
|
||||||
|
}
|
||||||
|
onlyIf("publishing binary to the external repository, or binary and sources to the internal one") {
|
||||||
|
predicate.get()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(PublishToMavenLocal) {
|
||||||
|
def predicate = provider {
|
||||||
|
publication == publishing.publications.personal
|
||||||
|
}
|
||||||
|
onlyIf("publishing binary and sources") {
|
||||||
|
predicate.get()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Maven central Start
|
||||||
|
import com.vanniktech.maven.publish.SonatypeHost
|
||||||
|
signing.useGpgCmd()
|
||||||
|
|
||||||
|
import com.vanniktech.maven.publish.JavaLibrary
|
||||||
|
import com.vanniktech.maven.publish.JavadocJar
|
||||||
|
|
||||||
|
mavenPublishing {
|
||||||
|
// the first parameter configures the -javadoc artifact, possible values:
|
||||||
|
// - `JavadocJar.None()` don't publish this artifact
|
||||||
|
// - `JavadocJar.Empty()` publish an emprt jar
|
||||||
|
// - `JavadocJar.Javadoc()` to publish standard javadocs
|
||||||
|
// the second whether to publish a sources jar
|
||||||
|
configure(new JavaLibrary(new JavadocJar.None(), true))
|
||||||
|
}
|
||||||
|
|
||||||
|
mavenPublishing {
|
||||||
|
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
|
||||||
|
|
||||||
|
signAllPublications()
|
||||||
|
pom {
|
||||||
|
name = 'Primitive Collections'
|
||||||
|
description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
||||||
|
url = 'https://github.com/Speiger/Primitive-Collections'
|
||||||
|
version = project.version
|
||||||
|
group = 'io.github.speiger'
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = 'The Apache License, Version 2.0'
|
||||||
|
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = 'speiger'
|
||||||
|
name = 'Speiger'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scm {
|
||||||
|
connection = 'scm:git:git://github.com/Speiger/Primitive-Collections.git'
|
||||||
|
developerConnection = 'scm:git:ssh://github.com/Speiger/Primitive-Collections.git'
|
||||||
|
url = 'https://github.com/Speiger/Primitive-Collections'
|
||||||
|
}
|
||||||
|
|
||||||
|
issueManagement {
|
||||||
|
system = 'github'
|
||||||
|
url = 'https://github.com/Speiger/Primitive-Collections/issues'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,3 +2,5 @@ org.gradle.jvmargs=-Xmx3G
|
||||||
|
|
||||||
maxMemory = 1024m
|
maxMemory = 1024m
|
||||||
testThreads = 4
|
testThreads = 4
|
||||||
|
|
||||||
|
RELEASE_VERSION = '0.9.0'
|
Loading…
Reference in New Issue