-
Notifications
You must be signed in to change notification settings - Fork 20
/
publish_aar_jar.gradle
97 lines (92 loc) · 3.32 KB
/
publish_aar_jar.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
88
89
90
91
92
93
94
95
96
97
apply plugin: 'signing'
apply plugin: 'maven-publish'
def properties = new Properties()
properties.load(rootProject.file("local.properties").newDataInputStream())
def ossrhUsername = properties.getProperty("ossrhUsername")
def ossrhPassword = properties.getProperty("ossrhPassword")
if (project.plugins.hasPlugin("java-library")) {
tasks.register('javadocJar', Jar) {
from javadoc
archiveClassifier.convention("javadoc")
archiveClassifier.set("javadoc")
}
tasks.register('javaSourcesJar', Jar) {
from sourceSets.main.java.srcDirs
archiveClassifier.convention("sources")
archiveClassifier.set("sources")
}
} else if (project.plugins.hasPlugin("com.android.library")) {
tasks.register('androidSourcesJar', Jar) {
from android.sourceSets.main.java.srcDirs
// classifier = 'sources'
}
}
def kmvvm_version = rootProject.kmvvmVersion
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
if (project.plugins.hasPlugin("com.android.library")) {
from components.release
artifact androidSourcesJar
} else if (project.plugins.hasPlugin("java-library")) {
from components.java
artifact javadocJar
artifact javaSourcesJar
}
def projectName = project.name
groupId = 'io.github.catchpig.kmvvm'
artifactId = projectName
version = kmvvm_version
pom {
name = 'kmvvm'
description = 'kmvvm'
url = 'https://github.com/catchpig/kmvvm'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'zhuazhu'
name = 'zhuazhu'
email = '327785185@qq.com'
}
}
scm {
connection = 'https://github.com/catchpig/kmvvm'
developerConnection = 'https://github.com/catchpig/kmvvm.git'
url = 'https://github.com/catchpig/kmvvm'
}
}
}
}
repositories {
maven {
name 'local'
url "${rootProject.buildDir}"
}
maven {
name 'mavenCentralSnapshot'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
maven {
name 'mavenCentral'
url 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
signing {
sign publishing.publications.release
}
}