Skip to content

Commit

Permalink
Add maven-publish.gradle, upload aar to maven central.
Browse files Browse the repository at this point in the history
  • Loading branch information
codezjx committed Nov 15, 2021
1 parent 8e8f35a commit 7cb6d07
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 121 deletions.
58 changes: 0 additions & 58 deletions andlinker/bintray.gradle

This file was deleted.

3 changes: 1 addition & 2 deletions andlinker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ dependencies {
}

apply from: 'properties.gradle'
apply from: 'install.gradle'
apply from: 'bintray.gradle'
apply from: 'maven-publish.gradle'
44 changes: 0 additions & 44 deletions andlinker/install.gradle

This file was deleted.

91 changes: 91 additions & 0 deletions andlinker/maven-publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apply plugin: 'maven'
apply plugin: 'signing'

// Android libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

task javadoc(type: Javadoc) {
// https://github.com/novoda/bintray-release/issues/71
excludes = ['**/*.kt'] // < ---- Exclude all kotlin files from javadoc file.
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
options.encoding = "UTF-8"
options.charSet = "UTF-8"
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// Add javadoc/source jar tasks as artifacts
artifacts {
archives javadocJar
archives sourcesJar
}

// Signing artifacts
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.groupId = publishedGroupId
pom.artifactId = artifact
pom.version = libraryVersion

pom.project {
packaging 'aar'

name libraryName
description libraryDescription
url siteUrl

scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}

licenses {
license {
name licenseName
url licenseUrl
}
}

developers {
developer {
id developerId
name developerName
email developerEmail
}
}
}
}
}
}
10 changes: 3 additions & 7 deletions andlinker/properties.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
ext {
bintrayRepo = 'maven'
bintrayName = 'and-linker'

publishedGroupId = 'com.codezjx.library'
libraryName = 'AndLinker'
artifact = 'andlinker'

libraryVersion = '0.8.0'

libraryName = 'AndLinker'
libraryDescription = 'AndLinker is a IPC library for Android, which combines the features of AIDL and Retrofit. Allows IPC call seamlessly compose with rxjava and rxjava2 call adapters.'

siteUrl = 'https://github.com/codezjx/AndLinker'
gitUrl = 'https://github.com/codezjx/AndLinker.git'

libraryVersion = '0.7.2'

developerId = 'codezjx'
developerName = 'codezjx'
developerEmail = '[email protected]'
Expand Down
10 changes: 0 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -22,13 +19,6 @@ allprojects {
google()
jcenter()
}

tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}

task clean(type: Delete) {
Expand Down

0 comments on commit 7cb6d07

Please sign in to comment.