Apply publishing configuration to all projects, including bom and allow it to work with java-platform. (#1626)

This commit is contained in:
Anuraag Agrawal 2020-09-09 10:05:22 +09:00 committed by GitHub
parent f13fd58d25
commit 46e1445868
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 119 additions and 123 deletions

View File

@ -14,6 +14,120 @@ ext {
subprojects {
group = "io.opentelemetry"
version = "0.9.0-SNAPSHOT" // CURRENT_OPEN_TELEMETRY_VERSION
plugins.withId("maven-publish") {
// Always include the artifactory/bintray plugins to do the deployment.
pluginManager.apply "com.jfrog.artifactory"
pluginManager.apply "com.jfrog.bintray"
publishing {
publications {
mavenPublication(MavenPublication) {
version version
groupId group
plugins.withId("java-platform") {
from(components["javaPlatform"])
}
plugins.withId("java-library") {
from(components["java"])
}
versionMapping {
allVariants {
fromResolutionResult()
}
}
pom {
name = 'OpenTelemetry Java'
packaging = 'jar'
url = 'https://github.com/open-telemetry/opentelemetry-java'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'opentelemetry'
name = 'OpenTelemetry Gitter'
url = 'https://gitter.im/open-telemetry/community'
}
}
scm {
connection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java.git'
developerConnection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java.git'
url = 'git@github.com:open-telemetry/opentelemetry-java.git'
}
afterEvaluate {
// description is not available until evaluated.
description = project.description
}
}
}
}
}
// Snapshot publishing.
artifactory {
contextUrl = 'https://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = System.getenv("BINTRAY_USER")
password = System.getenv("BINTRAY_KEY")
}
defaults {
publications('mavenPublication')
publishArtifacts = true
publishPom = true
}
}
resolve {
repoKey = 'libs-release'
}
}
// Release artifacts publishing.
bintray {
user = System.getenv("BINTRAY_USER")
key = System.getenv("BINTRAY_KEY")
publications = ['mavenPublication']
publish = true
pkg {
repo = 'maven'
name = 'opentelemetry-java'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/open-telemetry/opentelemetry-java.git'
userOrg = 'open-telemetry'
githubRepo = 'open-telemetry/opentelemetry-java'
version {
name = project.version
gpg {
sign = true
}
mavenCentralSync {
user = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_KEY")
}
}
}
}
}
}
configure(opentelemetryProjects) {
@ -37,6 +151,11 @@ configure(opentelemetryProjects) {
sourceCompatibility = 1.7
targetCompatibility = 1.7
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType(JavaCompile) {
it.options.compilerArgs += [
"-Xlint:all",
@ -269,20 +388,6 @@ configure(opentelemetryProjects) {
sign configurations.archives
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
// At a test failure, log the stack trace to the console so that we don't
// have to open the HTML in a browser.
test {
@ -339,115 +444,6 @@ configure(opentelemetryProjects) {
// Always run jmhReport after jmh task.
tasks.jmh.finalizedBy tasks.jmhReport
}
plugins.withId("maven-publish") {
// Always include the artifactory/bintray plugins to do the deployment.
pluginManager.apply "com.jfrog.artifactory"
pluginManager.apply "com.jfrog.bintray"
publishing {
publications {
mavenPublication(MavenPublication) {
version version
groupId group
from components.java
artifact sourcesJar
artifact javadocJar
versionMapping {
allVariants {
fromResolutionResult()
}
}
pom {
name = 'OpenTelemetry Java'
packaging = 'jar'
url = 'https://github.com/open-telemetry/opentelemetry-java'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'opentelemetry'
name = 'OpenTelemetry Gitter'
url = 'https://gitter.im/open-telemetry/community'
}
}
scm {
connection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java.git'
developerConnection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java.git'
url = 'git@github.com:open-telemetry/opentelemetry-java.git'
}
afterEvaluate {
// description is not available until evaluated.
description = project.description
}
}
}
}
}
// Snapshot publishing.
artifactory {
contextUrl = 'https://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = System.getenv("BINTRAY_USER")
password = System.getenv("BINTRAY_KEY")
}
defaults {
publications('mavenPublication')
publishArtifacts = true
publishPom = true
}
}
resolve {
repoKey = 'libs-release'
}
}
// Release artifacts publishing.
bintray {
user = System.getenv("BINTRAY_USER")
key = System.getenv("BINTRAY_KEY")
publications = ['mavenPublication']
publish = true
pkg {
repo = 'maven'
name = 'opentelemetry-java'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/open-telemetry/opentelemetry-java.git'
userOrg = 'open-telemetry'
githubRepo = 'open-telemetry/opentelemetry-java'
version {
name = project.version
gpg {
sign = true
}
mavenCentralSync {
user = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_KEY")
}
}
}
}
}
}
wrapper {