Skip to content

Commit

Permalink
Merge pull request #5 from prolificinteractive/plugin
Browse files Browse the repository at this point in the history
Added plugin implementation in gradle
  • Loading branch information
quentin41500 committed May 11, 2016
2 parents c332b34 + 2f7fbc9 commit 59fe127
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 24 deletions.
13 changes: 8 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.github.dcendents:android-maven-plugin:1.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,9 +16,11 @@ buildscript {
allprojects {
repositories {
jcenter()
// Here for convience when testing new releases
//maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
// Is Release Build?
ext.isReleaseVersion = has("release")
ext.versionCodeInt = getProperty('VERSION_CODE').toInteger()
version = VERSION_NAME
}
21 changes: 20 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,23 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true

GROUP=com.prolificinteractive
VERSION_NAME=0.0.1
VERSION_CODE=1

POM_PACKAGING=aar
POM_NAME=Swipe Action Layout
POM_ARTIFACT_ID=swipe-action-layout
POM_URL=https://github.com/prolificinteractive/swipe-action-layout
POM_DESCRIPTION=A nice swipe layout that provides new actions with a material design look and feel.
POM_SCM_URL=https://github.com/prolificinteractive/swipe-action-layout
POM_SCM_CONNECTION=scm:[email protected]:prolificinteractive/swipe-action-layout.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:prolificinteractive/swipe-action-layout.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=prolificinteractive
POM_DEVELOPER_NAME=Prolific Interactive
POM_DEVELOPER_EMAIL=[email protected]
129 changes: 111 additions & 18 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,119 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode project.ext.versionCodeInt
versionName version
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
}


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

artifacts {
archives sourcesJar
}

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

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('sonatypeUsername') ? sonatypeUsername : ""
}

def getRepositoryPassword() {
return hasProperty('sonatypePassword') ? sonatypePassword : ""
}

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

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

pom.groupId = GROUP
pom.version = version
pom.artifactId = POM_ARTIFACT_ID

pom {
project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
email POM_DEVELOPER_EMAIL
}
}

}
}
}
}

android.libraryVariants.all { variant ->
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
title "Swipe Action Layout${version}"
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
classpath = files(variant.javaCompile.classpath.files, project.android.getBootClasspath())
exclude '**/BuildConfig.java'
exclude '**/R.java'
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
}
}
}

0 comments on commit 59fe127

Please sign in to comment.