Skip to content

Commit

Permalink
Move from JCenter to Maven Central (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Apr 21, 2021
1 parent 5da4f24 commit 8952eac
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 186 deletions.
61 changes: 61 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## Publishing

### Credentials

The library is published to Maven Central by the firebase-sonatype account, Googlers can find the
password for this account in [Valentine](http://valentine/)

### GPG Key

You will need to create a private GPG keyring on your machine, if you don't have one do the
following steps:

1. Run `gpg --full-generate-key`
1. Choose `RSA and RSA` for the key type
1. Use `4096` for the key size
1. Use `0` for the expiration (never)
1. Use any name, email address, and password

This creates your key in `~/.gnupg/openpgp-revocs.d/` with `.rev` format. The last 8 characters
before the `.rev` extension are your **Key ID**.

To export the key, run:

```
gpg --export-secret-keys -o $HOME/sonatype.gpg
```

Finally upload your key to the keyserver:

```
gpg --keyserver hkp://keys.openpgp.org --send-keys <YOUR KEY ID>
```

### Local Properties

Open your `$HOME/.gradle/gradle.properties` file at and fill in the values:

```
signing.keyId=<KEY ID>
signing.password=<PASSWORD YOU CHOSE>
signing.secretKeyRingFile=<FULL PATH TO YOUR GPG FILE>
mavenCentralRepositoryUsername=firebase-sonatype
mavenCentralRepositoryUsername=<PASSWORD FROM VALENTINE>
```

### Publish

To publish, run:

```
./gradlew publish
```

### Release

Follow [the instructions here](https://central.sonatype.org/pages/releasing-the-deployment.html):

1. Navigate to https://s01.oss.sonatype.org/ and **Log In**
1. On the left side click **Build Promotion** and look for the `com.firebase` repo
1. Click **Close** ... wait a few minutes (you can check status with **Refresh**)
1. Click **Release**
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion compileSdk
compileSdkVersion 30
testOptions.unitTests.includeAndroidResources = true

defaultConfig {
applicationId "pub.devrel.easypermissions.sample"
minSdkVersion 14
targetSdkVersion targetSdk
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
Expand Down
18 changes: 1 addition & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0'
}
}
Expand All @@ -22,19 +22,3 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
projectName = 'EasyPermissions'
projectDesc = 'A wrapper library for basic Android M system permissions logic'

githubUrl = 'https://github.com/googlesamples/easypermissions'

mavenGroup = 'pub.devrel'
mavenArtifactId = 'easypermissions'
mavenVersion = '3.0.0'

bintrayOrg = 'easygoogle'

compileSdk = 30
targetSdk = 30
}
121 changes: 0 additions & 121 deletions easypermissions/bintray.gradle

This file was deleted.

16 changes: 11 additions & 5 deletions easypermissions/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
apply plugin: 'com.android.library'
apply plugin: "com.vanniktech.android.junit.jacoco"

// See: https://github.com/vanniktech/gradle-maven-publish-plugin/issues/206
ext {
RELEASE_REPOSITORY_URL = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
SNAPSHOT_REPOSITORY_URL = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}

apply plugin: 'com.vanniktech.maven.publish'

android {
compileSdkVersion compileSdk
compileSdkVersion 30
testOptions.unitTests.includeAndroidResources = true

defaultConfig {
minSdkVersion 14
targetSdkVersion targetSdk
targetSdkVersion 30
versionCode 1
versionName mavenVersion
versionName "3.0.0"
}

buildTypes {
Expand Down Expand Up @@ -47,5 +55,3 @@ dependencies {
testImplementation 'androidx.fragment:fragment-testing:1.2.5'
testImplementation 'org.mockito:mockito-core:2.23.4'
}

apply from: 'bintray.gradle'
18 changes: 18 additions & 0 deletions easypermissions/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
GROUP=pub.devrel
POM_ARTIFACT_ID=easypermissions
VERSION_NAME=3.0.0

POM_NAME=EasyPermissions
POM_PACKAGING=aar

POM_DESCRIPTION=A wrapper library for basic Android M system permissions logic

POM_URL=https://github.com/googlesamples/easypermissions
POM_SCM_URL=https://github.com/googlesamples/easypermissions
POM_SCM_CONNECTION=https://github.com/googlesamples/easypermissions.git

POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo

POM_DEVELOPER_NAME=Google
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Tue Jul 07 16:12:58 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
53 changes: 33 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -66,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Loading

0 comments on commit 8952eac

Please sign in to comment.