-
Notifications
You must be signed in to change notification settings - Fork 15
/
maven-push-release.gradle
126 lines (105 loc) · 4.03 KB
/
maven-push-release.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
group = "io.hyphenate"
archivesBaseName = "ease-call-kit"
version = project.sdkVersion//发布aar的库版本
apply plugin: 'maven'
apply plugin: 'signing'
def repositoryId = project.stagingRepositoryId
def localProperties = new Properties()
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
Properties properties = new Properties()
properties.load(file(localProperties.getProperty('maven.dir')+"./project.properties").newDataInputStream())
def ossrhUsername = properties.getProperty('ossrhUsername')
def ossrhPassword = properties.getProperty('ossrhPassword')
//指定singing的相关信息
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
def id = properties.getProperty("signing.keyId")
def file = localProperties.getProperty('maven.dir')+properties.getProperty("signing.secretKeyRingFile")
def password = properties.getProperty("signing.password")
allprojects { ext."signing.keyId" = id }
allprojects { ext."signing.secretKeyRingFile" = file }
allprojects { ext."signing.password" = password }
}
}
configurations {
deployerJars
}
task javadoc(type: Javadoc) {
options {
encoding 'UTF-8'
charSet 'UTF-8'
}
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.source = variant.javaCompiler.source
owner.classpath = files(android.bootClasspath.join(File.pathSeparator))
owner.classpath += variant.javaCompiler.classpath
}
}
failOnError false
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
nexusStaging {
packageGroup = "$group" //optional if packageGroup == project.getGroup()
stagingProfileId = "$group" //when not defined will be got from server using "packageGroup"
username = ossrhUsername
password = ossrhPassword
stagingRepositoryId = repositoryId
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
//version version
name archivesBaseName
packaging 'aar'
// optionally artifactId can be defined here
//println "current groupId:$group"
//groupId group
//artifactId archivesBaseName
description 'Easy call UI for Easemob IM SDK'
url 'https://github.com/easemob/easecallkitui-android'
scm {
connection 'scm:git@github.com:easemob/easecallkitui.git'
developerConnection 'scm:git@github.com:easemob/easecallkitui.git'
url 'https://github.com/easemob/easecallkitui-android.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'Easemob'
name 'Easemob'
email 'sdk-tools@easemob.com'
}
}
}
}
}
}