From 65b32e589305b59a0e39501422228dbba619d744 Mon Sep 17 00:00:00 2001 From: marcelpinto Date: Mon, 4 Jan 2021 16:10:43 +0800 Subject: [PATCH] Use bintray plugin for publishing - Makes it easy to configure - Changed groupId --- README.md | 6 ++++-- build.gradle.kts | 3 --- lib/build.gradle.kts | 45 ++++++++++++++++++++++++++++---------------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 34673df..1c5a30c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # permissions-ktx +[ ![Download](https://api.bintray.com/packages/skimarxall/maven/permissions-ktx/images/download.svg?version=0.4) ](https://bintray.com/skimarxall/maven/permissions-ktx/0.4/link) + Kotlin Lightweight Android permissions library that follows the permission request principles and it's Jetpack Compose friendly. @@ -42,14 +44,14 @@ Add custom maven url repository (publishing to JCentral is in progress) allprojects { repositories { // ... - maven { url "https://dl.bintray.com/skimarxall/maven" } + jcenter() } } ``` ```groovy dependencies { - implementation 'dev.marcelpinto:permissions-ktx:0.2' + implementation 'dev.marcelpinto.permissions:permissions-ktx:0.4' } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 98dd4d7..7c505a7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,9 +7,6 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:7.0.0-alpha03") classpath(kotlin("gradle-plugin", version = "1.4.21")) - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index b5bb168..23972c5 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -7,6 +7,7 @@ plugins { kotlin("android") id("org.jetbrains.dokka") version "1.4.20" `maven-publish` + id("com.jfrog.bintray") version "1.8.5" } android { @@ -54,13 +55,14 @@ dependencies { api("androidx.fragment:fragment-ktx:1.3.0-rc01") } -group = "dev.marcelpinto" -version = android.defaultConfig.versionName.toString() +val libraryName = "permissions-ktx" +val libraryGroup = "dev.marcelpinto.permissions" +val libraryVersion = android.defaultConfig.versionName.toString() tasks.withType().configureEach { dokkaSourceSets { named("main") { - displayName.set("permissions-ktx") + displayName.set(libraryName) //includes.from("../README.md") sourceLink { localDirectory.set(file("src/main/java")) @@ -92,8 +94,10 @@ val androidSourcesJar by tasks.register("androidSourcesJar") { publishing { publications { - register("mavenAndroid") { - artifactId = "permissions-ktx" + register("release") { + artifactId = libraryName + groupId = libraryGroup + version = libraryVersion afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) } artifact(tasks.getByName("androidJavadocJar")) @@ -101,7 +105,7 @@ publishing { artifact(tasks.getByName("androidSourcesJar")) pom { - name.set("permissions-ktx") + name.set(libraryName) description.set("Kotlin Lightweight Android permissions library that follows the best practices.") url.set("https://github.com/marcelpinto/permissions-ktx") @@ -148,16 +152,25 @@ publishing { } } } +} - repositories { - maven { - name = "bintray" - credentials { - val properties = gradleLocalProperties(rootDir) - username = properties.getProperty("bintray.username") - password = properties.getProperty("bintray.password") - } - url = uri("https://api.bintray.com/maven/skimarxall/maven/permissions-ktx/;publish=1") +bintray { + val properties = gradleLocalProperties(rootDir) + user = properties.getProperty("bintray.username") + key = properties.getProperty("bintray.password") + setPublications("release") + publish = true + override = true + pkg = PackageConfig().apply { + repo = "maven" + name = libraryName + desc = + "Kotlin Lightweight Android permissions library that follows the permissions best practices" + setLicenses("Apache-2.0") + vcsUrl = "https://github.com/marcelpinto/permissions-ktx.git" + publicDownloadNumbers = true + version = VersionConfig().apply { + name = libraryVersion } } -} +} \ No newline at end of file