diff --git a/data-test/build.gradle b/data-test/build.gradle new file mode 100644 index 0000000..6dab848 --- /dev/null +++ b/data-test/build.gradle @@ -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" +} \ No newline at end of file diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/data/.gitignore @@ -0,0 +1 @@ +/build diff --git a/data/build.gradle b/data/build.gradle new file mode 100644 index 0000000..0e602c0 --- /dev/null +++ b/data/build.gradle @@ -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') +} diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro new file mode 100644 index 0000000..205387b --- /dev/null +++ b/data/proguard-rules.pro @@ -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 *; +#} diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml new file mode 100644 index 0000000..bc8ea89 --- /dev/null +++ b/data/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + diff --git a/presentation/build.gradle b/presentation/build.gradle index b92e416..0ef3452 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -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 diff --git a/presentation/src/main/java/com/fernandocejas/android10/sample/presentation/view/activity/MainActivity.java b/presentation/src/main/java/com/fernandocejas/android10/sample/presentation/view/activity/MainActivity.java index 64e3879..f54668b 100644 --- a/presentation/src/main/java/com/fernandocejas/android10/sample/presentation/view/activity/MainActivity.java +++ b/presentation/src/main/java/com/fernandocejas/android10/sample/presentation/view/activity/MainActivity.java @@ -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); } diff --git a/settings.gradle b/settings.gradle index fc221f4..298a42e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':presentation', ':domain' +include ':presentation', ':domain', ':data', ':data-test'