-
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.
- Loading branch information
Showing
5 changed files
with
133 additions
and
12 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,21 +1,14 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
buildscript { | ||
repositories { | ||
google() | ||
mavenCentral() // NEW | ||
} | ||
dependencies { | ||
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0' // NEW | ||
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.10.2' // NEW | ||
} | ||
} | ||
plugins { | ||
id 'com.android.application' version '7.1.0' apply false | ||
id 'com.android.library' version '7.1.0' apply false | ||
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false | ||
id("org.jetbrains.dokka") version "1.6.10" | ||
id("io.github.gradle-nexus.publish-plugin") version "1.1.0" | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} | ||
apply from: "${rootDir}/scripts/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
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,84 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
// For Android libraries | ||
from android.sourceSets.main.java.srcDirs | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} else { | ||
// For pure Kotlin libraries, in case you have them | ||
from sourceSets.main.java.srcDirs | ||
from sourceSets.main.kotlin.srcDirs | ||
} | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
} | ||
|
||
group = PUBLISH_GROUP_ID | ||
version = PUBLISH_VERSION | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
// The coordinates of the library, being set from variables that | ||
// we'll set up later | ||
groupId PUBLISH_GROUP_ID | ||
artifactId PUBLISH_ARTIFACT_ID | ||
version PUBLISH_VERSION | ||
|
||
// Two artifacts, the `aar` (or `jar`) and the sources | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
from components.release | ||
} else { | ||
from components.java | ||
} | ||
|
||
artifact androidSourcesJar | ||
//artifact javadocJar | ||
|
||
// Mostly self-explanatory metadata | ||
pom { | ||
name = PUBLISH_ARTIFACT_ID | ||
description = 'A light lib that helps and centralize logs in your application.' | ||
url = 'https://github.com/Badge87/BadgeLogK' | ||
licenses { | ||
license { | ||
name = 'MIT License' | ||
url = 'https://github.com/Badge87/BadgeLogK/blob/main/LICENSE' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'Badge' | ||
name = 'Daniele Bachicchi' | ||
email = 'bacdaniele@gmail.com' | ||
} | ||
// Add all other devs here... | ||
} | ||
|
||
// Version control info - if you're using GitHub, follow the | ||
// format as seen here | ||
scm { | ||
connection = 'scm:git:github.com/Badge87/BadgeLogK.git' | ||
developerConnection = 'scm:git:ssh://github.com/Badge87/BadgeLogK.git' | ||
url = 'https://github.com/Badge87/BadgeLogK/tree/main' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys( | ||
rootProject.ext["signing.keyId"], | ||
rootProject.ext["signing.key"], | ||
rootProject.ext["signing.password"], | ||
) | ||
sign publishing.publications | ||
} |
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.key"] = '' | ||
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.key"] = System.getenv('SIGNING_KEY') | ||
} | ||
|
||
// 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/")) | ||
} | ||
} | ||
} |