use different plugin for maven publish

This commit is contained in:
Akinwale Ariwodola 2021-06-25 02:16:00 +01:00
parent 70f4183ee4
commit ea252a99d1
3 changed files with 113 additions and 55 deletions

View file

@ -8,7 +8,6 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
} }
} }
@ -24,10 +23,14 @@ allprojects {
} }
} }
apply plugin: 'com.android.library' plugins {
apply plugin: 'com.bmuschko.nexus' id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
archivesBaseName = 'lbrysdk'
group = "io.lbry" group = "io.lbry"
version = "{{ args.version }}" version = "{{ args.version }}"
@ -97,44 +100,70 @@ subprojects {
compileSdkVersion {{ android_api }} compileSdkVersion {{ android_api }}
buildToolsVersion '{{ build_tools_version }}' buildToolsVersion '{{ build_tools_version }}'
} }
modifyPom { }
project { }
name 'LBRY SDK for Android' }
description 'The LBRY SDK packaged as an Android AAR'
groupId 'io.lbry'
artifactId 'lbrysdk64'
scm { nexusPublishing {
url 'https://github.com/lbryio/lbry-android-sdk' repositories {
connection 'scm:https://github.com/lbryio/lbry-android-sdk.git' sonatype {
developerConnection 'scm:git://github.com/lbryio/lbry-android-sdk.git' 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/"))
}
}
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId 'io.lbry'
artifactId 'lbrysdk64'
version {{ args.version }}
if (project.plugins.findPlugin("com.android.library")) {
from components.release
} else {
from components.java
}
artifact androidSourcesJar
artifact javadocJar
pom {
name = 'LBRY SDK for Android'
description = 'The LBRY SDK packaged as an Android AAR'
url = 'https://github.com/lbryio/lbry-android-sdk'
licenses { licenses {
license { license {
name 'MIT License' name = 'MIT License'
url 'https://raw.githubusercontent.com/lbryio/lbry-android-sdk/master/LICENSE' url = 'https://raw.githubusercontent.com/lbryio/lbry-android-sdk/master/LICENSE'
distribution 'repo'
} }
} }
developers { developers {
developer { developer {
id 'shockr' id 'akinwale'
name 'Akinwale Ariwodola' name 'Akinwale Ariwodola'
email 'akinwale@lbry.com' email 'akinwale@lbry.com'
} }
} }
scm {
url 'https://github.com/lbryio/lbry-android-sdk'
connection 'scm:git:github.com/lbryio/lbry-android-sdk.git'
developerConnection 'scm:git:ssh://github.com/lbryio/lbry-android-sdk.git'
}
} }
} }
} }
} }
} }
nexus { signing {
sign = true sign publishing.publications
repositoryUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
snapshotRepositoryUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
} }
dependencies { dependencies {

View file

@ -8,7 +8,6 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
} }
} }
@ -24,10 +23,14 @@ allprojects {
} }
} }
apply plugin: 'com.android.library' plugins {
apply plugin: 'com.bmuschko.nexus' id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
archivesBaseName = 'lbrysdk'
group = "io.lbry" group = "io.lbry"
version = "{{ args.version }}" version = "{{ args.version }}"
@ -97,45 +100,70 @@ subprojects {
compileSdkVersion {{ android_api }} compileSdkVersion {{ android_api }}
buildToolsVersion '{{ build_tools_version }}' buildToolsVersion '{{ build_tools_version }}'
} }
modifyPom { }
project { }
name 'LBRY SDK for Android' }
description 'The LBRY SDK packaged as an Android AAR'
url 'https://github.com/lbryio/lbry-android-sdk'
groupId 'io.lbry'
artifactId 'lbrysdk32'
scm { nexusPublishing {
url 'https://github.com/lbryio/lbry-android-sdk' repositories {
connection 'scm:https://github.com/lbryio/lbry-android-sdk.git' sonatype {
developerConnection 'scm:git://github.com/lbryio/lbry-android-sdk.git' 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/"))
}
}
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId 'io.lbry'
artifactId 'lbrysdk32'
version {{ args.version }}
if (project.plugins.findPlugin("com.android.library")) {
from components.release
} else {
from components.java
}
artifact androidSourcesJar
artifact javadocJar
pom {
name = 'LBRY SDK for Android'
description = 'The LBRY SDK packaged as an Android AAR'
url = 'https://github.com/lbryio/lbry-android-sdk'
licenses { licenses {
license { license {
name 'MIT License' name = 'MIT License'
url 'https://raw.githubusercontent.com/lbryio/lbry-android-sdk/master/LICENSE' url = 'https://raw.githubusercontent.com/lbryio/lbry-android-sdk/master/LICENSE'
distribution 'repo'
} }
} }
developers { developers {
developer { developer {
id 'shockr' id 'akinwale'
name 'Akinwale Ariwodola' name 'Akinwale Ariwodola'
email 'akinwale@lbry.com' email 'akinwale@lbry.com'
} }
} }
scm {
url 'https://github.com/lbryio/lbry-android-sdk'
connection 'scm:git:github.com/lbryio/lbry-android-sdk.git'
developerConnection 'scm:git:ssh://github.com/lbryio/lbry-android-sdk.git'
}
} }
} }
} }
} }
} }
nexus { signing {
sign = true sign publishing.publications
repositoryUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
snapshotRepositoryUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
} }
dependencies { dependencies {

View file

@ -1,8 +1,9 @@
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
nexusUsername={{ env["SONATYPE_USERNAME"] }} ossrhUsername={{ env["SONATYPE_USERNAME"] }}
nexusPassword={{ env["SONATYPE_PASSWORD"] }} ossrhPassword={{ env["SONATYPE_PASSWORD"] }}
sonatypeStagingProfileId={{ env["SONATYPE_STAGING_PROFILE_ID"] }}
signing.keyId={{ env["NEXUS_SIGNING_KEY_ID"] }} signing.keyId={{ env["NEXUS_SIGNING_KEY_ID"] }}
signing.password={{ env["NEXUS_SIGNING_KEY_PASSWORD"] }} signing.password={{ env["NEXUS_SIGNING_KEY_PASSWORD"] }}