Skip to content

Commit

Permalink
Issue #118, generate pom.xml and sign build artifacts.
Browse files Browse the repository at this point in the history
This is being done in preparation for publishing to maven central.

To ensure the ability to publish development versions of the library to
the local maven repository for developers that do not have the GPG keys
installed, we only attempt to sign the build artifacts when we are not
building a "-SNAPSHOT" version.
  • Loading branch information
dlurton committed Aug 14, 2019
1 parent 6f1fbe6 commit 0f0107a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 10 deletions.
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ allprojects {
}
}


subprojects {
version = '0.1.0'
group = 'org.partiql'
version = '0.1.0-SNAPSHOT'
}

buildDir = new File(rootProject.projectDir, "gradle-build/" + project.name)
Expand All @@ -49,7 +49,6 @@ configure(subprojects.findAll { it.name != 'example' }) {
}
}


subprojects {
plugins.withId('java', { _ ->
sourceSets {
Expand Down
69 changes: 62 additions & 7 deletions lang/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ plugins {
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm'
id 'io.gitlab.arturbosch.detekt'

id "signing"
}

version = '0.1.0'
group = 'org.partiql.lang'


tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
Expand Down Expand Up @@ -62,16 +63,70 @@ tasks.register('javadocJar', Jar) {

publishing {
publications {
create('maven', MavenPublication) {
artifactId = 'partiql-lang-kotlin'
maven(MavenPublication) {
// group id and version are set in the root build.gradle for all projects.
artifactId = "partiql-lang-kotlin"

from(components['java'])
artifact(tasks['sourcesJar'])
artifact(tasks['javadocJar'])
from components.java
artifact sourcesJar
artifact javadocJar

pom {
name = "PartiQL-Lang-Kotlin"
packaging = "jar"
url = "https://github.com/amzn/ion-schema-kotlin"
description = "An implementation of PartiQL for the JVM written in Kotlin."
scm {
connection = "scm:git@github.com:partiql/partiql-lang-kotlin.git"
developerConnection = "scm:git@github.com:partiql/partiql-lang-kotlin.git"
url = "git@github.com:partiql/partiql-lang-kotlin.git"
}
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name = "Amazon Ion Team"
email = "partiql-community@amazon.com"
organization = "PartiQL"
organizationUrl = "https://github.com/partiql"
}
}
}
}
}
repositories {
maven {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}

// The below enables developers and CI servers who do not have the GPG keys needed for signing to build locally,
// while also signing release builds.
// Signatures are only required when publishing to maven central anyway. We may need a more sophisticated means of
// determining if we should sign the build artifacts someday, but this should suffice for now.
if(!version.endsWith("SNAPSHOT")) {
println("""
*******************************************************************************
Note:
The build artifacts will be signed because this is NOT a SNAPSHOT version.
Signing will fail if you have not configured a ~/.gradle/gradle.properties
file with the correct values.
*******************************************************************************
""")

signing {
sign publishing.publications.maven
}
}


0 comments on commit 0f0107a

Please sign in to comment.