-
Notifications
You must be signed in to change notification settings - Fork 0
/
mavenUpload.gradle
53 lines (45 loc) · 1.51 KB
/
mavenUpload.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
apply plugin: 'maven'
def VERSION_NAME = android.getDefaultConfig().versionName
def isSnapshotBuild = VERSION_NAME.contains("SNAPSHOT")
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError = false
options.encoding = "UTF-8"
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
if (!isSnapshotBuild) {
archives javadocJar
archives sourcesJar
}
}
uploadArchives {
repositories {
mavenDeployer {
snapshotRepository(url: MAVEN_REPO_SNAPSHOT) {
authentication(userName: MAVEN_REPO_USERNAME, password: MAVEN_REPO_PASSWORD)
}
repository(url: MAVEN_REPO_RELEASE) {
authentication(userName: MAVEN_REPO_USERNAME, password: MAVEN_REPO_PASSWORD)
}
pom.project {
groupId MAVEN_REPO_GROUP
artifactId MAVEN_REPO_ARTIFACT
version VERSION_NAME
packaging 'aar'
}
println 'Group Id:' + MAVEN_REPO_GROUP
println 'Artifact:' + MAVEN_REPO_ARTIFACT
println 'Version:' + VERSION_NAME
println 'Maven Repository:' + (isSnapshotBuild ? MAVEN_REPO_SNAPSHOT : MAVEN_REPO_RELEASE)
}
}
}