-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from nwagu/cn-dev
publish library to maven central
- Loading branch information
Showing
5 changed files
with
138 additions
and
39 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
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 |
---|---|---|
|
@@ -26,27 +26,16 @@ android { | |
|
||
ext { | ||
|
||
bintrayRepo = "Forms" | ||
bintrayName = "com.nwagu.forms" | ||
publishGroupId = 'com.nwagu.forms' | ||
publishArtifactId = 'forms' | ||
publishVersion = '1.0.1' | ||
|
||
publishedGroupId = 'com.nwagu.forms' | ||
libraryName = 'forms' | ||
artifact = 'forms' | ||
|
||
libraryDescription = 'Android library for form management and validation' | ||
|
||
siteUrl = '' | ||
gitUrl = '' | ||
|
||
libraryVersion = '1.0.1' | ||
|
||
developerId = 'nwagu' | ||
developerName = 'Chukwuemeka Nwagu' | ||
developerEmail = '[email protected]' | ||
bintrayRepo = "Forms" | ||
bintrayName = "com.nwagu.forms" | ||
|
||
licenseName = 'MIT License' | ||
licenseUrl = 'https://opensource.org/licenses/MIT' | ||
allLicenses = ["MIT"] | ||
} | ||
|
||
dependencies { | ||
|
@@ -59,9 +48,10 @@ dependencies { | |
|
||
// Android LiveData library | ||
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" | ||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0" | ||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0" | ||
} | ||
|
||
if (project.rootProject.file('local.properties').exists()) { | ||
apply from: '../publish.gradle' | ||
apply from: "${rootProject.projectDir}/publish-bintray.gradle" | ||
apply from: "${rootProject.projectDir}/publish-mavencentral.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 |
---|---|---|
|
@@ -2,43 +2,41 @@ apply plugin: 'maven-publish' | |
apply plugin: 'com.github.dcendents.android-maven' | ||
apply plugin: 'com.jfrog.bintray' | ||
|
||
group = publishedGroupId | ||
version = libraryVersion | ||
group = publishGroupId | ||
version = publishVersion | ||
|
||
install { | ||
repositories.mavenInstaller { | ||
// This generates POM.xml with proper parameters | ||
pom { | ||
project { | ||
packaging 'aar' | ||
groupId publishedGroupId | ||
artifactId artifact | ||
version libraryVersion | ||
groupId publishGroupId | ||
artifactId publishArtifactId | ||
version publishVersion | ||
|
||
// Add your description here | ||
name libraryName | ||
description libraryDescription | ||
url siteUrl | ||
url = 'https://github.com/nwagu/forms' | ||
|
||
// Set your license | ||
licenses { | ||
license { | ||
name licenseName | ||
url licenseUrl | ||
name = 'MIT License' | ||
url = 'https://opensource.org/licenses/MIT' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id developerId | ||
name developerName | ||
email developerEmail | ||
id = 'nwagu' | ||
name = 'Chukwuemeka Nwagu' | ||
email = '[email protected]' | ||
} | ||
} | ||
scm { | ||
connection gitUrl | ||
developerConnection gitUrl | ||
url siteUrl | ||
|
||
connection = 'scm:git:github.com/nwagu/forms.git' | ||
developerConnection = 'scm:git:ssh://github.com/nwagu/forms.git' | ||
url = 'https://github.com/nwagu/forms/tree/master' | ||
} | ||
} | ||
} | ||
|
@@ -88,9 +86,9 @@ bintray { | |
repo = bintrayRepo | ||
name = bintrayName | ||
desc = libraryDescription | ||
websiteUrl = siteUrl | ||
vcsUrl = gitUrl | ||
licenses = allLicenses | ||
websiteUrl = "https://github.com/nwagu/forms" | ||
vcsUrl = "https://github.com/nwagu/forms.git" | ||
licenses = ["MIT"] | ||
publish = true | ||
publicDownloadNumbers = true | ||
version { | ||
|
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,110 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
group = publishGroupId | ||
version = publishVersion | ||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
from android.sourceSets.main.java.srcDirs | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} else { | ||
from sourceSets.main.java.srcDirs | ||
from sourceSets.main.kotlin.srcDirs | ||
} | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
} | ||
|
||
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()) { | ||
Properties p = new Properties() | ||
p.load(new FileInputStream(secretPropsFile)) | ||
p.each { name, value -> | ||
ext[name] = value | ||
} | ||
} else { | ||
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') | ||
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') | ||
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') | ||
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') | ||
} | ||
|
||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
groupId = publishGroupId | ||
artifactId publishArtifactId | ||
version publishVersion | ||
|
||
if (project.plugins.findPlugin("com.android.library")) { | ||
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") | ||
} else { | ||
artifact("$buildDir/libs/${project.getName()}-${version}.jar") | ||
} | ||
|
||
artifact androidSourcesJar | ||
|
||
pom { | ||
name = libraryName | ||
description = libraryDescription | ||
url = 'https://github.com/nwagu/forms' | ||
|
||
licenses { | ||
license { | ||
name = 'MIT License' | ||
url = 'https://opensource.org/licenses/MIT' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'nwagu' | ||
name = 'Chukwuemeka Nwagu' | ||
email = '[email protected]' | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:github.com/nwagu/forms.git' | ||
developerConnection = 'scm:git:ssh://github.com/nwagu/forms.git' | ||
url = 'https://github.com/nwagu/forms/tree/master' | ||
} | ||
withXml { | ||
def dependenciesNode = asNode().appendNode('dependencies') | ||
|
||
project.configurations.implementation.allDependencies.each { | ||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
dependencyNode.appendNode('groupId', it.group) | ||
dependencyNode.appendNode('artifactId', it.name) | ||
dependencyNode.appendNode('version', it.version) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
name = "sonatype" | ||
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
credentials { | ||
username ossrhUsername | ||
password ossrhPassword | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign publishing.publications | ||
} |