1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00

jcenter { sign }.

This commit is contained in:
Cedric Beust 2016-01-06 23:20:06 +04:00
parent e647096022
commit 4ab161cf1d
2 changed files with 17 additions and 4 deletions

View file

@ -101,20 +101,20 @@ public class JCenterApi @Inject constructor (@Nullable @Assisted("username") val
.joinToString("/")
}
return upload(files, config, fileToPath, generateMd5 = true, generateAsc = true)
return upload(files, config, fileToPath, generateMd5 = true)
}
fun uploadFile(file: File, url: String, config: JCenterConfig, generateMd5: Boolean = false,
generateAsc: Boolean = false) =
upload(arrayListOf(file), config, {
f: File -> "${UnauthenticatedJCenterApi.BINTRAY_URL_API_CONTENT}/$username/generic/$url"},
generateMd5, generateAsc)
generateMd5)
private fun upload(files: List<File>, config: JCenterConfig?, fileToPath: (File) -> String,
generateMd5: Boolean = false, generateAsc: Boolean) : TaskResult {
generateMd5: Boolean = false) : TaskResult {
val filesToUpload = arrayListOf<File>()
if (generateAsc) {
if (config != null && config.sign) {
// Create the .asc files
filesToUpload.addAll(gpg.runGpg(files))
}

View file

@ -161,7 +161,20 @@ public fun Project.github(init: GithubConfig.() -> Unit) {
}
data class JCenterConfig(val project: Project) {
/**
* If true, publish the files to JCenter. If false, the uploaded files will be available only in your
* personal bintray maven space
*/
@Directive
var publish: Boolean = false
/**
* If true, sign the files with GPG. This is only required if you plan to later synchronize these files
* from JCenter to Maven Central. Keep this to false if you are only interested in uploading to JCenter.
*/
@Directive
var sign: Boolean = false
val files = arrayListOf<Pair<String, String>>()
@Directive