@@ -42,26 +42,14 @@ def getRepositoryPassword() {
42
42
}
43
43
44
44
afterEvaluate { project ->
45
- task androidSourcesJar(type : Jar ) {
46
- classifier = ' sources'
47
- from android. sourceSets. main. java. source
48
- }
49
-
50
-
51
45
publishing {
52
46
publications {
53
47
library(MavenPublication ) {
54
48
groupId POM_GROUP
55
49
artifactId POM_ARTIFACT_ID
56
50
version VERSION_NAME
57
51
58
- artifact(" ${ buildDir} /outputs/aar/${ artifactId} -release.aar" )
59
- if (project. getPlugins(). hasPlugin(' com.android.application' ) ||
60
- project. getPlugins(). hasPlugin(' com.android.library' )) {
61
- artifact(androidSourcesJar)
62
- } else {
63
- artifact(sourcesJar)
64
- }
52
+ from(components. named(" release" ). get())
65
53
66
54
pom {
67
55
name = POM_NAME
@@ -92,16 +80,12 @@ afterEvaluate { project ->
92
80
}
93
81
94
82
withXml {
95
- def dependenciesNode = asNode(). appendNode(' dependencies' )
96
- // Note that this only handles implementation
97
- // dependencies. In the future, may need to add api,
98
- // etc.
99
- configurations. implementation. allDependencies. each {
100
- def dependencyNode = dependenciesNode. appendNode(' dependency' )
101
- dependencyNode. appendNode(' groupId' , it. group)
102
- dependencyNode. appendNode(' artifactId' , it. name)
103
- dependencyNode. appendNode(' version' , it. version)
104
- }
83
+ // Remove the scope information for all dependencies. This puts
84
+ // everything at "compile" scope, which matches the way Amplify V2 has been
85
+ // published historically. For v3 we should remove this and include the
86
+ // scope information for our dependencies.
87
+ def dependencies = asNode(). get(' dependencies' ). first()
88
+ dependencies. each { it. remove(it. get(' scope' )) }
105
89
}
106
90
}
107
91
}
@@ -128,4 +112,10 @@ afterEvaluate { project ->
128
112
}
129
113
sign publishing. publications. library
130
114
}
115
+
116
+ // Turn off Gradle metadata. This is to maintain compatibility with the way Amplify V2 has
117
+ // been published historically. For v3 we should remove this and publish the gradle metadata.
118
+ tasks. withType(GenerateModuleMetadata ). configureEach {
119
+ enabled = false
120
+ }
131
121
}
0 commit comments