1
1
plugins {
2
2
id ' com.android.library'
3
+ id ' maven-publish'
4
+ id ' signing'
3
5
}
4
6
5
7
android {
@@ -88,6 +90,14 @@ android {
88
90
})
89
91
}
90
92
}
93
+
94
+ publishing {
95
+ singleVariant(' release' ) {
96
+ // This ensures only the release variant is published
97
+ withSourcesJar() // Include sources JAR
98
+ withJavadocJar() // Include Javadoc JAR (optional)
99
+ }
100
+ }
91
101
}
92
102
93
103
dependencies {
@@ -97,6 +107,78 @@ dependencies {
97
107
androidTestImplementation " androidx.test.ext:junit:1.2.1"
98
108
}
99
109
110
+ publishing {
111
+ publications {
112
+ release(MavenPublication ) {
113
+ afterEvaluate {
114
+ from components. release
115
+ }
116
+
117
+ groupId ' org.wpewebkit.wpeview'
118
+ artifactId ' wpeview'
119
+ version ' 0.1.0'
120
+
121
+ // The sources and Javadoc JARs are automatically added because of `withSourcesJar()` and `withJavadocJar()` above
122
+
123
+ pom {
124
+ name = ' WPEView'
125
+ description = ' WPE WebKit for Android'
126
+ url = ' https://github.com/Igalia/wpe-android'
127
+
128
+ licenses {
129
+ license {
130
+ name = ' GNU Lesser General Public License v2.1'
131
+ url = ' https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt'
132
+ distribution = ' repo'
133
+ }
134
+ }
135
+
136
+ scm {
137
+ connection
= ' scm:[email protected] /Igalia/wpe-android.git'
138
+ url = ' https://github.com/Igalia/wpe-android.git'
139
+ }
140
+ }
141
+ }
142
+ }
143
+
144
+ repositories {
145
+ maven {
146
+ name = " OSSRH"
147
+ url = uri(" https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" )
148
+
149
+ credentials {
150
+ username = project. findProperty(" ossrhUsername" ) ?: System . getenv(" OSSRH_USERNAME" )
151
+ password = project. findProperty(" ossrhPassword" ) ?: System . getenv(" OSSRH_PASSWORD" )
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+ signing {
158
+ def signingKey = project. findProperty(" signing.secretKey" ) ?: System . getenv(" SIGNING_KEY" )
159
+ def signingPassword = project. findProperty(" signing.password" )?: System . getenv(" SIGNING_PASSWORD" )
160
+
161
+ if (signingKey && signingPassword) {
162
+ useInMemoryPgpKeys(signingKey, signingPassword)
163
+ sign publishing. publications
164
+ } else {
165
+ logger. warn(" Signing key or password not found, signing will be skipped." )
166
+ }
167
+ }
168
+
169
+ tasks. withType(Javadoc ). configureEach {
170
+ enabled = false // Disable Javadoc if not needed
171
+ }
172
+
173
+ tasks. register(' javadocJar' , Jar ) {
174
+ archiveClassifier. set(' javadoc' )
175
+ }
176
+
177
+ tasks. register(' sourcesJar' , Jar ) {
178
+ from android. sourceSets. main. java. srcDirs
179
+ archiveClassifier. set(' sources' )
180
+ }
181
+
100
182
gradle. afterProject { project ->
101
183
if (project == getProject()) {
102
184
def abiList = []
0 commit comments