opentelemetry-java-instrume.../gradle/publish.gradle

122 lines
3.2 KiB
Groovy

apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.jfrog.bintray'
publishing {
repositories {
maven {
url = "$rootDir/build/repo"
}
}
publications {
maven(MavenPublication) {
if (project.tasks.findByName("shadowJar") != null && !findProperty('noShadowPublish')) {
project.shadow.component(it)
//These two are here just to satisfy Maven Central
artifact sourcesJar
artifact javadocJar
} else {
from components.java
}
artifactId = artifactPrefix(project) + artifactId
pom {
name = 'OpenTelemetry Instrumentation for Java'
packaging = 'jar'
url = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation'
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/opentelemetry-java-instrumentation'
}
}
scm {
connection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java-instrumentation.git'
developerConnection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java-instrumentation.git'
url = 'git@github.com:open-telemetry/opentelemetry-auto-instr-java.git'
}
afterEvaluate {
// description is not available until evaluated.
description = project.description
}
}
}
}
}
private String artifactPrefix(Project p) {
if (p.name.startsWith("opentelemetry")) {
return ''
}
if (p.name.startsWith("auto")) {
return 'opentelemetry-'
}
if (p.group == 'io.opentelemetry.instrumentation.auto') {
return 'opentelemetry-auto-'
}
return 'opentelemetry-'
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')
publications = ['maven']
publish = true
pkg {
repo = 'maven'
name = 'opentelemetry-java-instrumentation'
licenses = ['Apache-2.0']
websiteUrl = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation'
issueTrackerUrl = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues'
vcsUrl = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation.git'
userOrg = 'open-telemetry'
githubRepo = 'open-telemetry/opentelemetry-java-instrumentation'
version {
name = project.version
released = new Date()
gpg {
sign = true
}
mavenCentralSync {
user = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_KEY")
}
}
}
}
bintrayUpload.enabled = !version.toString().contains('SNAPSHOT')
// Snapshot publishing.
artifactory {
contextUrl = 'https://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = System.getenv("BINTRAY_USER")
password = System.getenv("BINTRAY_API_KEY")
}
}
}
artifactoryPublish {
enabled = version.toString().contains('SNAPSHOT')
publications('maven')
}