Enable publishing of artifactory build info

This commit is contained in:
Tyler Benson 2017-08-02 14:18:20 -07:00
parent bdd376e994
commit 480b720ed2
2 changed files with 32 additions and 18 deletions

View File

@ -21,6 +21,11 @@ repositories {
jcenter() jcenter()
} }
description = 'dd-trace-java'
// Applied here to allow publishing of artifactory build info
apply from: "${rootDir}/gradle/publish.gradle"
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = '4.0' gradleVersion = '4.0'
} }

View File

@ -16,13 +16,10 @@
// Source: https://github.com/ratpack/ratpack/blob/master/gradle/publish.gradle // Source: https://github.com/ratpack/ratpack/blob/master/gradle/publish.gradle
apply plugin: 'maven' apply plugin: "maven"
apply plugin: "com.jfrog.artifactory" apply plugin: "com.jfrog.artifactory"
apply plugin: "signing" apply plugin: "signing"
apply from: "$rootDir/gradle/version.gradle"
apply from: "${rootDir}/gradle/pom.gradle"
afterEvaluate { afterEvaluate {
assert description: "Project $project.path is published, must have a description" assert description: "Project $project.path is published, must have a description"
} }
@ -33,23 +30,28 @@ tasks.withType(Upload).matching { it.name != "install" }.all {
} }
} }
def isCI = Boolean.parseBoolean("$System.env.CI") if (project.rootProject != project) {
apply from: "$rootDir/gradle/version.gradle"
apply from: "${rootDir}/gradle/pom.gradle"
signing { def isCI = Boolean.parseBoolean("$System.env.CI")
required = isCI
sign configurations.archives signing {
} required = isCI
sign configurations.archives
}
configurations {
configurations { configurations {
all { configurations {
incoming.afterResolve { all {
dependencies.withType(ModuleDependency) { dep -> incoming.afterResolve {
excludeRules.each { dependencies.withType(ModuleDependency) { dep ->
if ([it.group, it.module].any { it == null }) { excludeRules.each {
throw new InvalidUserDataException( if ([it.group, it.module].any { it == null }) {
"Partial exclude for dependency '$dep.group:$dep.name:$dep.version' of $project: [group: $it.group, module: $it.module]\n\nExcludes must specify both group and module and neither can be '*'." throw new InvalidUserDataException(
) "Partial exclude for dependency '$dep.group:$dep.name:$dep.version' of $project: [group: $it.group, module: $it.module]\n\nExcludes must specify both group and module and neither can be '*'."
)
}
} }
} }
} }
@ -63,6 +65,13 @@ def isSnapshot = version.endsWith("-SNAPSHOT")
def forceLocal = project.hasProperty('forceLocal') && forceLocal def forceLocal = project.hasProperty('forceLocal') && forceLocal
artifactoryPublish { task -> artifactoryPublish { task ->
gradle.taskGraph.whenReady { taskGraph ->
def startParameter = project.gradle.startParameter
if (taskGraph.hasTask(task) && startParameter.parallelProjectExecutionEnabled && startParameter.maxWorkerCount > 1) {
throw new IllegalStateException("cannot run " + task + " with --parallel and --max-workers > 1")
}
}
artifactory { artifactory {
publish { publish {
contextUrl = forceLocal ? 'http://localhost:8080/artifactory' : 'https://oss.jfrog.org' contextUrl = forceLocal ? 'http://localhost:8080/artifactory' : 'https://oss.jfrog.org'