Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Add publish.gradle script and release v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
belinwu committed Jan 22, 2019
1 parent 00a0def commit 7fb6bda
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Modular adapter for Android RecyclerView.

# Download

Coming soon...
```groovy
implementation "com.samelody.modapter:modapter:0.1.0"
```

# Getting started

Expand Down
26 changes: 25 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,37 @@ buildscript {
deps.test = "com.android.support.test:runner:1.0.2"
deps.espresso = "com.android.support.test.espresso:espresso-core:3.0.2"

def pub = [:]
ext.pub = pub

pub.packaging = 'aar'
pub.groupId = 'com.samelody.modapter'
pub.artifactId = 'modapter'
pub.libraryRepo = 'maven'
pub.libraryId = 'modapter'
pub.libraryName = 'Modapter'
pub.libraryDescription = 'Modular adapter for Android RecyclerView.'
pub.libraryVersion = deps.libVersionName
pub.libraryVersionCode = deps.libVersionCode
pub.siteUrl = 'https://github.com/samelody/modapter'
pub.gitUrl = 'https://github.com/samelody/modapter.git'
pub.issueUrl = 'https://github.com/samelody/modapter/issues'
pub.developerId = 'belinwu'
pub.developerName = 'Belin Wu'
pub.developerEmail = '[email protected]'
pub.licenseName = 'Apache License 2.0'
pub.licenseUrl = 'https://raw.githubusercontent.com/samelody/modapter/master/LICENSE'
pub.licenses = ["Apache-2.0"]

repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'

classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 2 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ dependencies {
androidTestImplementation deps.test
androidTestImplementation deps.espresso
}

apply from: "../publish.gradle"
104 changes: 104 additions & 0 deletions publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
apply plugin: 'com.github.dcendents.android-maven'

group = pub.groupId
version = pub.libraryVersion

install {
repositories.mavenInstaller {
pom {
project {
packaging pub.packaging
groupId pub.groupId
artifactId pub.artifactId
version pub.libraryVersion

// Add your description here
name pub.libraryName
description pub.libraryDescription
url pub.siteUrl

// Set your license
licenses {
license {
name pub.licenseName
url pub.licenseUrl
}
}
developers {
developer {
id pub.developerId
name pub.developerName
email pub.developerEmail
}
}
scm {
connection pub.gitUrl
developerConnection pub.gitUrl
url pub.siteUrl
}
}
}
}
}

apply plugin: 'com.jfrog.bintray'

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
baseName = pub.libraryId
classifier = "sources"
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
description pub.libraryName + " Javadoc"
source = android.libraryVariants["release"].javaCompile.source
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(android.libraryVariants["release"].javaCompile.classpath.files) + files(ext.androidJar)
options.links("http://docs.oracle.com/javase/7/docs/api/")
options.links("http://d.android.com/reference/")
exclude '**/BuildConfig.java'
exclude '**/R.java'
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
baseName = pub.libraryId
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}

// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
repo = pub.libraryRepo
name = pub.libraryId
desc = pub.libraryDescription
websiteUrl = pub.siteUrl
vcsUrl = pub.gitUrl
issueTrackerUrl = pub.issueUrl
licenses = pub.licenses
publish = true
publicDownloadNumbers = true
version {
desc = pub.libraryDescription
// gpg {
// sign = false //Determines whether to GPG sign the files. The default is false
// passphrase = properties.getProperty("bintray.gpg.password")
// //Optional. The passphrase for GPG signing'
// }
}
}
}
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':library')
// implementation "com.samelody.modapter:modapter:0.1.0"
implementation deps.appcompat
implementation deps.recyclerview
implementation deps.constraintlayout
Expand Down

0 comments on commit 7fb6bda

Please sign in to comment.