From 2f77caf8b7e3ad50964ed6019456d416c01a0765 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Wed, 23 Jun 2021 23:03:07 +0200 Subject: [PATCH] feature: migrated to sonatype repository. v4.2.1 --- build.gradle | 80 ++++++++++++++++-------------- src/main/kotlin/components/Vars.kt | 2 +- src/test/kotlin/utils/Helper.kt | 2 +- 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/build.gradle b/build.gradle index 97de734..a561637 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,10 @@ plugins { id 'java' - id 'com.jfrog.bintray' version '1.8.5' id 'org.jetbrains.kotlin.jvm' version '1.4.0' - id "com.github.dcendents.android-maven" version "2.1" + id 'maven-publish' + id 'signing' } -group 'com.stringcare' -version '4.0.1' - def siteUrl = 'https://github.com/StringCare/KotlinGradlePlugin' def gitUrl = 'https://github.com/StringCare/KotlinGradlePlugin.git' @@ -15,7 +12,6 @@ sourceCompatibility = 1.8 repositories { google() - jcenter() mavenCentral() } @@ -35,51 +31,59 @@ compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } -install { - repositories.mavenInstaller { - pom { - project { - packaging 'aar' - name 'StringCareAndroidPlugin' - url siteUrl - // Set your license +group = "io.github.stringcare" +version = "4.2.1" + +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) + +publishing { + publications { + plugin(MavenPublication) { + from components.java + artifactId = "plugin" + pom { + packaging = 'aar' + name = 'StringCareAndroidPlugin' + description = "Stringcare Android library" + url = siteUrl + scm { + connection = gitUrl + developerConnection = gitUrl + url = siteUrl + } licenses { license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { - id 'efraespada' - name 'efraespada' - email 'efraespada@gmail.com' + id = 'efraespada' + name = 'efraespada' + email = 'efraespada@gmail.com' } } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - } + } + } + } + repositories { + maven { + //def releaseRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + // def snapshotRepo = "https://oss.sonatype.org/content/repositories/snapshots/" + url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + credentials { + username = properties["nexusUsername"] + password = properties["nexusPassword"] } } } } -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) -bintray { - user = properties.getProperty("bintrayUser") - key = properties.getProperty("bintrayApiKey") - configurations = ['archives'] - pkg { - repo = "maven" - name = "StringCareAndroidPlugin" - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = ["Apache-2.0"] - publish = true - } +signing { + useGpgCmd() + sign publishing.publications.plugin } processResources { diff --git a/src/main/kotlin/components/Vars.kt b/src/main/kotlin/components/Vars.kt index bb53263..1df41b8 100644 --- a/src/main/kotlin/components/Vars.kt +++ b/src/main/kotlin/components/Vars.kt @@ -1,6 +1,6 @@ package components -internal const val version = "4.0.1" +internal const val version = "4.2.1" internal const val testProjectName = "KotlinSample" internal const val defaultMainModule = "app" internal const val gradleTaskNameDoctor = "stringcarePreview" diff --git a/src/test/kotlin/utils/Helper.kt b/src/test/kotlin/utils/Helper.kt index 119551b..7a8db85 100644 --- a/src/test/kotlin/utils/Helper.kt +++ b/src/test/kotlin/utils/Helper.kt @@ -11,7 +11,7 @@ fun modifyForTest(directory: String, projectPath: String) { val current = File(".") val file = File("$directory${File.separator}$projectPath${File.separator}build.gradle") val content = file.getContent().replace( - "classpath \"com.stringcare:plugin:\$stringcare_version\"", + "classpath \"io.github.stringcare:plugin:\$stringcare_version\"", when (getOs()) { Os.WINDOWS -> "\nclasspath files(\"${current.absolutePath.replace("\\", "\\\\")}${File.separator}${File.separator}build${File.separator}${File.separator}libs${File.separator}${File.separator}plugin-$version.jar\")\n" Os.OSX -> "\nclasspath files(\"${current.absolutePath}${File.separator}build${File.separator}libs${File.separator}plugin-$version.jar\")\n"