Skip to content

Commit

Permalink
Merge pull request #30 from asciidoctor/maven-central
Browse files Browse the repository at this point in the history
Maven central
  • Loading branch information
robertpanzer committed Mar 2, 2021
2 parents a0264fa + e4ad67d commit eed26f8
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 113 deletions.
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
java:
- '1.8'
- '11.0.5'
- '15'
os:
- ubuntu-latest
- macos-latest
Expand Down
56 changes: 36 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
buildscript {
repositories {
mavenLocal()
jcenter()
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}
}

plugins {
id "com.jfrog.bintray" version "1.8.4"
id "signing"
id "io.codearte.nexus-staging" version "0.22.0"
id "de.marcphilipp.nexus-publish" version "0.4.0"
}

apply plugin: 'groovy'
apply plugin: 'codenarc'
apply from: 'gradle/publish.gradle'
apply plugin: 'io.codearte.nexus-staging'


nexusStaging {
if (project.hasProperty("sonatypeUsername")) {
username = project.sonatypeUsername
}
if (project.hasProperty("sonatypePassword")) {
password = project.sonatypePassword
}
repositoryDescription = "Release ${project.group} ${project.version}"
}

group = 'org.asciidoctor'
description = 'A Groovy DSL for writing extensions for AsciidoctorJ'

ext {
projectArtifactId = 'asciidoctorj-groovy-dsl'
groupId = 'org.asciidoctor'

publicationName = 'asciidoctorjGroovyDsl'
groovyVer = '2.4.15'
}

apply plugin: 'groovy'
apply plugin: 'codenarc'
apply from: 'gradle/publish.gradle'
apply from: 'gradle/signing.gradle'


repositories {
jcenter()
// maven { url 'http://dl.bintray.com/lordofthejars/maven'}
mavenCentral()
}

dependencies {
Expand All @@ -44,13 +65,8 @@ codenarc {
sourceSets = [project.sourceSets.main]
}

task sourceJar(type: Jar) {
group 'Build'
description 'An archive of the source code'
classifier 'sources'
from sourceSets.main.allSource
java {
withJavadocJar()
withSourcesJar()
}

artifacts {
sourceJar
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=2.1.0-SNAPSHOT
version=2.0.1
sourceCompatibility=1.8
targetCompatibility=1.8
157 changes: 66 additions & 91 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,111 +21,86 @@ ext {
buildDate = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
}

apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'de.marcphilipp.nexus-publish'

def projectArtifactId = 'asciidoctorj-groovy-dsl'

jar {
manifest {
attributes(
'Built-By': System.properties['user.name'],
'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.getProperty("java.vm.version") + ")",
'Build-Date': project.buildTime,
'Build-Time': project.buildDate,
'Specification-Title': projectArtifactId,
'Specification-Version': project.version,
'Specification-Vendor': 'asciidoctor.org',
'Implementation-Title': projectArtifactId,
'Implementation-Version': project.version,
'Implementation-Vendor': 'asciidoctor.org'
)
}
}
publishing {
publications.create(project.ext.publicationName, MavenPublication) {

def pomConfig = {
name projectArtifactId
description 'A Groovy DSL that allows to define and register asciidoctor extensions using a DSL'
url 'http://asciidoctor.org'
inceptionYear '2014'
licenses {
license([:]) {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/robertpanzer/asciidoctorj-groovy-dsl'
}
developers {
developer {
id 'mojavelinux'
name 'Dan Allen'
roles {
role 'Asciidoctor Founder and Benevolent Dictator'
role 'Open Source Hero'
}
}
[
bobbytank42: 'Robert Panzer',
].each { devId, devName ->
developer {
id devId
name devName
roles {
role 'Developer'
from components.java

pom {
name = project.name
description = project.description
url = 'https://github.com/asciidoctor/asciidoctorj-groovy-dsl'
inceptionYear = '2014'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
}
}
contributors {
[
].each { devId, devName ->
contributor {
name devName
roles {
role 'contributor'
}
issueManagement {
system = 'github'
url = 'https://github.com/asciidoctor/asciidoctorj-groovy-dsl/issues'
}
scm {
url = 'https://github.com/asciidoctor/asciidoctorj-groovy-dsl'
}
}
}
}

afterEvaluate {
publishing {
publications {
mavenCustom(MavenPublication) {
from components.java
artifact sourceJar
setGroupId 'org.asciidoctor'
setArtifactId(projectArtifactId)
pom.withXml {
asNode().children().last() + pomConfig
developers {
developer {
id = 'mojavelinux'
name = 'Dan Allen'
email = '[email protected]'
timezone = '-7'
roles = ['Contributor']
}
developer {
id = 'robertpanzer'
name = 'Robert Panzer'
email = '[email protected]'
timezone = '1'
roles = ['Contributor']
}
}
}
}
}

task install(dependsOn: publishToMavenLocal)

if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = ''
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = ''

bintray {
user = project.bintrayUsername
key = project.bintrayApiKey

dryRun = project.hasProperty('dryRun') && project.dryRun.toBoolean()
jar {
manifest {
attributes(
'Built-By': System.properties['user.name'],
'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.getProperty("java.vm.version") + ")",
'Build-Date': project.buildTime,
'Build-Time': project.buildDate,
'Specification-Title': projectArtifactId,
'Specification-Version': project.version,
'Specification-Vendor': 'asciidoctor.org',
'Implementation-Title': projectArtifactId,
'Implementation-Version': project.version,
'Implementation-Vendor': 'asciidoctor.org'
)
}
}

publications = ['mavenCustom']
pkg {
repo = 'maven'
userOrg = 'asciidoctor'
name = projectArtifactId
desc = 'A Groovy DSL that allows to define and register asciidoctor extensions using a DSL'
licenses = ['Apache-2.0']
labels = ['groovy', 'asciidoctor']
publishing {
repositories {
maven {
name = "local"
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "${rootProject.buildDir}/repos/releases"
def snapshotsRepoUrl = "${rootProject.buildDir}/repos/snapshots"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
}
}
}

nexusPublishing {
repositories {
sonatype()
}
}
19 changes: 19 additions & 0 deletions gradle/signing.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def hasSigningKey = project.hasProperty("signing.keyId") || project.findProperty("signingKey")
if(hasSigningKey && !project.hasProperty('skip.signing')) {
apply plugin: 'signing'
sign(project)
}
void sign(Project project) {
project.signing {
required { project.gradle.taskGraph.hasTask("required") }
def signingKeyId = project.findProperty("signingKeyId")
def signingKey = project.findProperty("signingKey")
def signingPassword = project.findProperty("signingPassword")
if (signingKeyId) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
} else if (signingKey) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications[project.ext.publicationName]
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit eed26f8

Please sign in to comment.