Skip to content

Commit 238cc40

Browse files
committed
Publish improvements.
1 parent 6a81863 commit 238cc40

File tree

5 files changed

+76
-81
lines changed

5 files changed

+76
-81
lines changed

gradle.properties

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,26 @@ org.gradle.jvmargs=-Xmx1536m
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
# org.gradle.parallel=true
1414

15-
GROUP=org.neotech.plugin
16-
VERSION_NAME=1.0.0-SNAPSHOT
1715

18-
BINTRAY_REPO=maven
19-
BINTRAY_LICENCE=Apache-2.0
16+
#These properties should be added to module specific gradle.properties files
17+
#NAME=
18+
#ARTIFACT_ID=
19+
#PACKAGING=jar
2020

21-
POM_DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.
21+
GROUP=org.neotech.plugin
22+
VERSION=0.0.0-dev
23+
DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.
2224

23-
POM_URL=https://github.com/NeoTech-Software/android-root-coverage-plugin
24-
POM_SCM_URL=https://github.com/NeoTech-Software/android-root-coverage-plugin
25-
POM_SCM_CONNECTION=scm:git:git://github.com/NeoTech-Software/android-root-coverage-plugin.git
26-
POM_SCM_DEV_CONNECTION=scm:git:git://github.com/NeoTech-Software/android-root-coverage-plugin.git
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
2729

28-
POM_LICENCE_NAME=The Apache Software License, Version 2.0
29-
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
30-
POM_LICENCE_DIST=repo
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
3134

32-
POM_DEVELOPER_ID=rolf-smit
33-
POM_DEVELOPER_NAME=Rolf Smit
34-
POM_DEVELOPER_EMAIL=[email protected]
35+
DEVELOPER_ID=rolf-smit
36+
DEVELOPER_NAME=Rolf Smit
37+
DEVELOPER_EMAIL=[email protected]

plugin/build.gradle

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ apply plugin: 'kotlin'
33
apply plugin: 'maven'
44

55
// To upload new artifact to maven:
6-
// > gradlew install
76
// > gradlew bintrayUpload
87

9-
//Without this line the Bintray upload will fail as it uses the module directory name as artifactId
10-
118
sourceCompatibility = JavaVersion.VERSION_1_8
129
targetCompatibility = JavaVersion.VERSION_1_8
1310

1411
dependencies {
15-
implementation gradleApi()
16-
implementation deps.kotlinPlugin
12+
compileOnly gradleApi()
1713
implementation deps.gradlePlugin
1814
implementation deps.kotlinStdlibJdk7
1915
}
@@ -28,8 +24,4 @@ uploadArchives {
2824
}
2925
}
3026

31-
// For publishing to external maven repository
32-
archivesBaseName = POM_ARTIFACT_ID
33-
group = GROUP
34-
version = VERSION_NAME
3527
apply from: rootProject.file('publish.gradle')

plugin/gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
POM_ARTIFACT_ID=android-root-coverage-plugin
2-
POM_NAME=Android-Root-Coverage-Plugin
3-
POM_PACKAGING=jar
1+
ARTIFACT_ID=android-root-coverage-plugin
2+
NAME=Android-Root-Coverage-Plugin
3+
PACKAGING=jar

plugin/src/main/kotlin/org/neotech/library/rootcoverage/RootCoveragePlugin.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class RootCoveragePlugin: Plugin<Project> {
1515
private lateinit var rootProjectExtension: RootCoveragePluginExtension;
1616

1717
override fun apply(project: Project) {
18-
println("RootCoveragePlugin v1.0.0-SNAPSHOT")
1918
if(project.rootProject !== project) {
2019
throw GradleException("The RootCoveragePlugin can not be applied to project '${project.name}' (${project.buildFile}) because it is not the root project!")
2120
}

publish.gradle

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
11
apply plugin: 'maven'
22

3-
version = VERSION_NAME
4-
group = GROUP // Maven Group ID for the artifact
5-
3+
// project.archivesBaseName is added by the Maven plugin to the project, the value defaults to the
4+
// project.name property, but since project.name is basically the current folder name the desired
5+
// archive name is often different hence the explicit assignment.
6+
project.archivesBaseName = ARTIFACT_ID
7+
project.version = VERSION
8+
project.group = GROUP
69

710
install {
8-
repositories.mavenInstaller {
9-
// This generates POM.xml with proper parameters
10-
pom {
11-
12-
groupId = GROUP
13-
artifactId = POM_ARTIFACT_ID
14-
version = VERSION_NAME
15-
16-
project {
17-
packaging POM_PACKAGING
18-
19-
20-
// Add your description here
21-
name POM_NAME
22-
description POM_DESCRIPTION
23-
url POM_URL
24-
25-
// Set your license
26-
licenses {
27-
license {
28-
name POM_LICENCE_NAME
29-
url POM_LICENCE_URL
11+
repositories{
12+
mavenInstaller {
13+
// This generates POM.xml with proper parameters
14+
pom {
15+
groupId = GROUP
16+
artifactId = ARTIFACT_ID
17+
version = VERSION
18+
19+
project {
20+
packaging PACKAGING
21+
name NAME
22+
description DESCRIPTION
23+
url PROJECT_WEBSITE
24+
25+
licenses {
26+
license {
27+
name LICENCE_NAME
28+
url LICENCE_URL
29+
}
3030
}
31-
}
32-
developers {
33-
developer {
34-
id POM_DEVELOPER_ID
35-
name POM_DEVELOPER_NAME
36-
email POM_DEVELOPER_EMAIL
31+
developers {
32+
developer {
33+
id DEVELOPER_ID
34+
name DEVELOPER_NAME
35+
email DEVELOPER_EMAIL
36+
}
37+
}
38+
scm {
39+
connection SCM_CONNECTION
40+
developerConnection SCM_DEV_CONNECTION
41+
url SCM_URL
3742
}
38-
}
39-
scm {
40-
connection POM_SCM_CONNECTION
41-
developerConnection POM_SCM_DEV_CONNECTION
42-
url POM_SCM_URL
43-
4443
}
4544
}
4645
}
4746
}
4847
}
4948

50-
apply plugin: 'com.jfrog.bintray'
51-
5249
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')) {
5350
// Android libraries
5451

@@ -81,7 +78,6 @@ if (project.getPlugins().hasPlugin('com.android.application') || project.getPlug
8178
}
8279
}
8380

84-
8581
artifacts {
8682
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')) {
8783
archives androidSourcesJar
@@ -93,28 +89,33 @@ artifacts {
9389
}
9490

9591
// Bintray
92+
apply plugin: 'com.jfrog.bintray'
93+
9694
Properties properties = new Properties()
97-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
95+
properties.load(project.rootProject.file("local.properties").newDataInputStream())
9896

9997
bintray {
10098
user = properties.getProperty("bintray.user")
10199
key = properties.getProperty("bintray.apikey")
102100

103-
configurations = ['archives']
101+
publish = true
102+
configurations = ["archives"]
104103

105-
// Bintry package information
104+
// Package information
106105
pkg {
107-
repo = BINTRAY_REPO
108-
name = POM_ARTIFACT_ID
109-
desc = POM_DESCRIPTION
110-
websiteUrl = POM_URL
111-
vcsUrl = POM_SCM_URL
112-
licenses = [BINTRAY_LICENCE]
113-
publish = true
114-
publicDownloadNumbers = true
106+
repo = "maven"
107+
name = ARTIFACT_ID
108+
desc = DESCRIPTION
109+
websiteUrl = PROJECT_WEBSITE
110+
vcsUrl = SCM_URL
111+
licenses = [LICENCE]
115112
version {
116-
name = VERSION_NAME
113+
name = VERSION
114+
vcsTag = VERSION
117115
released = new Date();
118116
}
119117
}
120-
}
118+
}
119+
120+
// Make sure clean and install are executed before upload.
121+
bintrayUpload.dependsOn clean, install

0 commit comments

Comments
 (0)