Skip to content

Commit df0244c

Browse files
author
jogehring
committed
refs jjoe64#153 maven push properties
1 parent 550ebfc commit df0244c

File tree

4 files changed

+99
-1
lines changed

4 files changed

+99
-1
lines changed

GraphView.iml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="GraphView-Demos" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.jjoe64" external.system.module.version="3.1.3" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
@@ -58,7 +58,9 @@
5858
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
5959
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
6060
<excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
61+
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
6162
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
63+
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
6264
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
6365
</content>
6466
<orderEntry type="jdk" jdkName="Android API 20 Platform" jdkType="Android SDK" />

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ task makeJar(type: Copy) {
3737

3838
makeJar.dependsOn(clearJar, build)
3939

40+
apply from: './maven_push.gradle'

gradle.properties

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

maven_push.gradle

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
apply plugin: 'maven'
2+
apply plugin: 'signing'
3+
4+
def sonatypeRepositoryUrl
5+
if (isReleaseBuild()) {
6+
println 'RELEASE BUILD'
7+
sonatypeRepositoryUrl = hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
8+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
9+
} else {
10+
println 'DEBUG BUILD'
11+
sonatypeRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
12+
: "https://oss.sonatype.org/content/repositories/snapshots/"
13+
}
14+
15+
def getRepositoryUsername() {
16+
return hasProperty('nexusUsername') ? nexusUsername : ""
17+
}
18+
19+
def getRepositoryPassword() {
20+
return hasProperty('nexusPassword') ? nexusPassword : ""
21+
}
22+
23+
afterEvaluate { project ->
24+
uploadArchives {
25+
repositories {
26+
mavenDeployer {
27+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
28+
29+
pom.artifactId = POM_ARTIFACT_ID
30+
31+
repository(url: sonatypeRepositoryUrl) {
32+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
33+
}
34+
35+
pom.project {
36+
name POM_NAME
37+
packaging POM_PACKAGING
38+
description POM_DESCRIPTION
39+
url POM_URL
40+
41+
scm {
42+
url POM_SCM_URL
43+
connection POM_SCM_CONNECTION
44+
developerConnection POM_SCM_DEV_CONNECTION
45+
}
46+
47+
licenses {
48+
license {
49+
name POM_LICENCE_NAME
50+
url POM_LICENCE_URL
51+
distribution POM_LICENCE_DIST
52+
}
53+
}
54+
55+
developers {
56+
developer {
57+
id POM_DEVELOPER_ID
58+
name POM_DEVELOPER_NAME
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+
66+
signing {
67+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
68+
sign configurations.archives
69+
}
70+
71+
task androidJavadocs(type: Javadoc) {
72+
source = android.sourceSets.main.java.sourceFiles
73+
}
74+
75+
task androidJavadocsJar(type: Jar) {
76+
classifier = 'javadoc'
77+
//basename = artifact_id
78+
from androidJavadocs.destinationDir
79+
}
80+
81+
task androidSourcesJar(type: Jar) {
82+
classifier = 'sources'
83+
//basename = artifact_id
84+
from android.sourceSets.main.java.sourceFiles
85+
}
86+
87+
artifacts {
88+
//archives packageReleaseJar
89+
archives androidSourcesJar
90+
archives androidJavadocsJar
91+
}
92+
}

0 commit comments

Comments
 (0)