File tree Expand file tree Collapse file tree 2 files changed +27
-34
lines changed
Expand file tree Collapse file tree 2 files changed +27
-34
lines changed Original file line number Diff line number Diff line change @@ -27,28 +27,6 @@ description = 'dd-trace-java'
2727// Applied here to allow publishing of artifactory build info
2828apply from : " ${ rootDir} /gradle/publish.gradle"
2929
30- // Source: https://github.com/ratpack/ratpack/blob/master/ratpack.gradle#L101
31- task bintrayPublish () {
32- doLast {
33- if (! project. hasProperty(" bintrayApiKey" ) || bintrayApiKey. length() < 20 ) {
34- throw new InvalidUserDataException (" You must provide a valid bintrayApiKey" )
35- }
36-
37- if (! project. hasProperty(' buildNumber' ) || ! " $buildNumber " . isInteger()) {
38- throw new TaskExecutionException (" Must provide buildNumber of a release from https://oss.jfrog.org/artifactory/webapp/#/builds/dd-trace-java" )
39- }
40-
41- def curl = [
42- ' curl' ,
43- ' -X' , ' POST' ,
44- ' -u' , " ${ bintrayUser} :${ bintrayApiKey} " ,
45- ' -d' , ' ' ,
46- " http://oss.jfrog.org/api/plugins/build/promote/snapshotsToBintray/dd-trace-java/$project . buildNumber "
47- ]. execute()
48- logger. info(" Received response: ${ curl.text} " )
49- }
50- }
51-
5230task wrapper (type : Wrapper ) {
5331 gradleVersion = ' 4.0'
5432}
Original file line number Diff line number Diff line change @@ -73,25 +73,36 @@ artifactoryPublish { task ->
7373 throw new IllegalStateException (" cannot run " + task + " with --parallel and --max-workers > 1" )
7474 }
7575 }
76+ }
7677
77- artifactory {
78- publish {
79- contextUrl = forceLocal ? ' http://localhost:8080/artifactory' : ' https://oss.jfrog.org'
80- repository {
81- if (forceLocal)
82- repoKey = isSnapshot ? ' libs-snapshot-local' : ' libs-release-local'
83- else
84- repoKey = isSnapshot ? ' oss-snapshot-local' : ' oss-release-local'
85- gradle. taskGraph. whenReady { taskGraph ->
78+ artifactory {
79+ publish {
80+ contextUrl = forceLocal ? ' http://localhost:8080/artifactory' : ' https://oss.jfrog.org'
81+ repository {
82+ if (forceLocal)
83+ repoKey = isSnapshot ? ' libs-snapshot-local' : ' libs-release-local'
84+ else
85+ repoKey = isSnapshot ? ' oss-snapshot-local' : ' oss-release-local'
86+ gradle. taskGraph. whenReady { taskGraph ->
87+ artifactoryPublish { task ->
8688 if (taskGraph. hasTask(task)) {
8789 username = bintrayUser
8890 password = bintrayApiKey
8991 }
9092 }
9193 }
92- defaults {
93- if (! isRoot) publishConfigs(' archives' )
94- }
94+ }
95+ defaults {
96+ if (! isRoot) publishConfigs(' archives' )
97+ }
98+ }
99+ }
100+
101+ bintrayUpload { task ->
102+ gradle. taskGraph. whenReady { taskGraph ->
103+ def startParameter = project. gradle. startParameter
104+ if (taskGraph. hasTask(task) && startParameter. parallelProjectExecutionEnabled && startParameter. maxWorkerCount > 1 ) {
105+ throw new IllegalStateException (" cannot run " + task + " with --parallel and --max-workers > 1" )
95106 }
96107 }
97108}
@@ -156,3 +167,7 @@ bintray {
156167// }
157168 }
158169}
170+
171+ if (! isSnapshot) {
172+ artifactoryPublish. finalizedBy bintrayUpload
173+ }
You can’t perform that action at this time.
0 commit comments