Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
// Common parts
// Common parts

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

9 changes: 0 additions & 9 deletions simpleprovider-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}

apply plugin: 'com.android.application'

repositories {
Expand Down
65 changes: 58 additions & 7 deletions simpleprovider/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,65 @@
apply plugin: 'java'
apply plugin: 'com.android.library'
apply plugin: 'jacoco'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
minSdkVersion 9
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

// Define coverage source.
// If you have rs/aidl etc... add them here.
def coverageSourceDirs = [
'src/main/java',
]

jacoco {
toolVersion "0.7.1.201405082137"
}

// From: http://stackoverflow.com/a/24231246
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
dir: './build/intermediates/classes/debug',
excludes: ['**/R*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class'
])
sourceDirectories = files(coverageSourceDirs)
executionData = files("$buildDir/jacoco/testDebug.exec")
// Bit hacky but fixes https://code.google.com/p/android/issues/detail?id=69174.
// We iterate through the compiled .class tree and rename $$ to $.
doFirst {
new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
if (file.name.contains('$$')) {
file.renameTo(file.path.replace('$$', '$'))
}
}
}
}

repositories {
mavenCentral()
}

dependencies {
compile 'com.google.android:android:4.1.1.4'

testCompile 'junit:junit:4.11'
testCompile('org.robolectric:robolectric:2.3') {
exclude module: 'support-v4'
Expand Down Expand Up @@ -37,11 +89,9 @@ version = VERSION_NAME
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
additionalSourceDirs = files(android.sourceSets.main.java.srcDirs)
}

jar.dependsOn test

apply from: 'gradle-mvn-push.gradle'

afterEvaluate { project ->
Expand Down Expand Up @@ -70,4 +120,5 @@ afterEvaluate { project ->
}
}
}
}
}

20 changes: 12 additions & 8 deletions simpleprovider/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ afterEvaluate { project ->
}
}
}

}
}
}
Expand All @@ -86,18 +85,23 @@ afterEvaluate { project ->
sign configurations.archives
}

task javadocsJar(type: Jar, dependsOn: javadoc) {
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

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

artifacts {
archives sourcesJar
archives javadocsJar
archives androidSourcesJar
archives androidJavadocsJar
}
}
}
8 changes: 8 additions & 0 deletions simpleprovider/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.triplet.simpleprovider">

<application>

</application>

</manifest>