Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
alternative approach to building v10 / v14 variants
Browse files Browse the repository at this point in the history
We are now using different productFlavors, that allow us to specify different minSdkVersions and mergable AndroidManifests.
With this config, it's also possible to use the new Jack Toolchain, which allows us to use some of the new Java 8 features
  • Loading branch information
pfent committed Jul 6, 2016
1 parent 2908278 commit ca99e39
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 117 deletions.
60 changes: 54 additions & 6 deletions app/build.gradle
@@ -1,24 +1,72 @@
apply plugin: 'com.android.library'
apply plugin: 'com.android.application'
apply from: '../findbugs.gradle'
apply from: '../pmd.gradle'

android {
lintOptions {
disable "TrulyRandom",
"ContentDescription",
"UnusedResources", // unused resources get purged by shrinkResources
"SelectableText" // disabled by default
compileSdkVersion 24
buildToolsVersion '24.0.0'
buildTypes {
debug {
debuggable true
minifyEnabled false
}
release {
debuggable false
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "de.tum.in.tumcampus"
minSdkVersion 10
targetSdkVersion 24
multiDexEnabled true
versionCode 67
versionName "1.4.5-dev"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions.enabled true
}
lintOptions {
checkAllWarnings true
htmlReport false
warningsAsErrors true
abortOnError true
lintConfig new File("lint.xml")
disable 'GoogleAppIndexingWarning',
'TrulyRandom',
'ContentDescription',
'UnusedResources', // unused resources get purged by shrinkResources
'SelectableText' // disabled by default
}
packagingOptions {
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
productFlavors {
v10 {
minSdkVersion 10
}
v14 {
minSdkVersion 14
lintOptions.abortOnError false
}
}

publishNonDefault true
}

configurations.all {
resolutionStrategy {
force 'com.android.support:appcompat-v7:24.0.0'
force 'com.android.support:design:24.0.0'
force 'com.android.support:recyclerview-v7:24.0.0'
force 'com.google.code.findbugs:jsr305:3.0.1'
}
}

dependencies {
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
Expand Down
12 changes: 12 additions & 0 deletions app/src/v14/AndroidManifest.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="de.tum.in.tumcampusapp">

<!-- TODO add additions for widgets -->
<!-- This is an example how fields in app/AndroidManifest.xml
can be replaced -->
<application
android:icon="@drawable/tum_logo"
tools:replace="android:icon" />
</manifest>
23 changes: 0 additions & 23 deletions build.gradle
Expand Up @@ -23,31 +23,8 @@ allprojects {
afterEvaluate { project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
minSdkVersion 10
targetSdkVersion 24
multiDexEnabled true
versionCode 67
versionName "1.4.5-dev"
}
lintOptions {
checkAllWarnings true
htmlReport false
warningsAsErrors true
abortOnError true
lintConfig new File("lint.xml")
}
buildTypes {
debug {
debuggable true
}
release {
debuggable false
}
all {
minifyEnabled true
FileCollection proGuardFileCollection = files {
file('proguard').listFiles()
}
Expand Down
33 changes: 15 additions & 18 deletions findbugs.gradle
Expand Up @@ -5,26 +5,23 @@ afterEvaluate {
android.applicationVariants : android.libraryVariants

variants.each { variant ->
def task = tasks.create("findBugs${variant.name.capitalize()}", FindBugs)
def task = tasks.create("findBugs${variant.name.capitalize()}", FindBugs) {
group = 'verification'
description = "Run FindBugs for the ${variant.description}."
ignoreFailures = true
effort = 'max'
reportLevel = 'high'
reports {
xml.enabled = true
html.enabled = false
}

task.group = 'verification'
task.description = "Run FindBugs for the ${variant.description}."

task.ignoreFailures = true
task.effort = 'max'
task.reportLevel = 'high'
task.reports {
xml.enabled = true
html.enabled = false
def variantCompile = variant.javaCompile
classes = fileTree(variantCompile.destinationDir)
source = variantCompile.source
classpath = variantCompile.classpath.plus(project.files(android.bootClasspath))
dependsOn(variantCompile)
}

def variantCompile = variant.javaCompile

task.classes = fileTree(variantCompile.destinationDir)
task.source = variantCompile.source
task.classpath = variantCompile.classpath.plus(project.files(android.bootClasspath))

task.dependsOn(variantCompile)
tasks.getByName('check').dependsOn(task)
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
28 changes: 13 additions & 15 deletions pmd.gradle
Expand Up @@ -23,25 +23,23 @@ afterEvaluate {
android.applicationVariants : android.libraryVariants

variants.each { variant ->
def task = tasks.create("pmd${variant.name.capitalize()}", Pmd)
def task = tasks.create("pmd${variant.name.capitalize()}", Pmd) {
ruleSetFiles = files("../pmd-ruleset.xml")
ruleSets = []

task.ruleSetFiles = files("../pmd-ruleset.xml")
task.ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'

task.source 'src'
task.include '**/*.java'
task.exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
}

task.reports {
xml.enabled = false
html.enabled = true
}

task.ignoreFailures = true
ignoreFailures = true

def variantCompile = variant.javaCompile

task.dependsOn(variantCompile)
dependsOn(variant.javaCompile)
}
tasks.getByName('check').dependsOn(task)
}
}
2 changes: 1 addition & 1 deletion settings.gradle
@@ -1 +1 @@
include ':app', ':v10', ':v14'
include ':app'
1 change: 0 additions & 1 deletion v10/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions v10/build.gradle

This file was deleted.

5 changes: 0 additions & 5 deletions v10/src/main/AndroidManifest.xml

This file was deleted.

1 change: 0 additions & 1 deletion v14/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions v14/build.gradle

This file was deleted.

5 changes: 0 additions & 5 deletions v14/src/main/AndroidManifest.xml

This file was deleted.

0 comments on commit ca99e39

Please sign in to comment.