forked from Colovaria-Graphics/Colovaria-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
87 lines (79 loc) · 2.4 KB
/
publish.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
def publication_name = null
def component_name = null
def is_android_build = false
switch (ext.publish_type) {
case "android":
publication_name = "release"
component_name = "release"
is_android_build = true
break
case "java":
publication_name = "mavenJava"
component_name = "java"
break
default:
throw new Exception("Unknown publish_type: " + ext.publish_type)
}
task androidSourcesJar(type: Jar) {
archiveClassifier.set("sources")
if (project.plugins.findPlugin("com.android.library")) {
from android.sourceSets.main.java.srcDirs
}
}
publishing {
repositories {
maven {
credentials {
username = System.getProperty("repo_username")
password = System.getProperty("repo_password")
}
url = version.endsWith("SNAPSHOT") ? REPO_SNAPSHOTS_URL : REPO_RELEASES_URL
}
}
publications {
create(publication_name, MavenPublication) {
groupId = PUBLISH_GROUP
artifactId = POM_NAME
from components.findByName(component_name)
if (is_android_build) {
artifact androidSourcesJar
artifact "$buildDir/outputs/aar/" + artifactId + "-debug.aar"
}
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name = POM_NAME
description = POM_DESCRIPTION
version = POM_VERSION
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
}
}
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
}
}
}
}
signing {
sign publishing.publications
}