-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wpeview] Use 3rdparty plugin to simplify publishing
- Loading branch information
Showing
2 changed files
with
26 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary | ||
import com.vanniktech.maven.publish.SonatypeHost | ||
|
||
plugins { | ||
id 'com.android.library' | ||
id 'maven-publish' | ||
id 'signing' | ||
id "com.vanniktech.maven.publish" version "0.29.0" | ||
} | ||
|
||
android { | ||
|
@@ -90,14 +92,6 @@ android { | |
}) | ||
} | ||
} | ||
|
||
publishing { | ||
singleVariant('release') { | ||
// This ensures only the release variant is published | ||
withSourcesJar() // Include sources JAR | ||
withJavadocJar() // Include Javadoc JAR (optional) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
@@ -107,76 +101,34 @@ dependencies { | |
androidTestImplementation "androidx.test.ext:junit:1.2.1" | ||
} | ||
|
||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
afterEvaluate { | ||
from components.release | ||
} | ||
|
||
groupId 'org.wpewebkit.wpeview' | ||
artifactId 'wpeview' | ||
version '0.1.0' | ||
|
||
// The sources and Javadoc JARs are automatically added because of `withSourcesJar()` and `withJavadocJar()` above | ||
mavenPublishing { | ||
configure(new AndroidSingleVariantLibrary("release", true, true)) | ||
|
||
pom { | ||
name = 'WPEView' | ||
description = 'WPE WebKit for Android' | ||
url = 'https://github.com/Igalia/wpe-android' | ||
coordinates("org.wpewebkit.wpeview", "wpeview", "0.1.0") | ||
|
||
licenses { | ||
license { | ||
name = 'GNU Lesser General Public License v2.1' | ||
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt' | ||
distribution = 'repo' | ||
} | ||
} | ||
pom { | ||
name = 'WPEView' | ||
description = 'WPE WebKit for Android' | ||
url = 'https://github.com/Igalia/wpe-android' | ||
|
||
scm { | ||
connection = 'scm:[email protected]/Igalia/wpe-android.git' | ||
url = 'https://github.com/Igalia/wpe-android.git' | ||
} | ||
licenses { | ||
license { | ||
name = 'GNU Lesser General Public License v2.1' | ||
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt' | ||
distribution = 'repo' | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "OSSRH" | ||
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
|
||
credentials { | ||
username = project.findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME") | ||
password = project.findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD") | ||
} | ||
scm { | ||
connection = 'scm:[email protected]/Igalia/wpe-android.git' | ||
url = 'https://github.com/Igalia/wpe-android.git' | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
def signingKey = project.findProperty("signing.secretKey") ?: System.getenv("SIGNING_KEY") | ||
def signingPassword = project.findProperty("signing.password")?: System.getenv("SIGNING_PASSWORD") | ||
|
||
if (signingKey && signingPassword) { | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign publishing.publications | ||
} else { | ||
logger.warn("Signing key or password not found, signing will be skipped.") | ||
} | ||
} | ||
|
||
tasks.withType(Javadoc).configureEach { | ||
enabled = false // Disable Javadoc if not needed | ||
} | ||
|
||
tasks.register('javadocJar', Jar) { | ||
archiveClassifier.set('javadoc') | ||
} | ||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) | ||
|
||
tasks.register('sourcesJar', Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
archiveClassifier.set('sources') | ||
// Enable GPG signing for all publications | ||
signAllPublications() | ||
} | ||
|
||
gradle.afterProject { project -> | ||
|