-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalize scripts to publish to Maven Central.
- Loading branch information
Showing
6 changed files
with
128 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ | |
/captures | ||
.externalNativeBuild | ||
.cxx | ||
/gpg | ||
local.properties |
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,4 +1,7 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
id 'com.android.library' version '8.0.1' apply false | ||
} | ||
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' | ||
} | ||
|
||
apply from: "${rootDir}/crashy/publish-root.gradle" |
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 +1,2 @@ | ||
/build | ||
/build | ||
/gpg |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
group = PUBLISH_GROUP_ID | ||
version = PUBLISH_VERSION | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
from components.release | ||
|
||
groupId PUBLISH_GROUP_ID | ||
artifactId PUBLISH_ARTIFACT_ID | ||
version PUBLISH_VERSION | ||
|
||
pom { | ||
name = 'CrashyMcCrashFace' | ||
description = 'A library that crashes. A lot.' | ||
url = 'https://github.com/plecesne/crashy' | ||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'plecesne' | ||
name = 'Pierre Lecesne' | ||
email = '[email protected]' | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:github.com/plecesne/crashy.git' | ||
developerConnection = 'scm:git:ssh://github.com/plecesne/crashy.git' | ||
url = 'https://github.com/plecesne/crashy/tree/main' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
ext["signing.keyId"] = rootProject.ext["signing.keyId"] | ||
ext["signing.password"] = rootProject.ext["signing.password"] | ||
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] | ||
|
||
signing { | ||
sign publishing.publications | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
archiveClassifier = 'sources' | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
source = android.sourceSets.main.java.srcDirs | ||
} | ||
|
||
task javadocsJar(type: Jar, dependsOn: javadoc){ | ||
archiveClassifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives javadocsJar, sourcesJar | ||
} | ||
|
||
signing { | ||
sign configurations.archives | ||
} |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Create variables with empty default values | ||
ext["signing.keyId"] = '' | ||
ext["signing.password"] = '' | ||
ext["signing.secretKeyRingFile"] = '' | ||
ext["ossrhUsername"] = '' | ||
ext["ossrhPassword"] = '' | ||
ext["sonatypeStagingProfileId"] = '' | ||
|
||
File secretPropsFile = project.rootProject.file('local.properties') | ||
if (secretPropsFile.exists()) { | ||
// Read local.properties file first if it exists | ||
Properties p = new Properties() | ||
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } | ||
p.each { name, value -> ext[name] = value } | ||
} else { | ||
// Use system environment variables | ||
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') | ||
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') | ||
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') | ||
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') | ||
ext["signing.password"] = System.getenv('SIGNING_PASSWORD') | ||
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') | ||
} | ||
|
||
// Set up Sonatype repository | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
stagingProfileId = sonatypeStagingProfileId | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
} | ||
} | ||
} |