Merge pull request #356 from schaal/update-buildsystem

Update buildsystem
This commit is contained in:
David-Development 2015-06-21 19:14:02 +02:00
commit 8921351467
12 changed files with 28 additions and 244 deletions

View file

@ -1,25 +1,12 @@
apply plugin: 'com.android.application'
//apply plugin: 'robolectric'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.robolectric:robolectric-gradle-plugin:0.14.+'
}
}
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
@ -29,27 +16,6 @@ android {
}
}
productFlavors {
}
sourceSets {
main {
aidl.srcDirs = ['src/main/java']
}
instrumentTest.setRoot('src/androidTest/java')
androidTest {
java.srcDir file('src/androidTest/java')
setRoot('src/androidTest/')
}
}
lintOptions {
checkReleaseBuilds false
@ -58,40 +24,21 @@ android {
abortOnError false
}
}
configurations {
robolectricTests {
extendsFrom compile
sourceSets {
main {
aidl.srcDirs = ['src/main/java']
}
}
}
apply plugin: 'android-unit-test'
sourceSets {
robolectricTests {
java.srcDir file('src/androidTest/java')
resources.srcDir file('src/androidTest/resources')
compileClasspath += configurations.robolectricTests
runtimeClasspath += compileClasspath
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:21.+'
force 'com.android.support:appcompat-v7:21.+'
force 'com.android.support:support-v4:22.2.0'
force 'com.android.support:appcompat-v7:22.2.0'
}
}
afterEvaluate {
tasks.findByName("assembleDebug").dependsOn("testDebugClasses")
}
dependencies {
// core android studio module
//compile project(':core')
@ -106,8 +53,8 @@ dependencies {
compile project(':ownCloud-Account-Importer')
compile project(':ShowcaseView:library')
compile project(':android-HoloCircularProgressBar:library')
compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.jakewharton:butterknife:5.1.+'
compile 'com.squareup.picasso:picasso:2.3.1@jar'
compile 'com.sothree.slidinguppanel:library:+'
@ -116,39 +63,6 @@ dependencies {
compile 'de.greenrobot:greendao-generator:1.3.1@jar'
compile 'org.freemarker:freemarker:2.3.18@jar'
testCompile 'org.robolectric:robolectric:2.4'
testCompile 'org.robolectric:robolectric:3.0-rc3'
testCompile 'junit:junit:4.+'
// these arent getting used
//androidTestCompile 'some.other.library'
//instrumentTestCompile 'additional.library'
}
/*
task robolectric(type: Test, dependsOn: assemble) {
workingDir 'src/main'
testClassesDir = sourceSets.robolectricTests.output.classesDir
android.sourceSets.main.java.srcDirs.each { dir ->
def buildDir = dir.getAbsolutePath().split('/')
buildDir = (buildDir[0..(buildDir.length - 4)] + ['build', 'classes', 'debug']).join('/')
project.getPlugins().getPlugin('android').prepareTaskMap.each {
sourceSets.robolectricTests.compileClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar')
sourceSets.robolectricTests.runtimeClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar')
}
sourceSets.robolectricTests.compileClasspath += files(buildDir)
sourceSets.robolectricTests.runtimeClasspath += files(buildDir)
}
classpath = sourceSets.robolectricTests.runtimeClasspath
}
*/

View file

@ -1,29 +0,0 @@
package de.luhmer.owncloudnewsreader.junit_tests;
import org.junit.runners.model.InitializationError;
import org.robolectric.AndroidManifest;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.res.Fs;
public class RobolectricGradleTestRunner extends RobolectricTestRunner {
public RobolectricGradleTestRunner(Class<?> testClass) throws InitializationError {
super(testClass);
}
@Override
protected AndroidManifest getAppManifest(Config config) {
String myAppPath = RobolectricGradleTestRunner.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath();
String manifestPath = myAppPath + "../../../src/main/AndroidManifest.xml";
String resPath = myAppPath + "../../../src/main/res";
String assetPath = myAppPath + "../../../src/main/assets";
return createAppManifest(Fs.fileFromPath(manifestPath),
Fs.fileFromPath(resPath),
Fs.fileFromPath(assetPath));
}
}

View file

@ -15,8 +15,6 @@
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-sdk android:targetSdkVersion="18" /> <!-- For Unit testing -->
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"

View file

@ -45,11 +45,11 @@ import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.v7.internal.widget.TintCheckBox;
import android.support.v7.internal.widget.TintCheckedTextView;
import android.support.v7.internal.widget.TintEditText;
import android.support.v7.internal.widget.TintRadioButton;
import android.support.v7.internal.widget.TintSpinner;
import android.support.v7.widget.AppCompatCheckBox;
import android.support.v7.widget.AppCompatCheckedTextView;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatRadioButton;
import android.support.v7.widget.AppCompatSpinner;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.util.TypedValue;
@ -379,15 +379,15 @@ public class SettingsActivity extends PreferenceActivity {
// standard framework versions
switch (name) {
case "EditText":
return new TintEditText(this, attrs);
return new AppCompatEditText(this, attrs);
case "Spinner":
return new TintSpinner(this, attrs);
return new AppCompatSpinner(this, attrs);
case "CheckBox":
return new TintCheckBox(this, attrs);
return new AppCompatCheckBox(this, attrs);
case "RadioButton":
return new TintRadioButton(this, attrs);
return new AppCompatRadioButton(this, attrs);
case "CheckedTextView":
return new TintCheckedTextView(this, attrs);
return new AppCompatCheckedTextView(this, attrs);
}
}

View file

@ -1,50 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--<string name="non_sorted_articles">Nicht zugeordnete Artikel</string>-->
<!--Import Accounts-->
<!--EMAIL-->
<!--Action Bar Items-->
<!--Strings related to login-->
<string name="pref_title_password">Secret Code</string>
<!--<string name="pref_title_owncloudRootPath">ownCloud root address</string>-->
<!--<string name="pref_default_username">admin</string>-->
<!--Toast Messages-->
<!--Strings related to Settings-->
<!--General settings-->
<!--<string-array name="pref_general_sort_order_values">
<item>desc</item>
<item>asc</item>
</string-array>-->
<!--<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact based on your message history</string>-->
<!--<string name="pref_title_AllowAllSSLCertificates">Allow all SSL Certificates</string>-->
<!--MemorizingTrustManager-->
<!--Podcast-->
<!--Settings for Display-->
<!--Login Dialog-->
<!--Data & Sync-->
<!--<string name="pref_title_data_sync_max_items">Max number of items to sync</string>-->
<!--<string name="pref_title_sync_frequency">Sync frequency</string>
<string-array name="pref_sync_frequency_titles">
<item>15 minutes</item>
<item>30 minutes</item>
<item>1 hour</item>
<item>3 hours</item>
<item>6 hours</item>
<item>Never</item>
</string-array>
<string-array name="pref_sync_frequency_values">
<item>15</item>
<item>30</item>
<item>60</item>
<item>180</item>
<item>360</item>
<item>-1</item>
</string-array>-->
<!--<string name="pref_title_system_sync_settings">System sync settings</string>-->
<!--<string name="pref_title_new_message_notifications">New message notifications</string>
<string name="pref_title_ringtone">Ringtone</string>
<string name="pref_ringtone_silent">Silent</string>
<string name="pref_title_vibrate">Vibrate</string>-->
</resources>

View file

@ -1,49 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--<string name="non_sorted_articles">Nicht zugeordnete Artikel</string>-->
<!--Import Accounts-->
<!--EMAIL-->
<!--Action Bar Items-->
<!--Strings related to login-->
<!--<string name="pref_title_owncloudRootPath">ownCloud root address</string>-->
<!--<string name="pref_default_username">admin</string>-->
<!--Toast Messages-->
<!--Strings related to Settings-->
<!--General settings-->
<!--<string-array name="pref_general_sort_order_values">
<item>desc</item>
<item>asc</item>
</string-array>-->
<!--<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact based on your message history</string>-->
<!--<string name="pref_title_AllowAllSSLCertificates">Allow all SSL Certificates</string>-->
<!--MemorizingTrustManager-->
<!--Podcast-->
<!--Settings for Display-->
<!--Login Dialog-->
<!--Data & Sync-->
<!--<string name="pref_title_data_sync_max_items">Max number of items to sync</string>-->
<!--<string name="pref_title_sync_frequency">Sync frequency</string>
<string-array name="pref_sync_frequency_titles">
<item>15 minutes</item>
<item>30 minutes</item>
<item>1 hour</item>
<item>3 hours</item>
<item>6 hours</item>
<item>Never</item>
</string-array>
<string-array name="pref_sync_frequency_values">
<item>15</item>
<item>30</item>
<item>60</item>
<item>180</item>
<item>360</item>
<item>-1</item>
</string-array>-->
<!--<string name="pref_title_system_sync_settings">System sync settings</string>-->
<!--<string name="pref_title_new_message_notifications">New message notifications</string>
<string name="pref_title_ringtone">Ringtone</string>
<string name="pref_ringtone_silent">Silent</string>
<string name="pref_title_vibrate">Vibrate</string>-->
</resources>

View file

@ -5,7 +5,7 @@
<style name="AppTheme.Base" parent="Theme.AppCompat">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
<item name="android:windowNoTitle">true</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="dividerLineColor">#1effffff</item>
@ -22,7 +22,7 @@
<item name="android:textColor">#000</item>
<!-- <item name="android:textColorSecondary">@color/slider_listview_text_color_dark_theme</item> -->
<item name="android:windowNoTitle">true</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="dividerLineColor">#1e000000</item>

View file

@ -8,10 +8,12 @@ import org.junit.Test;
import org.junit.rules.Stopwatch;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import java.util.List;
import de.luhmer.owncloudnewsreader.BuildConfig;
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseHelperOrm;
@ -20,9 +22,8 @@ import de.luhmer.owncloudnewsreader.database.model.Feed;
import static org.junit.Assert.*;
@Config(emulateSdk=18)
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class TestDbTest {
private NewsReaderListActivity activity;

View file

@ -5,8 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc2'
classpath 'com.github.jcandksolutions.gradle:android-unit-test:2.+'
classpath 'com.android.tools.build:gradle:1.2.3'
}
}

View file

@ -18,9 +18,9 @@
# org.gradle.parallel=true
ANDROID_BUILD_MIN_SDK_VERSION=8
ANDROID_BUILD_TARGET_SDK_VERSION=21
ANDROID_BUILD_TOOLS_VERSION=21.1.1
ANDROID_BUILD_SDK_VERSION=21
ANDROID_BUILD_TARGET_SDK_VERSION=22
ANDROID_BUILD_TOOLS_VERSION=22.0.1
ANDROID_BUILD_SDK_VERSION=22
MIN_SDK=8