From e2b9b17b35854a2ff090bafff1e52499fb55a921 Mon Sep 17 00:00:00 2001 From: cioccarellia Date: Tue, 23 Feb 2021 00:47:27 +0100 Subject: [PATCH] Release 2.2.4. Moved project to mavenCentral, changed coordinates to com.github.cioccarellia.ksprefs, updated kotlin to 1.4.30 --- .idea/runConfigurations/assembleDebug.xml | 21 ++++ .idea/runConfigurations/assembleRelease.xml | 21 ++++ .../closeAndPromoteRepository.xml | 21 ++++ .../closeAndReleaseRepository.xml | 21 ++++ .idea/runConfigurations/closeRepository.xml | 21 ++++ .idea/runConfigurations/createRepository.xml | 21 ++++ ...ReleasePublicationToSonatypeRepository.xml | 21 ++++ .idea/runConfigurations/releaseRepository.xml | 21 ++++ README.md | 12 +- build.gradle | 6 +- dependencies.gradle | 1 - gradle/android_bintray_config.gradle | 50 -------- gradle/android_library_config.gradle | 3 +- library/build.gradle | 10 ++ library_info.gradle | 6 +- scripts/publish-mavencentral.gradle | 119 ++++++++++++++++++ test/build.gradle | 2 +- 17 files changed, 313 insertions(+), 64 deletions(-) create mode 100644 .idea/runConfigurations/assembleDebug.xml create mode 100644 .idea/runConfigurations/assembleRelease.xml create mode 100644 .idea/runConfigurations/closeAndPromoteRepository.xml create mode 100644 .idea/runConfigurations/closeAndReleaseRepository.xml create mode 100644 .idea/runConfigurations/closeRepository.xml create mode 100644 .idea/runConfigurations/createRepository.xml create mode 100644 .idea/runConfigurations/publishReleasePublicationToSonatypeRepository.xml create mode 100644 .idea/runConfigurations/releaseRepository.xml delete mode 100755 gradle/android_bintray_config.gradle create mode 100644 scripts/publish-mavencentral.gradle diff --git a/.idea/runConfigurations/assembleDebug.xml b/.idea/runConfigurations/assembleDebug.xml new file mode 100644 index 0000000..7e4c474 --- /dev/null +++ b/.idea/runConfigurations/assembleDebug.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/assembleRelease.xml b/.idea/runConfigurations/assembleRelease.xml new file mode 100644 index 0000000..1bc174f --- /dev/null +++ b/.idea/runConfigurations/assembleRelease.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/closeAndPromoteRepository.xml b/.idea/runConfigurations/closeAndPromoteRepository.xml new file mode 100644 index 0000000..bf3763e --- /dev/null +++ b/.idea/runConfigurations/closeAndPromoteRepository.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/closeAndReleaseRepository.xml b/.idea/runConfigurations/closeAndReleaseRepository.xml new file mode 100644 index 0000000..1a23562 --- /dev/null +++ b/.idea/runConfigurations/closeAndReleaseRepository.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/closeRepository.xml b/.idea/runConfigurations/closeRepository.xml new file mode 100644 index 0000000..828b29c --- /dev/null +++ b/.idea/runConfigurations/closeRepository.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/createRepository.xml b/.idea/runConfigurations/createRepository.xml new file mode 100644 index 0000000..3c37f84 --- /dev/null +++ b/.idea/runConfigurations/createRepository.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/publishReleasePublicationToSonatypeRepository.xml b/.idea/runConfigurations/publishReleasePublicationToSonatypeRepository.xml new file mode 100644 index 0000000..ece2ac1 --- /dev/null +++ b/.idea/runConfigurations/publishReleasePublicationToSonatypeRepository.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/.idea/runConfigurations/releaseRepository.xml b/.idea/runConfigurations/releaseRepository.xml new file mode 100644 index 0000000..6ef3ad1 --- /dev/null +++ b/.idea/runConfigurations/releaseRepository.xml @@ -0,0 +1,21 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/README.md b/README.md index 23da539..6410ee3 100755 --- a/README.md +++ b/README.md @@ -4,20 +4,22 @@

KsPrefs

SharedPreferences. 100% Kotlin.

- Download from Bintray + Download from MavenCentral CircleCI Codacy - Kotlin + Kotlin Android Min Sdk Android Compile Version License

+ +
Gradle ```gradle dependencies { - implementation 'com.cioccarellia:ksprefs:2.2.3' + implementation 'com.github.cioccarellia:ksprefs:2.2.4' } ```
@@ -26,9 +28,9 @@ dependencies { ```xml - com.cioccarellia + com.github.cioccarellia ksprefs - 2.2.3 + 2.2.4 pom ``` diff --git a/build.gradle b/build.gradle index 38cf89b..1cafdf4 100755 --- a/build.gradle +++ b/build.gradle @@ -14,21 +14,23 @@ * limitations under the License. */ apply from: rootProject.file("gradle/versions_plugin_config.gradle") +apply plugin: 'io.codearte.nexus-staging' buildscript { - ext.kotlin_version = '1.4.21' + ext.kotlin_version = '1.4.30' apply from: rootProject.file("dependencies.gradle") repositories { google() + mavenCentral() jcenter() } dependencies { classpath deps.gradle_plugins.android - classpath deps.gradle_plugins.bintray_release classpath deps.gradle_plugins.kotlin classpath deps.gradle_plugins.versions + classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0' } } diff --git a/dependencies.gradle b/dependencies.gradle index 347bde0..fa96cf2 100755 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -23,7 +23,6 @@ ext.deps = [ gradle_plugins: [ android : "com.android.tools.build:gradle:3.6.4", versions : "com.github.ben-manes:gradle-versions-plugin:0.27.0", - bintray_release: "com.novoda:bintray-release:0.9.2", kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kt}", reflection : "org.jetbrains.kotlin:kotlin-reflect:${versions.kt}", serialization : "org.jetbrains.kotlin:kotlin-serialization:${versions.kt}" diff --git a/gradle/android_bintray_config.gradle b/gradle/android_bintray_config.gradle deleted file mode 100755 index 31538e4..0000000 --- a/gradle/android_bintray_config.gradle +++ /dev/null @@ -1,50 +0,0 @@ -apply plugin: "com.novoda.bintray-release" -apply from: rootProject.file("library_info.gradle") - -private def getBintrayCredentialArray() { - def localPropertiesFile = project.rootProject.file('local.properties') - if (!localPropertiesFile.exists()) { - logger.warn("local.properties file doesn't exist, can't get bintray crednetials.") - return ["", "", ""] - } - - Properties properties = new Properties() - properties.load(localPropertiesFile.newDataInputStream()) - - return [ - properties.getProperty("bintray.user"), // User - properties.getProperty("bintray.user"), // Org - properties.getProperty("bintray.apikey") // Api Key - ] -} - -task checkBintrayConfig { - doLast { - for (credential in getBintrayCredentialArray()) { - if (credential.isEmpty()) { - throw new IllegalArgumentException("You must provide an API key and a username to deploy to bintray") - } - } - } -} - -afterEvaluate { - bintrayUpload.dependsOn checkBintrayConfig -} - -if (module_name == null || module_name.isEmpty()) { - throw new Exception("module_must must be defined for each module.") -} - -publish { - bintrayUser = getBintrayCredentialArray()[0] - userOrg = getBintrayCredentialArray()[1] - bintrayKey = getBintrayCredentialArray()[2] - - groupId = library.publish_group - artifactId = library.artifact - publishVersion = library.publish_version - desc = library.description - website = library.website - dryRun = false -} \ No newline at end of file diff --git a/gradle/android_library_config.gradle b/gradle/android_library_config.gradle index 7d2f07c..ba765da 100755 --- a/gradle/android_library_config.gradle +++ b/gradle/android_library_config.gradle @@ -1,5 +1,4 @@ apply plugin: "com.android.library" apply from: rootProject.file("gradle/android_common_config.gradle") -apply from: rootProject.file("gradle/android_bintray_config.gradle") - +apply from: "${rootProject.projectDir}/scripts/publish-mavencentral.gradle" diff --git a/library/build.gradle b/library/build.gradle index ae97f26..7102bb4 100755 --- a/library/build.gradle +++ b/library/build.gradle @@ -16,6 +16,16 @@ ext.module_name = "ksprefs" +apply from: rootProject.file("library_info.gradle") + +ext { + PUBLISH_GROUP_ID = "${library.publish_group}.${library.artifact}" + PUBLISH_VERSION = library.publish_version + PUBLISH_ARTIFACT_ID = library.artifact + PUBLISH_ARTIFACT_DESC = library.description + PUBLISH_ARTIFACT_WEBSITE = library.website +} + apply from: rootProject.file("gradle/android_library_config.gradle") dependencies { diff --git a/library_info.gradle b/library_info.gradle index 2aa7880..ed42a68 100755 --- a/library_info.gradle +++ b/library_info.gradle @@ -20,9 +20,9 @@ ext.library = [ artifact : "ksprefs", - publish_group : "com.cioccarellia", - publish_version : "2.2.3", - publish_version_code: 223, + publish_group : "com.github.cioccarellia", + publish_version : "2.2.4", + publish_version_code: 224, description : "Kotlin SharedPreferences, Simplified", website : "https://github.com/cioccarellia/ksprefs" diff --git a/scripts/publish-mavencentral.gradle b/scripts/publish-mavencentral.gradle new file mode 100644 index 0000000..29949a4 --- /dev/null +++ b/scripts/publish-mavencentral.gradle @@ -0,0 +1,119 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + if (project.plugins.findPlugin("com.android.library")) { + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs + } else { + from sourceSets.main.java.srcDirs + from sourceSets.main.kotlin.srcDirs + } +} + +artifacts { + archives androidSourcesJar + // archives javadocJar +} + + +group = PUBLISH_GROUP_ID +version = PUBLISH_VERSION + +ext["signing.keyId"] = '' +ext["signing.password"] = '' +ext["signing.secretKeyRingFile"] = '' +ext["ossrhUsername"] = '' +ext["ossrhPassword"] = '' +ext["sonatypeStagingProfileId"] = '' + +File secretPropsFile = project.rootProject.file('local.properties') +if (secretPropsFile.exists()) { + Properties p = new Properties() + p.load(new FileInputStream(secretPropsFile)) + p.each { name, value -> + ext[name] = value + } +} else { + ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') + ext["signing.password"] = System.getenv('SIGNING_PASSWORD') + ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') + ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') + ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') + ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') +} + +publishing { + publications { + release(MavenPublication) { + groupId PUBLISH_GROUP_ID + artifactId PUBLISH_ARTIFACT_ID + version PUBLISH_VERSION + + if (project.plugins.findPlugin("com.android.library")) { + artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") + } else { + artifact("$buildDir/libs/${project.getName()}-${version}.jar") + } + + artifact androidSourcesJar + + pom { + name = PUBLISH_ARTIFACT_ID + description = PUBLISH_ARTIFACT_DESC + url = PUBLISH_ARTIFACT_WEBSITE + licenses { + license { + name = 'APACHE LICENSE' + url = 'https://github.com/cioccarellia/ksprefs/blob/master/LICENSE.md' + } + } + developers { + developer { + id = 'cioccarellia' + name = 'Andrea Cioccarelli' + email = 'andrea.cioccarelli01@gmail.com' + } + } + scm { + connection = 'scm:git:github.com/cioccarellia/ksprefs.git' + developerConnection = 'scm:git:ssh://github.com/cioccarellia/ksprefs.git' + url = 'https://github.com/cioccarellia/ksprefs/tree/main' + } + withXml { + def dependenciesNode = asNode().appendNode('dependencies') + + project.configurations.implementation.allDependencies.each { + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', it.group) + dependencyNode.appendNode('artifactId', it.name) + dependencyNode.appendNode('version', it.version) + } + } + } + } + } + repositories { + maven { + name = "sonatype" + url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + + credentials { + username ossrhUsername + password ossrhPassword + } + } + } +} + +nexusStaging { + packageGroup = PUBLISH_GROUP_ID + stagingProfileId = sonatypeStagingProfileId + username = ossrhUsername + password = ossrhPassword +} + +signing { + sign publishing.publications +} \ No newline at end of file diff --git a/test/build.gradle b/test/build.gradle index 6cdbb4c..7799a47 100755 --- a/test/build.gradle +++ b/test/build.gradle @@ -28,7 +28,7 @@ dependencies { if (dependsOnLocal) { implementation project(":library") } else { - implementation "com.cioccarellia:ksprefs:${library.publish_version}" + implementation "com.github.cioccarellia:ksprefs:${library.publish_version}" } implementation deps.kotlin.coroutines.android