Skip to content

Commit

Permalink
Changed Maven groupId and publishing to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Bonfitto committed Feb 12, 2021
1 parent 788850d commit 4626cd4
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 6 deletions.
1 change: 1 addition & 0 deletions AndroidJava/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.iml
.gradle
*.gpg
/local.properties
/.idea/caches
/.idea/libraries
Expand Down
1 change: 1 addition & 0 deletions AndroidJava/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildscript {
allprojects {
repositories {
google()
mavenCentral()
jcenter()
//mavenLocal()
//maven("https://dl.bintray.com/alexandrehtrb/Maven")
Expand Down
2 changes: 1 addition & 1 deletion AndroidJava/buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 5 additions & 1 deletion AndroidJava/buildSrc/src/main/kotlin/LibConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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"
Expand Down
56 changes: 56 additions & 0 deletions AndroidJava/iridescentview/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions README_pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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:
Expand Down

0 comments on commit 4626cd4

Please sign in to comment.