From 11a0f7558936568946be4ad8bcb9ce3e24df64e4 Mon Sep 17 00:00:00 2001 From: evanchooly Date: Sat, 16 Apr 2016 23:20:08 -0400 Subject: [PATCH 1/2] corrected bintray urls cleaned up progress output --- .../beust/kobalt/plugin/publish/BintrayApi.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt b/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt index 8d5ee4da..0888a369 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt @@ -63,19 +63,21 @@ class BintrayApi @Inject constructor(val http: Http, @Multipart @Headers("Content-Type: application/xml") - @PUT("/content/{owner}/maven/{repo}/{version}/{group}/{artifact}/{version}/{name}") + @PUT("/content/{owner}/maven/{repo}/{version}/{group}/{artifact}/{name}") fun uploadPom(@Path("owner") owner: String, @Path("repo") repo: String, - @Path("version") version: String, @Path("group", encoded = true) group: String, @Path("artifact") artifact: String, + @Path("version") version: String, @Path("name") name: String, @Part file: MultipartBody.Part): Call @Multipart - @PUT("/maven/{owner}/maven/{package}/{group}/{artifact}/{version}/{name}") +// @PUT("/maven/{owner}/maven/{package}/{group}/{artifact}/{version}/{name}") + @PUT("/content/{owner}/maven/{repo}/{version}/{group}/{artifact}/{name}") fun uploadArtifact(@Path("owner") owner: String, - @Path("package") bintrayPackage: String, +// @Path("package") bintrayPackage: String, + @Path("repo") repo: String, @Path("group", encoded = true) group: String, @Path("artifact") artifact: String, @Path("version") version: String, @@ -175,13 +177,12 @@ class BintrayApi @Inject constructor(val http: Http, val fileCount = filesToUpload.size if (fileCount > 0) { - log(1, " Found $fileCount artifacts to upload: " + filesToUpload[0] - + if (fileCount > 1) "..." else "") + log(1, " Found $fileCount artifacts to upload") val errorMessages = arrayListOf() - fun dots(total: Int, list: List, file: File?): String { + fun dots(total: Int, list: List, file: File? = null): String { val spaces: String = Array(total - list.size, { " " }).joinToString("") - return "|" + list.map { if (it) "." else "X" }.joinToString("") + spaces + (if(file != null) "| [ ${file} ]" else "|") + return "|" + list.map { if (it) "." else "X" }.joinToString("") + spaces + (if (file != null) "| [ $file ]" else "|") } val results = arrayListOf() @@ -190,12 +191,12 @@ class BintrayApi @Inject constructor(val http: Http, val body = MultipartBody.Part.createFormData("artifact", file.name, RequestBody.create(type, file)); - var upload = if(file.extension != "pom" ) { + var upload = if (file.extension != "pom" ) { service.uploadArtifact(org ?: username!!, project.name, project.group!!.replace('.', '/'), project.artifactId!!, project.version!!, file.name, body) } else { - service.uploadPom(org ?: username!!, project.name, - project.group!!.replace('.', '/'), project.artifactId!!, project.version!!, file.name, body) + service.uploadPom(org ?: username!!, project.name, project.group!!.replace('.', '/'), + project.artifactId!!, project.version!!, file.name, body) } val result = upload.execute() @@ -208,8 +209,11 @@ class BintrayApi @Inject constructor(val http: Http, } log(1, " Uploading ${i + 1} / $fileCount " + dots(fileCount, results, file), false) } - log(1, " Uploading ${fileCount} / $fileCount " + dots(fileCount, results, null), false) - log(1, "", true) + val success = results + .filter { it } + .count() + log(1, " Uploaded $success / $fileCount " + dots(fileCount, results), false) + log(1, "", true) if (errorMessages.isEmpty()) { return TaskResult() } else { From 9df503f43979fe3b81d1ae68b97a69a24186a991 Mon Sep 17 00:00:00 2001 From: evanchooly Date: Sat, 16 Apr 2016 23:21:43 -0400 Subject: [PATCH 2/2] removed commented out code --- src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt b/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt index 0888a369..4976c211 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/publish/BintrayApi.kt @@ -73,10 +73,8 @@ class BintrayApi @Inject constructor(val http: Http, @Part file: MultipartBody.Part): Call @Multipart -// @PUT("/maven/{owner}/maven/{package}/{group}/{artifact}/{version}/{name}") @PUT("/content/{owner}/maven/{repo}/{version}/{group}/{artifact}/{name}") fun uploadArtifact(@Path("owner") owner: String, -// @Path("package") bintrayPackage: String, @Path("repo") repo: String, @Path("group", encoded = true) group: String, @Path("artifact") artifact: String,