Skip to content

Commit b3a6f3d

Browse files
committed
Maven Release 1.0.0
1 parent 332a6b5 commit b3a6f3d

File tree

5 files changed

+144
-28
lines changed

5 files changed

+144
-28
lines changed

build.gradle

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:0.12.+'
7+
}
8+
}
9+
10+
allprojects {
11+
repositories {
12+
jcenter()
13+
}
14+
}

gradle.properties

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
VERSION_NAME=1.0.0
22
VERSION_CODE=1
3-
GROUP=lt.lemonlabs.android.expandablebuttonmenu
3+
GROUP=co.lemonlabs
44

5+
POM_NAME=ExpandableButtonMenu
6+
POM_ARTIFACT_ID=expandable-button-menu
7+
POM_PACKAGING=aar
58
POM_DESCRIPTION=Android Library for an expandable button menu
6-
#POM_URL=
7-
#POM_SCM_URL=
8-
#POM_SCM_CONNECTION=
9-
#POM_SCM_DEV_CONNECTION=
9+
POM_URL=https://github.com/lemonlabs/ExpandableButtonMenu
10+
POM_SCM_URL=https://github.com/lemonlabs/ExpandableButtonMenu
11+
POM_SCM_CONNECTION=scm:[email protected]:lemonlabs/ExpandableButtonMenu.git
12+
POM_SCM_DEV_CONNECTION=scm:[email protected]:lemonlabs/ExpandableButtonMenu.git
1013
POM_LICENCE_NAME=The Apache Software License, Version 2.0
1114
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
1215
POM_LICENCE_DIST=repo

library/build.gradle

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
}
5-
dependencies {
6-
classpath 'com.android.tools.build:gradle:0.12.+'
7-
}
8-
}
91
apply plugin: 'com.android.library'
102

11-
repositories {
12-
mavenCentral()
13-
}
14-
153
android {
164
compileSdkVersion 19
175
buildToolsVersion '20.0.0'
186

197
defaultConfig {
8+
applicationId "lt.lemonlabs.android.expandablebuttonmenu"
209
minSdkVersion 9
2110
targetSdkVersion 19
11+
versionCode 1
12+
versionName "1.0.0"
2213
}
2314

2415
compileOptions {
@@ -31,3 +22,5 @@ dependencies {
3122
compile 'com.android.support:appcompat-v7:19.1.0'
3223
compile 'com.nineoldandroids:library:2.4.0'
3324
}
25+
26+
apply from: './maven_push.gradle'

library/library.iml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,11 @@
5757
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
5858
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
5959
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
60-
<excludeFolder url="file://$MODULE_DIR$/build/bundles" />
61-
<excludeFolder url="file://$MODULE_DIR$/build/classes" />
62-
<excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
63-
<excludeFolder url="file://$MODULE_DIR$/build/exploded-bundles" />
64-
<excludeFolder url="file://$MODULE_DIR$/build/incremental" />
60+
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
6561
<excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
6662
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
67-
<excludeFolder url="file://$MODULE_DIR$/build/lint" />
68-
<excludeFolder url="file://$MODULE_DIR$/build/ndk" />
6963
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
70-
<excludeFolder url="file://$MODULE_DIR$/build/res" />
71-
<excludeFolder url="file://$MODULE_DIR$/build/rs" />
72-
<excludeFolder url="file://$MODULE_DIR$/build/source" />
64+
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
7365
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
7466
</content>
7567
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />

library/maven_push.gradle

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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+
def isReleaseBuild() {
21+
return version.contains("SNAPSHOT") == false
22+
}
23+
24+
def getReleaseRepositoryUrl() {
25+
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
26+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
27+
}
28+
29+
def getSnapshotRepositoryUrl() {
30+
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
31+
: "https://oss.sonatype.org/content/repositories/snapshots/"
32+
}
33+
34+
def getRepositoryUsername() {
35+
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
36+
}
37+
38+
def getRepositoryPassword() {
39+
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
40+
}
41+
42+
afterEvaluate { project ->
43+
uploadArchives {
44+
//noinspection GradleMisplacedStatement
45+
repositories {
46+
mavenDeployer {
47+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
48+
49+
pom.artifactId = POM_ARTIFACT_ID
50+
pom.groupId = GROUP
51+
pom.version = VERSION_NAME
52+
53+
repository(url: getReleaseRepositoryUrl()) {
54+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
55+
}
56+
snapshotRepository(url: getSnapshotRepositoryUrl()) {
57+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
58+
}
59+
60+
pom.project {
61+
name POM_NAME
62+
packaging POM_PACKAGING
63+
description POM_DESCRIPTION
64+
url POM_URL
65+
66+
scm {
67+
url POM_SCM_URL
68+
connection POM_SCM_CONNECTION
69+
developerConnection POM_SCM_DEV_CONNECTION
70+
}
71+
72+
licenses {
73+
license {
74+
name POM_LICENCE_NAME
75+
url POM_LICENCE_URL
76+
distribution POM_LICENCE_DIST
77+
}
78+
}
79+
80+
developers {
81+
developer {
82+
id POM_DEVELOPER_ID
83+
name POM_DEVELOPER_NAME
84+
}
85+
}
86+
}
87+
}
88+
}
89+
}
90+
91+
signing {
92+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
93+
sign configurations.archives
94+
}
95+
96+
task androidJavadocs(type: Javadoc) {
97+
source = android.sourceSets.main.java.source
98+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
99+
}
100+
101+
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
102+
classifier = 'javadoc'
103+
from androidJavadocs.destinationDir
104+
}
105+
106+
task androidSourcesJar(type: Jar) {
107+
classifier = 'sources'
108+
from android.sourceSets.main.java.source
109+
}
110+
111+
artifacts {
112+
archives androidSourcesJar
113+
archives androidJavadocsJar
114+
}
115+
}

0 commit comments

Comments
 (0)