Added domain and data layers. Configured tests.

This commit is contained in:
Fernando Cejas
2014-08-22 00:58:23 +02:00
parent 214c26209a
commit bced2b80cd
8 changed files with 91 additions and 2 deletions

27
data-test/build.gradle Normal file
View File

@@ -0,0 +1,27 @@
apply plugin: 'java'
dependencies {
def dataLayer = project(':data')
compile dataLayer
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'junit:junit:4.11'
testCompile 'org.robolectric:robolectric:2.2'
testCompile dataLayer.android.libraryVariants.toList().first().javaCompile.classpath
testCompile dataLayer.android.libraryVariants.toList().first().javaCompile.outputs.files
testCompile files(dataLayer.plugins.findPlugin("com.android.library").getBootClasspath())
}
sourceSets {
test {
java.srcDirs = ['src/test/java']
}
}
tasks.withType(Test) {
scanForTestClasses = false
include "**/*Should.class"
include "**/*Test.class"
include "**/*Tests.class"
}

1
data/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

35
data/build.gradle Normal file
View File

@@ -0,0 +1,35 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.fernandocejas.android10.sample.data"
minSdkVersion 15
targetSdkVersion 19
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
lintOptions {
abortOnError false;
disable 'InvalidPackage' // Some libraries have issues with this
disable 'OldTargetApi' // Due to Robolectric that modifies the manifest when running tests
}
}
dependencies {
def domainLayer = project(':domain')
//project dependencies
compile domainLayer
//library dependencies
compile('com.google.code.gson:gson:2.2.4')
}

17
data/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/fcejas/Software/SDKs/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fernandocejas.android10.sample.data">
<application android:allowBackup="true" />
</manifest>

View File

@@ -38,7 +38,11 @@ android {
dependencies {
def domainLayer = project(':domain')
def dataLayer = project(':data')
//project dependencies
compile domainLayer
compile dataLayer
//compile this only for testing. I had to use a workaround for using Espresso (it is not in the
//maven central repository): since both Mockito and Espresso use 'hamcrest' I had to remove them

View File

@@ -22,7 +22,7 @@ public class MainActivity extends Activity {
* Maps the graphical user interface controls.
*/
private void mapGUI() {
btn_LoadData = (Button)findViewById(R.id.btn_LoadData);
btn_LoadData = (Button) findViewById(R.id.btn_LoadData);
btn_LoadData.setOnClickListener(loadDataOnClickListener);
}

View File

@@ -1 +1 @@
include ':presentation', ':domain'
include ':presentation', ':domain', ':data', ':data-test'