Skip to content

Commit 03243f3

Browse files
authored
Migrate from Bintray/JCenter to Maven Central for publishing (#24)
- Updated documentation - Removed obsolete documentation
1 parent 4c6c745 commit 03243f3

File tree

9 files changed

+106
-173
lines changed

9 files changed

+106
-173
lines changed

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,38 @@ up as "covered" when tests in Module A touch it.
1515
- Supports different build variants per module within the same report.
1616
- Supports custom package/class filters.
1717

18+
> Notice: Due to the [shutdown of Bintray/JCenter](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/)
19+
> the Android-Root-Coverage-Plugin has been migrated
20+
> to Sonatype's Maven Central repository. Unfortunately this also meant that the group ID used by
21+
> the Android-Root-Coverage-Plugin had to be changed from `org.neotech.plugin` to
22+
> `nl.neotech.plugin`. The plugin ID has also changed from `org.neotech.plugin.rootcoverage` to
23+
> `nl.neotech.plugin.rootcoverage`.
24+
>
25+
> Soon current release (1.3.0) and older versions will no longer be available through
26+
> Bintray/JCenter, however since these versions have also been released to the Gradle Plugin Portal,
27+
> you can use that repository instead:
28+
> ```groovy
29+
> maven {
30+
> url "https://plugins.gradle.org/m2/"
31+
> }
32+
> ```
33+
>
34+
> The current version has been re-released with the new group ID and plugin ID to Maven Central and
35+
> the Gradle Plugin Portal (1.3.1), new versions will also be released to these repositories. See
36+
> the 'Setup' section of this readme on how to use this plugin with the updated group ID and
37+
> plugin ID.
1838
1939
# Setup
2040
Apply the Android-Root-Coverage-Plugin plugin to your top-level (root project) gradle file:
2141
2242
```groovy
2343
// Step 2: Apply the plugin to the top-level gradle file
24-
apply plugin: 'org.neotech.plugin.rootcoverage'
44+
apply plugin: 'nl.neotech.plugin.rootcoverage'
2545
2646
buildscript {
2747
dependencies {
2848
// Step 1: add the dependency
29-
classpath 'org.neotech.plugin:android-root-coverage-plugin:1.3.0'
49+
classpath 'nl.neotech.plugin:android-root-coverage-plugin:1.3.1'
3050
}
3151
}
3252
```
@@ -60,13 +80,16 @@ Android Studio using the Gradle Tool Window (see:
6080
# Compatibility
6181
| Version | Android Gradle plugin version | Gradle version |
6282
| ------------- | ----------------------------- | -------------- |
63-
| **1.3.0** | 3.6 | 5.6.4+ |
83+
| **1.3.1** | 3.6 | 5.6.4+ |
6484
| **1.2.1** | 3.5 | 5.4.1+ |
6585
| **1.1.2** | 3.4 | 5.1.1+ |
6686
| **1.1.1** | 3.3 | 4.10.1+ |
67-
| ~~**1.1.0**~~ | ~~3.3~~ | ~~5+~~ |
6887
| **1.0.2** | 3.2 | 4.6+ |
6988

89+
*Note: Versions below 1.3.1, such as 1.3.0, are only available on the Gradle Plugin Portal
90+
(`maven { url "https://plugins.gradle.org/m2/"}`) and not on Maven Central. These versions use the
91+
group ID `org.neotech.plugin` and plugin ID `org.neotech.plugin.rootcoverage`!*
92+
7093
*Note: This plugin normally supports exactly the same Gradle versions as the Android Gradle
7194
plugin, for more information please refer to:*
7295
<https://developer.android.com/studio/releases/gradle-plugin#updating-gradle>
@@ -93,6 +116,11 @@ rootCoverage {
93116
// Class exclude patterns
94117
excludes = ["**/some.package/**"]
95118
119+
// Since 1.1 generateHtml is by default true
120+
generateCsv false
121+
generateHtml true
122+
generateXml false
123+
96124
// Since 1.2: When false the plugin does not execute any tests, useful when you run the tests manually or remote (Firebase Test Lab)
97125
executeTests true
98126
@@ -121,10 +149,7 @@ projects. But if you like to add some actually functionality, this is the wish l
121149

122150
**How to test your changes/additions?**
123151
The plugin comes with an integration test. You can run this test either by executing
124-
`gradlew clean test` or run the test directly from Android Studio (or IntelliJ IDEA) using a proper run/test
125-
configuration as shown in the image *(by default it generates configuration that is not compatible
126-
with a plugin module)*:
127-
![Correct run/test configuration](correct-test-run-configuration.png)
152+
`gradlew clean test` or run the test directly from Android Studio (or IntelliJ IDEA).
128153

129154

130155
# Author note

build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,26 @@ buildscript {
77
apply from: "gradle/dependencies.gradle"
88

99
repositories {
10+
gradlePluginPortal()
1011
google()
11-
jcenter()
12+
mavenCentral()
1213
}
1314

1415
dependencies {
15-
classpath "com.github.ben-manes:gradle-versions-plugin:0.28.0"
16+
classpath "com.github.ben-manes:gradle-versions-plugin:0.38.0"
1617
}
1718
}
1819

1920
allprojects {
2021
repositories {
2122
google()
22-
jcenter()
23+
mavenCentral()
24+
jcenter {
25+
content {
26+
// https://youtrack.jetbrains.com/issue/IDEA-261387
27+
includeModule("org.jetbrains.trove4j", "trove4j")
28+
}
29+
}
2330
}
2431
}
2532

correct-test-run-configuration.png

-37.4 KB
Binary file not shown.

gradle.properties

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,17 @@ org.gradle.jvmargs=-Xmx1536m
1313
# org.gradle.parallel=true
1414

1515

16-
#These properties should be added to module specific gradle.properties files
17-
#NAME=
18-
#ARTIFACT_ID=
19-
#PACKAGING=jar
16+
GROUP=nl.neotech.plugin
2017

21-
GROUP=org.neotech.plugin
22-
VERSION=1.3.0
23-
DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.
18+
POM_URL=https://github.com/NeoTech-Software/android-root-coverage-plugin
19+
POM_SCM_URL=https://github.com/NeoTech-Software/android-root-coverage-plugin
20+
POM_SCM_CONNECTION=scm:git:git://github.com/NeoTech-Software/android-root-coverage-plugin.git
21+
POM_SCM_DEV_CONNECTION=scm:git:git://github.com/NeoTech-Software/android-root-coverage-plugin.git
2422

25-
PROJECT_WEBSITE=https://github.com/NeoTech-Software/android-root-coverage-plugin
26-
SCM_URL=https://github.com/NeoTech-Software/android-root-coverage-plugin
27-
SCM_CONNECTION=scm:git:git://github.com/NeoTech-Software/android-root-coverage-plugin.git
28-
SCM_DEV_CONNECTION=scm:git:git://github.com/NeoTech-Software/android-root-coverage-plugin.git
23+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
24+
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
25+
POM_LICENCE_DIST=repo
2926

30-
LICENCE=Apache-2.0
31-
LICENCE_NAME=The Apache Software License, Version 2.0
32-
LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
33-
LICENCE_DIST=repo
34-
35-
DEVELOPER_ID=rolf-smit
36-
DEVELOPER_NAME=Rolf Smit
37-
DEVELOPER_EMAIL=[email protected]
27+
POM_DEVELOPER_ID=rolf-smit
28+
POM_DEVELOPER_NAME=Rolf Smit
29+
POM_DEVELOPER_URL=https://github.com/username/

gradle/dependencies.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ ext {
2929
pluginVersions = [
3030
"org.jetbrains.kotlin.android" : "${projectVersion.kotlin}",
3131
"org.jetbrains.kotlin.jvm" : "${projectVersion.kotlin}",
32-
"com.jfrog.bintray" : "1.8.4",
3332
"com.github.dcendents.android-maven": "2.1",
34-
"com.gradle.plugin-publish" : "0.10.1"
33+
"com.gradle.plugin-publish" : "0.10.1",
34+
"org.jetbrains.dokka" : "1.4.30",
35+
"com.vanniktech.maven.publish" : "0.13.0"
3536
]
3637
}

plugin/build.gradle

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,63 @@ plugins {
22
id "org.jetbrains.kotlin.jvm"
33
id "java-gradle-plugin"
44

5-
// For publishing to Plugin Portal & Bintray
5+
// For publishing to Plugin Portal & Maven Central
66
id "com.gradle.plugin-publish"
77
id "com.github.dcendents.android-maven"
8-
id "com.jfrog.bintray"
8+
id "org.jetbrains.dokka"
9+
id "com.vanniktech.maven.publish" apply false
910
}
1011

11-
// To upload new plugin artifact to maven and Gradle Portal:
12-
// > gradlew bintrayUpload publishPlugins
12+
// See: https://github.com/vanniktech/gradle-maven-publish-plugin/issues/206
13+
ext {
14+
RELEASE_REPOSITORY_URL = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
15+
SNAPSHOT_REPOSITORY_URL = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
16+
}
17+
18+
apply plugin: "com.vanniktech.maven.publish"
19+
20+
// To upload new plugin artifact Gradle Portal:
21+
// > ./gradlew publishPlugins
22+
//
23+
// To upload new plugin artifact to Maven Central Repository:
24+
// > ./gradlew publishPluginMavenPublicationToMavenCentralRepository --no-daemon --no-parallel
1325
//
1426
// To test the plugin:
15-
// > gradlew clean test
27+
// > ./gradlew clean test
1628

1729
sourceCompatibility = JavaVersion.VERSION_1_8
1830
targetCompatibility = JavaVersion.VERSION_1_8
1931

32+
33+
publishing {
34+
repositories {
35+
maven {
36+
url = version.endsWith('SNAPSHOT') ? SNAPSHOT_REPOSITORY_URL : RELEASE_REPOSITORY_URL
37+
name = "mavenCentral"
38+
credentials {
39+
Properties properties = new Properties()
40+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
41+
42+
username = properties.getProperty("ossrhUsername")
43+
password = properties.getProperty("ossrhPassword")
44+
}
45+
}
46+
}
47+
}
48+
2049
gradlePlugin {
2150
plugins {
2251
rootCoverage {
23-
id = 'org.neotech.plugin.rootcoverage'
52+
id = 'nl.neotech.plugin.rootcoverage'
2453
implementationClass = 'org.neotech.plugin.rootcoverage.RootCoveragePlugin'
2554
}
2655
}
2756
}
2857

2958
pluginBundle {
30-
setWebsite(PROJECT_WEBSITE)
31-
vcsUrl = 'https://github.com/NeoTech-Software/Android-Root-Coverage-Plugin'
32-
setDescription(DESCRIPTION)
59+
setWebsite(POM_URL)
60+
vcsUrl = POM_SCM_URL
61+
setDescription(POM_DESCRIPTION)
3362
tags = ['android', 'coverage', 'jacoco', 'code-coverage', 'coverage-report', 'aggregated-report']
3463

3564
plugins {
@@ -40,8 +69,8 @@ pluginBundle {
4069

4170
mavenCoordinates {
4271
groupId = GROUP
43-
artifactId = ARTIFACT_ID
44-
version = VERSION
72+
artifactId = POM_ARTIFACT_ID
73+
version = VERSION_NAME
4574
}
4675
}
4776

@@ -66,4 +95,4 @@ dependencies {
6695
testImplementation projectDependency.commonsCsv
6796
}
6897

69-
apply from: rootProject.file('publish.gradle')
98+
// apply from: rootProject.file('publish.gradle')

plugin/gradle.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
ARTIFACT_ID=android-root-coverage-plugin
2-
NAME=Android-Root-Coverage-Plugin
3-
PACKAGING=jar
1+
POM_ARTIFACT_ID=android-root-coverage-plugin
2+
VERSION_NAME=1.3.1
3+
POM_NAME=Android Root Coverage Plugin
4+
POM_DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.

plugin/src/test/test-fixtures/multi-module/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77

88
repositories {
99
google()
10-
jcenter()
10+
mavenCentral()
1111
}
1212
dependencies {
1313
classpath projectDependency.androidGradlePlugin
@@ -18,13 +18,13 @@ buildscript {
1818

1919
plugins {
2020
id 'jacoco'
21-
id 'org.neotech.plugin.rootcoverage'
21+
id 'nl.neotech.plugin.rootcoverage'
2222
}
2323

2424
allprojects {
2525
repositories {
2626
google()
27-
jcenter()
27+
mavenCentral()
2828
}
2929
}
3030

@@ -34,7 +34,7 @@ task clean(type: Delete) {
3434

3535
jacoco {
3636
// https://www.jacoco.org/jacoco/trunk/doc/changes.html
37-
toolVersion = "0.8.5"
37+
toolVersion = "0.8.6"
3838
}
3939

4040
rootCoverage {

0 commit comments

Comments
 (0)