diff --git a/AndroidJava/.gitignore b/AndroidJava/.gitignore index 2f38305..0583dfd 100644 --- a/AndroidJava/.gitignore +++ b/AndroidJava/.gitignore @@ -1,5 +1,6 @@ *.iml .gradle +*.gpg /local.properties /.idea/caches /.idea/libraries diff --git a/AndroidJava/build.gradle.kts b/AndroidJava/build.gradle.kts index f98619d..8e49066 100644 --- a/AndroidJava/build.gradle.kts +++ b/AndroidJava/build.gradle.kts @@ -18,6 +18,7 @@ buildscript { allprojects { repositories { google() + mavenCentral() jcenter() //mavenLocal() //maven("https://dl.bintray.com/alexandrehtrb/Maven") diff --git a/AndroidJava/buildSrc/src/main/kotlin/Dependencies.kt b/AndroidJava/buildSrc/src/main/kotlin/Dependencies.kt index 8a35e36..0dc36a4 100644 --- a/AndroidJava/buildSrc/src/main/kotlin/Dependencies.kt +++ b/AndroidJava/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,4 +1,4 @@ object Dependencies { const val androidXAppCompat = "androidx.appcompat:appcompat:1.2.0" - const val iridescentView = "br.alexandrehtrb.iridescentview:iridescentview:1.0.0" + const val iridescentView = "io.github.alexandrehtrb:iridescentview:1.0.0" } \ No newline at end of file diff --git a/AndroidJava/buildSrc/src/main/kotlin/LibConfiguration.kt b/AndroidJava/buildSrc/src/main/kotlin/LibConfiguration.kt index c26baac..94191a0 100644 --- a/AndroidJava/buildSrc/src/main/kotlin/LibConfiguration.kt +++ b/AndroidJava/buildSrc/src/main/kotlin/LibConfiguration.kt @@ -6,7 +6,7 @@ object LibConfiguration { const val versionCode = 1 const val versionName = "1.0.0" const val testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - const val groupId = "br.alexandrehtrb.iridescentview" + const val groupId = "io.github.alexandrehtrb" const val artifactId = "iridescentview" const val libraryName = "IridescentView" const val libraryDescription = "A custom Android ImageView that creates an iridescent effect on top of images." @@ -16,6 +16,10 @@ object LibConfiguration { const val licenseUrl = "https://mit-license.org/" const val developerId = "alexandrehtrb" const val developerName = "Alexandre H.T.R. Bonfitto" + const val scmConnection = "scm:git:github.com/alexandrehtrb/IridescentView.git" + const val scmDeveloperConnection = "scm:git:github.com/alexandrehtrb/IridescentView.git" + const val scmUrl = "https://github.com/alexandrehtrb/IridescentView/tree/master" + const val bintrayRepoName = "Maven" const val libraryLabel1 = "Iridescent" diff --git a/AndroidJava/iridescentview/build.gradle.kts b/AndroidJava/iridescentview/build.gradle.kts index aae95a6..798b5e9 100644 --- a/AndroidJava/iridescentview/build.gradle.kts +++ b/AndroidJava/iridescentview/build.gradle.kts @@ -5,8 +5,31 @@ plugins { id("com.android.library") id("com.jfrog.bintray") id("maven-publish") + id("signing") } +//region Load properties from properties file or environment variables + +val secretPropsFile = project.rootProject.file("local.properties") +if (secretPropsFile.exists()) { + println("Found secret props file, loading props") + val properties = loadProperties("${rootDir}\\local.properties") + ext["signing.keyId"] = properties.propertyString("signing.keyId") + ext["signing.password"] = properties.propertyString("signing.password") + ext["signing.secretKeyRingFile"] = properties.propertyString("signing.secretKeyRingFile") + ext["ossrhUsername"] = properties.propertyString("ossrhUsername") + ext["ossrhPassword"] = properties.propertyString("ossrhPassword") +} else { + println("No props file, loading env vars") + 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") ?: "" +} + +//endregion + android { compileSdkVersion(LibConfiguration.compileSdkVersion) buildToolsVersion(LibConfiguration.buildToolsVersion) @@ -65,12 +88,45 @@ afterEvaluate { name.set(LibConfiguration.developerName) } } + scm { + connection.set(LibConfiguration.scmConnection) + developerConnection.set(LibConfiguration.scmDeveloperConnection) + url.set(LibConfiguration.scmUrl) + } + } + } + } + repositories { + maven { + name = "sonatype" // Sonatype / MavenCentral + + val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" + // You only need this if you want to publish snapshots, otherwise just set the URL + // to the release repo directly + + setUrl(if(version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl) + + // The username and password we've fetched earlier + credentials { + // Getting OSSRH Maven Central user and key from properties file + val properties = loadProperties("${rootDir}\\local.properties") + val ossrhUsername = properties.propertyString("ossrhUsername") + val ossrhPassword = properties.propertyString("ossrhPassword") + + username = ossrhUsername + password = ossrhPassword } } } } } + +signing { + sign(publishing.publications) +} + bintray { // Getting bintray user and key from properties file or command line val properties = loadProperties("${rootDir}\\local.properties") diff --git a/README.md b/README.md index f18b86a..08a4605 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,14 @@ The component is available for Android Java and Xamarin.Android. ## To use in Android Java -In the Gradle scripts, the JCenter's Maven repository must be declared: +In the Gradle scripts, the Maven Central repository must be declared: ```kt allprojects { repositories { google() jcenter() + mavenCentral() // other Maven repositories } } @@ -27,7 +28,7 @@ allprojects { In the Gradle script of the module in which you want to use the View, include the dependency inside the `dependencies` block: ```kt -implementation("br.alexandrehtrb.iridescentview:iridescentview:1.0.0") +implementation("io.github.alexandrehtrb:iridescentview:1.0.0") ``` To use the View in a XML layout, add like below: diff --git a/README_pt.md b/README_pt.md index 46c8182..85d311b 100644 --- a/README_pt.md +++ b/README_pt.md @@ -12,13 +12,14 @@ O componente está disponível para Android Java e Xamarin.Android. ## Para usar no Android Java -Nos scripts Gradle, o repositório Maven do JCenter deve estar declarado: +Nos scripts Gradle, o repositório Maven Central deve estar declarado: ```kt allprojects { repositories { google() jcenter() + mavenCentral() // other Maven repositories } } @@ -27,7 +28,7 @@ allprojects { No script Gradle do módulo no qual você quer usar a View, incluir a dependência no bloco `dependencies`: ```kt -implementation("br.alexandrehtrb.iridescentview:iridescentview:1.0.0") +implementation("io.github.alexandrehtrb:iridescentview:1.0.0") ``` Para usar a View em um layout XML, adicionar como abaixo: