Skip to content

Commit 7350700

Browse files
authored
Move artifact publishing from JCenter to Maven Central (#385)
* added publishing for maven central * reverted version bumps and added pr number to changelog * rely on badges for the latest version published in distribution channels * test maven central publishing with version 1.13.1
1 parent 3e3a189 commit 7350700

File tree

9 files changed

+135
-75
lines changed

9 files changed

+135
-75
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
<!--
4+
5+
Prepend the changelog with this template on every release.
6+
7+
# [Unreleased]
8+
- Changes (<PR #>)
9+
10+
-->
11+
12+
## [Unreleased]
13+
- Moved artifact publishing from JCenter to Maven Central (#385)

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,32 @@
66
TapTargetView
77
</h1>
88

9-
[![Download](https://api.bintray.com/packages/keepsafesoftware/Android/TapTargetView/images/download.svg) ](https://bintray.com/keepsafesoftware/Android/TapTargetView/_latestVersion)
9+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.getkeepsafe.taptargetview/taptargetview/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.getkeepsafe.taptargetview/taptargetview)
10+
[![Release](https://img.shields.io/github/tag/KeepSafe/TapTargetView.svg?label=jitpack)](https://jitpack.io/#KeepSafe/TapTargetView)
1011

1112

1213
An implementation of tap targets from [Google's Material Design guidelines on feature discovery](https://material.io/archive/guidelines/growth-communications/feature-discovery.html).
1314

14-
**Min SDK:** 14
15+
**Min SDK:** 14
16+
17+
[JavaDoc](https://javadoc.jitpack.io/com/github/KeepSafe/TapTargetView/latest/javadoc/)
1518

1619
## Installation
1720

18-
TapTargetView is distributed using [jcenter](https://bintray.com/keepsafesoftware/Android/TapTargetView/view).
21+
TapTargetView is distributed using [MavenCentral](https://search.maven.org/artifact/com.getkeepsafe.taptargetview/taptargetview).
1922

2023
```groovy
2124
repositories {
22-
jcenter()
25+
mavenCentral()
2326
}
2427
2528
dependencies {
26-
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'
29+
implementation 'com.getkeepsafe.taptargetview:taptargetview:x.x.x'
2730
}
2831
```
2932

30-
If you wish to use a snapshot, please follow the instructions [here](https://jitpack.io/#KeepSafe/TapTargetView/-SNAPSHOT)
33+
If you wish, you may also use TapTargetView with [jitpack](https://jitpack.io/#KeepSafe/TapTargetView).
34+
For snapshots, please follow the instructions [here](https://jitpack.io/#KeepSafe/TapTargetView/-SNAPSHOT).
3135

3236
## Usage
3337

RELEASING.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
How To Release
2+
==============
3+
4+
Due to Maven Central's very particular requirements, the release process is a bit
5+
elaborate and requires a good deal of local configuration. This guide should walk
6+
you through it. It won't do anyone outside of KeepSafe any good, but the workflow
7+
is representative of just about any project deploying via Sonatype.
8+
9+
We currently deploy to Maven Central (via Sonatype's OSS Nexus instance).
10+
11+
### Prerequisites
12+
13+
1. A *published* GPG code-signing key
14+
1. A Sonatype Nexus OSS account with permission to publish in com.getkeepsafe
15+
1. Permission to push directly to https://github.com/KeepSafe/TapTargetView
16+
17+
### Setup
18+
19+
1. Add your GPG key to your github profile - this is required
20+
for github to know that your commits and tags are "verified".
21+
1. Configure your code-signing key in ~/.gradle.properties:
22+
```gradle
23+
signing.keyId=<key ID of your GPG signing key>
24+
signing.password=<your key's passphrase>
25+
signing.secretKeyRingFile=/path/to/your/secring.gpg
26+
```
27+
1. Configure your Sonatype credentials in ~/.gradle.properties:
28+
```gradle
29+
SONATYPE_NEXUS_USERNAME=<nexus username>
30+
SONATYPE_NEXUS_PASSWORD=<nexus password>
31+
```
32+
1. Configure git with your codesigning key; make sure it's the same as the one
33+
you use to sign binaries (i.e. it's the same one you added to gradle.properties):
34+
```bash
35+
# Do this for the TapTargetView repo only
36+
git config user.email "[email protected]"
37+
git config user.signingKey "your-key-id"
38+
```
39+
40+
### Pushing a build
41+
42+
1. Edit gradle.properties, update the VERSION property for the new version release
43+
1. Edit changelog, add relevant changes, note the date and new version (follow the existing pattern)
44+
1. Add new `## [Unreleased]` header for next release
45+
1. Verify that the everything works:
46+
```bash
47+
./gradlew clean check
48+
```
49+
1. Make a *signed* commit:
50+
```bash
51+
git commit -S -m "Release version X.Y.Z"
52+
```
53+
1. Make a *signed* tag:
54+
```bash
55+
git tag -s -a X.Y.Z
56+
```
57+
1. Upload binaries to Sonatype:
58+
```bash
59+
./gradlew publish
60+
```
61+
1. Go to [Sonatype](https://oss.sonatype.org/), log in with your credentials
62+
1. Click "Staging Repositories"
63+
1. Find the "comgetkeepsafe" repo, usually at the bottom of the list
64+
1. "Close" the repository (select it then click the "close" button up top), the text field doesn't matter so put whatever you want in it
65+
1. Wait until that's done
66+
1. "Release" the repository, leave the checkbox checked. Hooray, we're in Maven Central now!
67+
1. Push all of our work to Github to make it official. Check previous [releases](https://github.com/KeepSafe/TapTargetView/releases) and edit tag release changes:
68+
```bash
69+
git push --tags origin master
70+
```

app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
android:layout_height="wrap_content"
5050
android:layout_gravity="end|bottom"
5151
android:layout_marginBottom="50dp"
52+
android:layout_marginRight="16dp"
5253
android:layout_marginEnd="16dp"
5354
android:src="@drawable/ic_directions_car_black_24dp"/>
5455

build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
buildscript {
22
repositories {
33
google()
4-
jcenter()
4+
mavenCentral()
5+
gradlePluginPortal()
56
}
67
dependencies {
7-
classpath 'com.android.tools.build:gradle:3.2.0'
8+
classpath 'com.android.tools.build:gradle:4.1.2'
89
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
9-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
10+
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.13.0'
1011
}
1112
}
1213

@@ -20,8 +21,12 @@ ext {
2021

2122
allprojects {
2223
repositories {
23-
jcenter()
2424
google()
25+
mavenCentral()
26+
// TODO: Remove this repository when Android build tools no longer transitively pulls
27+
// `trove4j` or if it's properly published in Maven Central when JCenter goes away.
28+
// See: https://github.com/KeepSafe/ReLinker/pull/81#issuecomment-787525670
29+
gradlePluginPortal()
2530
}
2631
}
2732

gradle.properties

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
11
android.enableJetifier=true
2-
android.useAndroidX=true
2+
android.useAndroidX=true
3+
4+
GROUP=com.getkeepsafe.taptargetview
5+
VERSION_NAME=1.13.1
6+
POM_ARTIFACT_ID=taptargetview
7+
8+
POM_NAME=TapTargetView
9+
POM_PACKAGING=aar
10+
11+
POM_DESCRIPTION=An implementation of tap targets from the Material Design guidelines for feature discovery
12+
POM_INCEPTION_YEAR=2016
13+
14+
POM_URL=https://github.com/KeepSafe/TapTargetView
15+
POM_SCM_URL=https://github.com/KeepSafe/TapTargetView
16+
POM_SCM_CONNECTION=scm:git:git://github.com/KeepSafe/TapTargetView.git
17+
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]:KeepSafe/TapTargetView.git
18+
19+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
20+
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
21+
POM_LICENCE_DIST=repo
22+
23+
POM_DEVELOPER_ID=keepsafe
24+
POM_DEVELOPER_NAME=KeepSafe Software, Inc.
25+
POM_DEVELOPER_URL=https://github.com/KeepSafe/

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

taptargetview/build.gradle

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'com.github.dcendents.android-maven'
3-
apply plugin: 'com.jfrog.bintray'
4-
5-
def libname = 'TapTargetView'
6-
group = 'com.getkeepsafe.taptargetview'
7-
version = '1.13.0'
8-
description = 'An implementation of tap targets from the Material Design guidelines for feature discovery'
3+
apply plugin: 'com.vanniktech.maven.publish'
94

105
android {
116
compileSdkVersion defCompileSdkVersion
@@ -22,59 +17,6 @@ dependencies {
2217
implementation "androidx.core:core:$defAndroidXVersion"
2318
}
2419

25-
install {
26-
repositories.mavenInstaller {
27-
pom.project {
28-
name libname
29-
description project.description
30-
url "https://github.com/KeepSafe/$libname"
31-
inceptionYear 2016
32-
33-
packaging 'aar'
34-
groupId project.group
35-
artifactId 'taptargetview'
36-
version project.version
37-
38-
licenses {
39-
license {
40-
name 'The Apache Software License, Version 2.0'
41-
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
42-
distribution 'repo'
43-
}
44-
}
45-
scm {
46-
connection "https://github.com/KeepSafe/${libname}.git"
47-
url "https://github.com/KeepSafe/$libname"
48-
}
49-
developers {
50-
developer {
51-
name 'Keepsafe'
52-
}
53-
}
54-
}
55-
}
56-
}
57-
58-
bintray {
59-
user = project.hasProperty('bintray.user') ? project.property('bintray.user') : ''
60-
key = project.hasProperty('bintray.apikey') ? project.property('bintray.apikey') : ''
61-
configurations = ['archives']
62-
pkg {
63-
repo = 'Android'
64-
name = libname
65-
userOrg = 'keepsafesoftware'
66-
licenses = ['Apache-2.0']
67-
vcsUrl = "https://github.com/KeepSafe/${libname}.git"
68-
69-
version {
70-
name = project.version
71-
desc = project.description
72-
released = new Date()
73-
vcsTag = project.version
74-
}
75-
}
76-
}
77-
7820
// build a jar with source files
7921
task sourcesJar(type: Jar) {
8022
from android.sourceSets.main.java.srcDirs

taptargetview/src/main/java/com/getkeepsafe/taptargetview/ToolbarTapTarget.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
import android.annotation.TargetApi;
1919
import android.graphics.drawable.Drawable;
2020
import android.os.Build;
21-
import androidx.annotation.IdRes;
22-
import androidx.annotation.Nullable;
23-
import androidx.appcompat.widget.Toolbar;
2421
import android.text.TextUtils;
2522
import android.view.View;
2623
import android.view.ViewGroup;
@@ -30,6 +27,10 @@
3027
import java.util.ArrayList;
3128
import java.util.Stack;
3229

30+
import androidx.annotation.IdRes;
31+
import androidx.annotation.Nullable;
32+
import androidx.appcompat.widget.Toolbar;
33+
3334
class ToolbarTapTarget extends ViewTapTarget {
3435
ToolbarTapTarget(Toolbar toolbar, @IdRes int menuItemId,
3536
CharSequence title, @Nullable CharSequence description) {
@@ -58,7 +59,8 @@ private static ToolbarProxy proxyOf(Object instance) {
5859

5960
if (instance instanceof Toolbar) {
6061
return new SupportToolbarProxy((Toolbar) instance);
61-
} else if (instance instanceof android.widget.Toolbar) {
62+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
63+
&& instance instanceof android.widget.Toolbar) {
6264
return new StandardToolbarProxy((android.widget.Toolbar) instance);
6365
}
6466

0 commit comments

Comments
 (0)