1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Merge pull request #170 from evanchooly/master

corrected bintray urls
This commit is contained in:
Cedric Beust 2016-04-16 22:03:29 -08:00
commit 114a75b0fb

View file

@ -63,19 +63,19 @@ class BintrayApi @Inject constructor(val http: Http,
@Multipart @Multipart
@Headers("Content-Type: application/xml") @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, fun uploadPom(@Path("owner") owner: String,
@Path("repo") repo: String, @Path("repo") repo: String,
@Path("version") version: String,
@Path("group", encoded = true) group: String, @Path("group", encoded = true) group: String,
@Path("artifact") artifact: String, @Path("artifact") artifact: String,
@Path("version") version: String,
@Path("name") name: String, @Path("name") name: String,
@Part file: MultipartBody.Part): Call<BintrayResponse> @Part file: MultipartBody.Part): Call<BintrayResponse>
@Multipart @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, fun uploadArtifact(@Path("owner") owner: String,
@Path("package") bintrayPackage: String, @Path("repo") repo: String,
@Path("group", encoded = true) group: String, @Path("group", encoded = true) group: String,
@Path("artifact") artifact: String, @Path("artifact") artifact: String,
@Path("version") version: String, @Path("version") version: String,
@ -175,13 +175,12 @@ class BintrayApi @Inject constructor(val http: Http,
val fileCount = filesToUpload.size val fileCount = filesToUpload.size
if (fileCount > 0) { if (fileCount > 0) {
log(1, " Found $fileCount artifacts to upload: " + filesToUpload[0] log(1, " Found $fileCount artifacts to upload")
+ if (fileCount > 1) "..." else "")
val errorMessages = arrayListOf<String>() val errorMessages = arrayListOf<String>()
fun dots(total: Int, list: List<Boolean>, file: File?): String { fun dots(total: Int, list: List<Boolean>, file: File? = null): String {
val spaces: String = Array(total - list.size, { " " }).joinToString("") 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<Boolean>() val results = arrayListOf<Boolean>()
@ -190,12 +189,12 @@ class BintrayApi @Inject constructor(val http: Http,
val body = MultipartBody.Part.createFormData("artifact", file.name, RequestBody.create(type, file)); 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, service.uploadArtifact(org ?: username!!, project.name,
project.group!!.replace('.', '/'), project.artifactId!!, project.version!!, file.name, body) project.group!!.replace('.', '/'), project.artifactId!!, project.version!!, file.name, body)
} else { } else {
service.uploadPom(org ?: username!!, project.name, service.uploadPom(org ?: username!!, project.name, project.group!!.replace('.', '/'),
project.group!!.replace('.', '/'), project.artifactId!!, project.version!!, file.name, body) project.artifactId!!, project.version!!, file.name, body)
} }
val result = upload.execute() val result = upload.execute()
@ -208,8 +207,11 @@ class BintrayApi @Inject constructor(val http: Http,
} }
log(1, " Uploading ${i + 1} / $fileCount " + dots(fileCount, results, file), false) log(1, " Uploading ${i + 1} / $fileCount " + dots(fileCount, results, file), false)
} }
log(1, " Uploading ${fileCount} / $fileCount " + dots(fileCount, results, null), false) val success = results
log(1, "", true) .filter { it }
.count()
log(1, " Uploaded $success / $fileCount " + dots(fileCount, results), false)
log(1, "", true)
if (errorMessages.isEmpty()) { if (errorMessages.isEmpty()) {
return TaskResult() return TaskResult()
} else { } else {