Skip to content

Commit dd4351b

Browse files
committed
all: update maven-publish
1 parent 068f10a commit dd4351b

File tree

2 files changed

+12
-58
lines changed

2 files changed

+12
-58
lines changed

Diff for: hms-plugin/build.gradle

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,16 @@ android {
4242
}
4343
}
4444
}
45+
publishing {
46+
singleVariant("release") {
47+
withSourcesJar()
48+
withJavadocJar()
49+
}
50+
}
4551
}
4652

4753
dependencies {
48-
api 'com.batch.android:batch-sdk:2.0+'
54+
api 'com.batch.android:batch-sdk:2.0.3'
4955
api 'com.huawei.hms:push:6.5.0.300'
5056
implementation "androidx.annotation:annotation:$androidXLibraryVersion"
5157

Diff for: hms-plugin/maven-publish.gradle

+5-57
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,17 @@ if (signingFile.exists()) {
1818
}
1919
}
2020

21-
task androidJavadocs(type: Javadoc) {
22-
source = android.sourceSets.main.java.srcDirs
23-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
24-
android.libraryVariants.all { variant ->
25-
if (variant.name == 'release') {
26-
owner.classpath += variant.getCompileClasspath()
27-
}
28-
}
29-
exclude '**/R.html', '**/R.*.html', '**/index.html'
30-
}
31-
32-
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
33-
archiveClassifier.set("javadoc")
34-
from androidJavadocs.destinationDir
35-
}
36-
37-
task androidSourcesJar(type: Jar) {
38-
archiveClassifier.set("sources")
39-
from android.sourceSets.main.java.srcDirs
40-
}
41-
4221
publishing {
4322
publications {
44-
HMSSDK(MavenPublication) {
23+
release(MavenPublication) {
4524

4625
groupId mavenGroupId
4726
artifactId mavenArtifact
4827
version android.defaultConfig.versionName
4928

50-
artifact "$buildDir/outputs/aar/hms-plugin-release.aar"
51-
artifact androidJavadocsJar
52-
artifact androidSourcesJar
29+
afterEvaluate {
30+
from components.release
31+
}
5332

5433
pom {
5534
name = "Batch.com Android HMS SDK"
@@ -88,37 +67,6 @@ publishing {
8867
url = "https://batch.com"
8968
}
9069
}
91-
92-
pom.withXml {
93-
final dependenciesNode = asNode().appendNode('dependencies')
94-
ext.addDependency = { Dependency dep, String scope ->
95-
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
96-
return // ignore invalid dependencies
97-
98-
final dependencyNode = dependenciesNode.appendNode('dependency')
99-
dependencyNode.appendNode('groupId', dep.group)
100-
dependencyNode.appendNode('artifactId', dep.name)
101-
dependencyNode.appendNode('version', dep.version)
102-
dependencyNode.appendNode('scope', scope)
103-
104-
if (!dep.transitive) {
105-
// If this dependency is transitive, we should force exclude all its dependencies them from the POM
106-
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
107-
exclusionNode.appendNode('groupId', '*')
108-
exclusionNode.appendNode('artifactId', '*')
109-
} else if (!dep.properties.excludeRules.empty) {
110-
// Otherwise add specified exclude rules
111-
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
112-
dep.properties.excludeRules.each { ExcludeRule rule ->
113-
exclusionNode.appendNode('groupId', rule.group ?: '*')
114-
exclusionNode.appendNode('artifactId', rule.module ?: '*')
115-
}
116-
}
117-
}
118-
119-
configurations.api.getDependencies().each { dep -> addDependency(dep, "compile") }
120-
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
121-
}
12270
}
12371
}
12472

@@ -140,7 +88,7 @@ publishing {
14088
}
14189

14290
signing {
143-
sign publishing.publications.HMSSDK
91+
sign publishing.publications.release
14492
}
14593

14694
// Do not sign if we run the publishToMavenLocal task, useful for dev

0 commit comments

Comments
 (0)