Skip to content

Commit 7da3645

Browse files
committed
BUILD : Added Maven upload and released 0.5.2 version
1 parent ed7630d commit 7da3645

5 files changed

Lines changed: 147 additions & 6 deletions

File tree

gradle.properties

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
# Project-wide Gradle settings.
22

3+
VERSION_NAME=0.5.2
4+
VERSION_CODE=52
5+
36
REPOSITORY_NAME=maven
4-
POM_PACKAGE_GROUP=com.matpag
7+
POM_GROUP=com.matpag
58
POM_ARTIFACT_ID=clickdrawabletextview
69
POM_DEVELOPER_ID=soulcyber
10+
POM_DEVELOPER_NAME=Mattia Pagini
711
POM_DESCRIPTION=Android library to handle click on Textview drawables
812
POM_URL=https://github.com/matpag/ClickDrawableTextView
9-
VERSION_NAME=0.5.1
13+
POM_SCM_URL=https://github.com/matpag/ClickDrawableTextView
14+
POM_SCM_CONNECTION=scm:git@github.com:matpag/ClickDrawableTextView.git
15+
POM_SCM_DEV_CONNECTION=scm:git@github.com:matpag/ClickDrawableTextView.git
16+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
17+
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
18+
POM_LICENCE_DIST=repo

library/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
defaultConfig {
99
minSdkVersion setup.minSdk
1010
targetSdkVersion setup.targetSdk
11-
versionCode 2
12-
versionName "0.5.1"
11+
versionCode 52
12+
versionName "0.5.2"
1313

1414
vectorDrawables.useSupportLibrary = true
1515
}
@@ -21,7 +21,8 @@ android {
2121
}
2222
}
2323

24-
apply from: '../gradle-jcenter-push.gradle'
24+
apply from: 'gradle-jcenter-push.gradle'
25+
apply from: 'gradle-mvn-push.gradle'
2526

2627
dependencies {
2728
compile fileTree(dir: 'libs', include: ['*.jar'])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ publish {
44
bintrayKey = project.hasProperty('bintray.apikey') ? project.property('bintray.apikey') : System.getenv('BINTRAY_API_KEY')
55
repoName = project.property("REPOSITORY_NAME")
66
userOrg = project.property("POM_DEVELOPER_ID")
7-
groupId = project.property("POM_PACKAGE_GROUP")
7+
groupId = project.property("POM_GROUP")
88
artifactId = project.property("POM_ARTIFACT_ID")
99
publishVersion = project.property("VERSION_NAME")
1010
desc = project.property("POM_DESCRIPTION")

library/gradle-mvn-push.gradle

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
* Copyright 2013 Chris Banes
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
apply plugin: 'maven'
18+
apply plugin: 'signing'
19+
20+
Properties properties = new Properties()
21+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
22+
23+
def isReleaseBuild() {
24+
return VERSION_NAME.contains("SNAPSHOT") == false
25+
}
26+
27+
def getReleaseRepositoryUrl() {
28+
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
29+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
30+
}
31+
32+
def getSnapshotRepositoryUrl() {
33+
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
34+
: "https://oss.sonatype.org/content/repositories/snapshots/"
35+
}
36+
37+
def getRepositoryUsername() {
38+
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
39+
}
40+
41+
def getRepositoryPassword() {
42+
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
43+
}
44+
45+
afterEvaluate { project ->
46+
uploadArchives {
47+
repositories {
48+
mavenDeployer {
49+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
50+
51+
pom.groupId = POM_GROUP
52+
pom.artifactId = POM_ARTIFACT_ID
53+
pom.version = VERSION_NAME
54+
55+
repository(url: getReleaseRepositoryUrl()) {
56+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
57+
}
58+
snapshotRepository(url: getSnapshotRepositoryUrl()) {
59+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
60+
}
61+
62+
pom.project {
63+
name POM_NAME
64+
packaging POM_PACKAGING
65+
description POM_DESCRIPTION
66+
url POM_URL
67+
68+
scm {
69+
url POM_SCM_URL
70+
connection POM_SCM_CONNECTION
71+
developerConnection POM_SCM_DEV_CONNECTION
72+
}
73+
74+
licenses {
75+
license {
76+
name POM_LICENCE_NAME
77+
url POM_LICENCE_URL
78+
distribution POM_LICENCE_DIST
79+
}
80+
}
81+
82+
developers {
83+
developer {
84+
id POM_DEVELOPER_ID
85+
name POM_DEVELOPER_NAME
86+
}
87+
}
88+
}
89+
}
90+
}
91+
}
92+
93+
signing {
94+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
95+
sign configurations.archives
96+
}
97+
98+
android.libraryVariants.all { variant ->
99+
def javadocTask = task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
100+
description "Generates Javadoc for $variant.name."
101+
source = variant.javaCompile.source
102+
ext.androidJar = project.files(android.getBootClasspath().join(File.pathSeparator))
103+
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
104+
exclude '**/BuildConfig.java'
105+
exclude '**/R.java'
106+
}
107+
108+
javadocTask.dependsOn variant.javaCompile
109+
110+
def jarJavadocTask = task("jar${variant.name.capitalize()}Javadoc", type: Jar) {
111+
description "Generate Javadoc Jar for $variant.name"
112+
classifier = 'javadoc'
113+
from javadocTask.destinationDir
114+
}
115+
116+
jarJavadocTask.dependsOn javadocTask
117+
artifacts.add('archives', jarJavadocTask)
118+
119+
def jarSourceTask = task("jar${variant.name.capitalize()}Sources", type: Jar) {
120+
description "Generates Java Sources for $variant.name."
121+
classifier = 'sources'
122+
from variant.javaCompile.source
123+
}
124+
125+
jarSourceTask.dependsOn variant.javaCompile
126+
artifacts.add('archives', jarSourceTask)
127+
}
128+
}

library/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
POM_NAME=ClickDrawable Library
2+
POM_ARTIFACT_ID=clickdrawabletextview
3+
POM_PACKAGING=aar

0 commit comments

Comments
 (0)