diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/copyright/dev.xml b/.idea/copyright/dev.xml new file mode 100644 index 0000000..0165d72 --- /dev/null +++ b/.idea/copyright/dev.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..1cc4160 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..95b48e9 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..75dac50 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8f53baf --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..7d002d5 --- /dev/null +++ b/build.gradle @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/config/dependencies/all-dependencies.gradle" + +buildscript { + + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.0-beta6' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/cache/.gitignore b/cache/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/cache/.gitignore @@ -0,0 +1 @@ +/build diff --git a/cache/build.gradle b/cache/build.gradle new file mode 100644 index 0000000..ac9f7dc --- /dev/null +++ b/cache/build.gradle @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'com.android.library' +apply from: "$rootDir/script/quality/quality-android-lib.gradle" +apply from: "$rootDir/script/config/dependencies/cache-dependencies.gradle" + +android { + + compileSdkVersion rootProject.ext.androidCompileSdkVersion + buildToolsVersion rootProject.ext.androidBuildToolsVersion + + + defaultConfig { + minSdkVersion rootProject.ext.androidMinSdkVersion + targetSdkVersion rootProject.ext.androidTargetSdkVersion + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + +} + diff --git a/cache/proguard-rules.pro b/cache/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/cache/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/cache/src/main/AndroidManifest.xml b/cache/src/main/AndroidManifest.xml new file mode 100644 index 0000000..256d419 --- /dev/null +++ b/cache/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/cache/src/main/java/com/github/amitkma/boilerplate/cache/Cache.java b/cache/src/main/java/com/github/amitkma/boilerplate/cache/Cache.java new file mode 100644 index 0000000..4469b7d --- /dev/null +++ b/cache/src/main/java/com/github/amitkma/boilerplate/cache/Cache.java @@ -0,0 +1,25 @@ +/* + * Copyright 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.github.amitkma.boilerplate.cache; + +/** + * Author: Amit Kumar + * Created on: 18/9/17. + */ + +public class Cache { +} diff --git a/cache/src/main/res/values/strings.xml b/cache/src/main/res/values/strings.xml new file mode 100644 index 0000000..fb713b7 --- /dev/null +++ b/cache/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + cache + diff --git a/cache/src/test/java/com/github/amitkma/boilerplate/cache/ExampleUnitTest.java b/cache/src/test/java/com/github/amitkma/boilerplate/cache/ExampleUnitTest.java new file mode 100644 index 0000000..c10fa7c --- /dev/null +++ b/cache/src/test/java/com/github/amitkma/boilerplate/cache/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.github.amitkma.boilerplate.cache; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ 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..6c21160 --- /dev/null +++ b/data/build.gradle @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/config/java/library.gradle" +apply from: "$rootDir/script/config/dependencies/data-dependencies.gradle" + + diff --git a/data/src/test/java/com/github/amitkma/boilerplate/cache/ExampleUnitTest.java b/data/src/test/java/com/github/amitkma/boilerplate/cache/ExampleUnitTest.java new file mode 100644 index 0000000..c10fa7c --- /dev/null +++ b/data/src/test/java/com/github/amitkma/boilerplate/cache/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.github.amitkma.boilerplate.cache; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/domain/.gitignore b/domain/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/domain/.gitignore @@ -0,0 +1 @@ +/build diff --git a/domain/build.gradle b/domain/build.gradle new file mode 100644 index 0000000..24361fc --- /dev/null +++ b/domain/build.gradle @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/config/java/library.gradle" +apply from: "$rootDir/script/config/dependencies/domain-dependencies.gradle" diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..554b3be --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2800m +org.gradle.caching=true + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..639cba1 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Sep 16 15:23:02 IST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/mobile-app/.gitignore b/mobile-app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/mobile-app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/mobile-app/build.gradle b/mobile-app/build.gradle new file mode 100644 index 0000000..4f292d7 --- /dev/null +++ b/mobile-app/build.gradle @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'com.android.application' +apply from: "$rootDir/script/quality/quality-android-app.gradle" +apply from: "$rootDir/script/config/dependencies/mobile-app-dependencies.gradle" + +android { + compileSdkVersion rootProject.ext.androidCompileSdkVersion + buildToolsVersion rootProject.ext.androidBuildToolsVersion + + defaultConfig { + applicationId "com.github.amitkma.boilerplate.app" + minSdkVersion rootProject.ext.androidMinSdkVersion + targetSdkVersion rootProject.ext.androidTargetSdkVersion + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + if (project.hasProperty('devBuild')){ + aaptOptions.cruncherEnabled = false + } + + dexOptions{ + javaMaxHeapSize "2048m" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + +} diff --git a/mobile-app/proguard-rules.pro b/mobile-app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/mobile-app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/mobile-app/src/androidTest/java/com/github/amitkma/boilerplate/ExampleInstrumentedTest.java b/mobile-app/src/androidTest/java/com/github/amitkma/boilerplate/ExampleInstrumentedTest.java new file mode 100644 index 0000000..677b25d --- /dev/null +++ b/mobile-app/src/androidTest/java/com/github/amitkma/boilerplate/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.github.amitkma.boilerplate; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.github.amitkma.androidboilerplate", appContext.getPackageName()); + } +} diff --git a/mobile-app/src/main/AndroidManifest.xml b/mobile-app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d5ed23d --- /dev/null +++ b/mobile-app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mobile-app/src/main/java/com/github/amitkma/boilerplate/app/MainActivity.java b/mobile-app/src/main/java/com/github/amitkma/boilerplate/app/MainActivity.java new file mode 100644 index 0000000..9313550 --- /dev/null +++ b/mobile-app/src/main/java/com/github/amitkma/boilerplate/app/MainActivity.java @@ -0,0 +1,30 @@ +/* + * Copyright 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.github.amitkma.boilerplate.app; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} diff --git a/mobile-app/src/main/res/drawable/ic_launcher_background.xml b/mobile-app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d169d4 --- /dev/null +++ b/mobile-app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile-app/src/main/res/layout/activity_main.xml b/mobile-app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..32562be --- /dev/null +++ b/mobile-app/src/main/res/layout/activity_main.xml @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/mobile-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/mobile-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..c4a603d --- /dev/null +++ b/mobile-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mobile-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/mobile-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..c4a603d --- /dev/null +++ b/mobile-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mobile-app/src/main/res/mipmap-hdpi/ic_launcher.png b/mobile-app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..5507303 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/mobile-app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/mobile-app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..4e526c9 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/mobile-app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/mobile-app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..8fab6a3 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/mobile-app/src/main/res/mipmap-mdpi/ic_launcher.png b/mobile-app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..6bc7fcd Binary files /dev/null and b/mobile-app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/mobile-app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/mobile-app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..2c38c71 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/mobile-app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/mobile-app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..1eecc0e Binary files /dev/null and b/mobile-app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher.png b/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..ec87dce Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..072467e Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..05ca079 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..6f67f21 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..78a6b7a Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8bac0f2 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..0327e13 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..68ebe33 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..bacd3e7 Binary files /dev/null and b/mobile-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/mobile-app/src/main/res/values/colors.xml b/mobile-app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/mobile-app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/mobile-app/src/main/res/values/strings.xml b/mobile-app/src/main/res/values/strings.xml new file mode 100644 index 0000000..f3d263f --- /dev/null +++ b/mobile-app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Android Boilerplate + diff --git a/mobile-app/src/main/res/values/styles.xml b/mobile-app/src/main/res/values/styles.xml new file mode 100644 index 0000000..5885930 --- /dev/null +++ b/mobile-app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/presentation/.gitignore b/presentation/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/presentation/.gitignore @@ -0,0 +1 @@ +/build diff --git a/presentation/build.gradle b/presentation/build.gradle new file mode 100644 index 0000000..0ac65f0 --- /dev/null +++ b/presentation/build.gradle @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/config/java/library.gradle" +apply from: "$rootDir/script/config/dependencies/presentation-dependencies.gradle" + diff --git a/remote/.gitignore b/remote/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/remote/.gitignore @@ -0,0 +1 @@ +/build diff --git a/remote/build.gradle b/remote/build.gradle new file mode 100644 index 0000000..cd0fa7e --- /dev/null +++ b/remote/build.gradle @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/config/java/library.gradle" +apply from: "$rootDir/script/config/dependencies/remote-dependencies.gradle" + diff --git a/script/config/dependencies/all-dependencies.gradle b/script/config/dependencies/all-dependencies.gradle new file mode 100644 index 0000000..3b13482 --- /dev/null +++ b/script/config/dependencies/all-dependencies.gradle @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +allprojects { + repositories { + jcenter() + } +} + +ext { + //Android + androidBuildToolsVersion = "26.0.0" + androidMinSdkVersion = 15 + androidTargetSdkVersion = 26 + androidCompileSdkVersion = 26 + + //Libraries + supportLibraryVersion = '26.1.0' + butterKnifeVersion = '8.8.1' + rxJavaVersion = '2.1.3' + rxAndroidVersion = '2.0.1' + gsonVersion = '2.8.1' + okHttpVersion = '3.9.0' + retrofitVersion = '2.3.0' + roomVersion = '1.0.0-alpha9-1' + timberVersion = '4.5.1' + glideVersion = '4.0.0' + daggerVersion = '2.11' + + //Testing + robolectricVersion = '3.4.2' + jUnitVersion = '4.12' + assertJVersion = '3.8.0' + mockitoVersion = '1.9.5' + dexmakerVersion = '1.0' + espressoVersion = '3.0.0' + testingSupportLibVersion = '0.1' + mockitoAndroidVersion = '2.8.47' + androidSupportRunnerVersion = '1.0.0' + androidSupportRulesVersion = '1.0.0' + dexmakerMockitoversion = '2.2.0' + runnerVersion = '0.5' + + domainDependencies = [ + rxJava : "io.reactivex.rxjava2:rxjava:${rxJavaVersion}" + ] + + domainTestDependencies = [ + junit : "junit:junit:${jUnitVersion}", + mockito: "org.mockito:mockito-core:${mockitoVersion}", + assertj: "org.assertj:assertj-core:${assertJVersion}" + ] + + presentationDependencies = [ + daggerCompiler : "com.google.dagger:dagger-compiler:${daggerVersion}", + dagger : "com.google.dagger:dagger:${daggerVersion}", + okHttp : "com.squareup.okhttp3:okhttp:${okHttpVersion}", + okHttpLogger : "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}", + gson : "com.google.code.gson:gson:${gsonVersion}", + rxJava : "io.reactivex.rxjava2:rxjava:${rxJavaVersion}", + rxAndroid : "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}", + androidAnnotations: "com.android.support:support-annotations:${supportLibraryVersion}", + retrofit : "com.squareup.retrofit2:retrofit:${retrofitVersion}", + retrofitConverter : "com.squareup.retrofit2:converter-gson:${retrofitVersion}", + retrofitAdapter : "com.squareup.retrofit2:adapter-rxjava2:${retrofitVersion}" + ] + + presentationTestDependencies = [ + junit : "junit:junit:${jUnitVersion}", + assertj : "org.assertj:assertj-core:${assertJVersion}", + mockito : "org.mockito:mockito-core:${mockitoVersion}", + robolectric: "org.robolectric:robolectric:${robolectricVersion}" + ] + + dataDependencies = [ + daggerCompiler : "com.google.dagger:dagger-compiler:${daggerVersion}", + dagger : "com.google.dagger:dagger:${daggerVersion}", + okHttp : "com.squareup.okhttp3:okhttp:${okHttpVersion}", + okHttpLogger : "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}", + gson : "com.google.code.gson:gson:${gsonVersion}", + rxJava : "io.reactivex.rxjava2:rxjava:${rxJavaVersion}", + rxAndroid : "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}", + androidAnnotations: "com.android.support:support-annotations:${supportLibraryVersion}", + retrofit : "com.squareup.retrofit2:retrofit:${retrofitVersion}", + retrofitConverter : "com.squareup.retrofit2:converter-gson:${retrofitVersion}", + retrofitAdapter : "com.squareup.retrofit2:adapter-rxjava2:${retrofitVersion}" + ] + + dataTestDependencies = [ + junit : "junit:junit:${jUnitVersion}", + assertj : "org.assertj:assertj-core:${assertJVersion}", + mockito : "org.mockito:mockito-core:${mockitoVersion}", + robolectric: "org.robolectric:robolectric:${robolectricVersion}" + ] + + cacheDependencies = [ + daggerCompiler : "com.google.dagger:dagger-compiler:${daggerVersion}", + dagger : "com.google.dagger:dagger:${daggerVersion}", + gson : "com.google.code.gson:gson:${gsonVersion}", + rxJava : "io.reactivex.rxjava2:rxjava:${rxJavaVersion}", + androidAnnotations: "com.android.support:support-annotations:${supportLibraryVersion}", + roomRuntime : "android.arch.persistence.room:runtime:${roomVersion}", + roomCompiler : "android.arch.persistence.room:compiler:${roomVersion}", + roomRxJava : "android.arch.persistence.room:rxjava2:${roomVersion}", + ] + + cacheTestDependencies = [ + junit : "junit:junit:${jUnitVersion}", + assertj : "org.assertj:assertj-core:${assertJVersion}", + mockito : "org.mockito:mockito-core:${mockitoVersion}", + robolectric : "org.robolectric:robolectric:${robolectricVersion}", + roomTesting : "android.arch.persistence.room:testing:${roomVersion}", + archTesting : "android.arch.core:core-testing:${roomVersion}", + supportRunner: "com.android.support.test:runner:${androidSupportRunnerVersion}", + supportRules : "com.android.support.test:rules:${androidSupportRulesVersion}" + ] + + remoteDependencies = [ + daggerCompiler : "com.google.dagger:dagger-compiler:${daggerVersion}", + dagger : "com.google.dagger:dagger:${daggerVersion}", + gson : "com.google.code.gson:gson:${gsonVersion}", + rxJava : "io.reactivex.rxjava2:rxjava:${rxJavaVersion}", + androidAnnotations: "com.android.support:support-annotations:${supportLibraryVersion}", + okHttp : "com.squareup.okhttp3:okhttp:${okHttpVersion}", + okHttpLogger : "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}", + retrofit : "com.squareup.retrofit2:retrofit:${retrofitVersion}", + retrofitConverter : "com.squareup.retrofit2:converter-gson:${retrofitVersion}", + retrofitAdapter : "com.squareup.retrofit2:adapter-rxjava2:${retrofitVersion}" + ] + + remoteTestDependencies = [ + junit : "junit:junit:${jUnitVersion}", + assertj : "org.assertj:assertj-core:${assertJVersion}", + mockito : "org.mockito:mockito-core:${mockitoVersion}", + supportRunner: "com.android.support.test:runner:${androidSupportRunnerVersion}", + supportRules : "com.android.support.test:rules:${androidSupportRulesVersion}" + ] + + mobileUiDependencies = [ + daggerCompiler : "com.google.dagger:dagger-compiler:${daggerVersion}", + dagger : "com.google.dagger:dagger:${daggerVersion}", + rxJava : "io.reactivex.rxjava2:rxjava:${rxJavaVersion}", + rxAndroid : "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}", + glide : "com.github.bumptech.glide:glide:${glideVersion}", + androidAnnotations : "com.android.support:support-annotations:${supportLibraryVersion}", + androidSupportV4 : "com.android.support:support-v4:${supportLibraryVersion}", + androidSupportV13 : "com.android.support:support-v13:${supportLibraryVersion}", + appCompatV7 : "com.android.support:appcompat-v7:${supportLibraryVersion}", + supportRecyclerView: "com.android.support:recyclerview-v7:${supportLibraryVersion}", + supportDesign : "com.android.support:design:${supportLibraryVersion}", + timber : "com.jakewharton.timber:timber:${timberVersion}", + daggerSupport : "com.google.dagger:dagger-android-support:${daggerVersion}", + daggerProcessor : "com.google.dagger:dagger-android-processor:${daggerVersion}", + ] + + mobileUiTestDependencies = [ + junit : "junit:junit:${jUnitVersion}", + assertj : "org.assertj:assertj-core:${assertJVersion}", + mockito : "org.mockito:mockito-core:${mockitoVersion}", + supportRunner : "com.android.support.test:runner:${androidSupportRunnerVersion}", + supportRules : "com.android.support.test:rules:${androidSupportRulesVersion}", + mockitoAndroid : "org.mockito:mockito-android:${mockitoAndroidVersion}", + espressoCore : "com.android.support.test.espresso:espresso-core:${espressoVersion}", + espressoIntents: "com.android.support.test.espresso:espresso-intents:${espressoVersion}", + espressoContrib: "com.android.support.test.espresso:espresso-contrib:${espressoVersion}", + androidRunner : "com.android.support.test:runner:${runnerVersion}", + androidRules : "com.android.support.test:rules:${runnerVersion}" + ] + +} \ No newline at end of file diff --git a/script/config/dependencies/cache-dependencies.gradle b/script/config/dependencies/cache-dependencies.gradle new file mode 100644 index 0000000..81c7282 --- /dev/null +++ b/script/config/dependencies/cache-dependencies.gradle @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +dependencies { + + def cacheDependencies = rootProject.ext.cacheDependencies + def cacheTestDependencies = rootProject.ext.cacheTestDependencies + + implementation project(':data') + + implementation cacheDependencies.rxJava + implementation cacheDependencies.gson + + testImplementation cacheTestDependencies.junit + testImplementation cacheTestDependencies.mockito + testImplementation cacheTestDependencies.assertj + testImplementation cacheTestDependencies.robolectric + +} \ No newline at end of file diff --git a/script/config/dependencies/data-dependencies.gradle b/script/config/dependencies/data-dependencies.gradle new file mode 100644 index 0000000..355b2f0 --- /dev/null +++ b/script/config/dependencies/data-dependencies.gradle @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +dependencies { + def dataDependencies = rootProject.ext.dataDependencies + def dataTestDependencies = rootProject.ext.dataTestDependencies + + implementation project(':domain') + + implementation dataDependencies.rxJava + + testImplementation dataTestDependencies.junit + testImplementation dataTestDependencies.mockito + testImplementation dataTestDependencies.assertj +} diff --git a/script/config/dependencies/domain-dependencies.gradle b/script/config/dependencies/domain-dependencies.gradle new file mode 100644 index 0000000..88cc526 --- /dev/null +++ b/script/config/dependencies/domain-dependencies.gradle @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +dependencies { + def domainDependencies = rootProject.ext.domainDependencies + def domainTestDependencies = rootProject.ext.domainTestDependencies + + implementation domainDependencies.rxJava + + testImplementation domainTestDependencies.junit + testImplementation domainTestDependencies.mockito + testImplementation domainTestDependencies.assertj +} \ No newline at end of file diff --git a/script/config/dependencies/mobile-app-dependencies.gradle b/script/config/dependencies/mobile-app-dependencies.gradle new file mode 100644 index 0000000..4d4b76c --- /dev/null +++ b/script/config/dependencies/mobile-app-dependencies.gradle @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +dependencies { + def mobileUiDependencies = rootProject.ext.mobileUiDependencies + def mobileUiTestDependencies = rootProject.ext.mobileUiTestDependencies + + implementation project(':presentation') + implementation project(':data') + implementation project(':cache') + implementation project(':remote') + + // RxJava and RxAndroid + implementation mobileUiDependencies.rxJava + implementation mobileUiDependencies.rxAndroid + + // Android support libraries + implementation mobileUiDependencies.androidAnnotations + implementation mobileUiDependencies.androidSupportV4 + implementation mobileUiDependencies.androidSupportV13 + implementation mobileUiDependencies.appCompatV7 + implementation mobileUiDependencies.supportRecyclerView + implementation mobileUiDependencies.supportDesign + + // Timber for logging + implementation mobileUiDependencies.timber + + // Glide for image loading + implementation mobileUiDependencies.glide + + // Dagger for injection + implementation mobileUiDependencies.dagger + implementation mobileUiDependencies.daggerSupport + annotationProcessor mobileUiDependencies.daggerCompiler + annotationProcessor mobileUiDependencies.daggerProcessor + + // Instrumentation test dependencies + androidTestImplementation mobileUiTestDependencies.junit + androidTestImplementation mobileUiTestDependencies.mockito + androidTestImplementation mobileUiTestDependencies.mockitoAndroid + androidTestImplementation (mobileUiTestDependencies.espressoCore) { + exclude group: 'com.android.support', module: 'support-annotations' + } + androidTestImplementation (mobileUiTestDependencies.androidRunner) { + exclude group: 'com.android.support', module: 'support-annotations' + } + androidTestImplementation (mobileUiTestDependencies.androidRules) { + exclude group: 'com.android.support', module: 'support-annotations' + } + androidTestImplementation (mobileUiTestDependencies.espressoIntents) { + exclude group: 'com.android.support', module: 'support-annotations' + } + androidTestImplementation(mobileUiTestDependencies.espressoContrib) { + exclude module: 'appcompat' + exclude module: 'appcompat-v7' + exclude module: 'support-v4' + exclude module: 'support-v13' + exclude module: 'support-annotations' + exclude module: 'recyclerview-v7' + exclude module: 'design' + } +} \ No newline at end of file diff --git a/script/config/dependencies/presentation-dependencies.gradle b/script/config/dependencies/presentation-dependencies.gradle new file mode 100644 index 0000000..0cc3388 --- /dev/null +++ b/script/config/dependencies/presentation-dependencies.gradle @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +dependencies { + + def presentationDependencies = rootProject.ext.cacheDependencies + def presentationTestDependencies = rootProject.ext.cacheTestDependencies + + implementation project(':domain') + + implementation presentationDependencies.rxJava + + testImplementation presentationTestDependencies.junit + testImplementation presentationTestDependencies.mockito + testImplementation presentationTestDependencies.assertj + testImplementation presentationTestDependencies.robolectric +} \ No newline at end of file diff --git a/script/config/dependencies/remote-dependencies.gradle b/script/config/dependencies/remote-dependencies.gradle new file mode 100644 index 0000000..7871123 --- /dev/null +++ b/script/config/dependencies/remote-dependencies.gradle @@ -0,0 +1,37 @@ + +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +dependencies { + def remoteDependencies = rootProject.ext.remoteDependencies + def remoteTestDependencies = rootProject.ext.remoteTestDependencies + + implementation project(':data') + + implementation remoteDependencies.rxJava + implementation remoteDependencies.gson + implementation remoteDependencies.okHttp + implementation remoteDependencies.okHttpLogger + implementation remoteDependencies.retrofit + implementation remoteDependencies.retrofitConverter + implementation remoteDependencies.retrofitAdapter + + testImplementation remoteTestDependencies.junit + testImplementation remoteTestDependencies.mockito + testImplementation remoteTestDependencies.assertj + + +} \ No newline at end of file diff --git a/script/config/java/library.gradle b/script/config/java/library.gradle new file mode 100644 index 0000000..692f610 --- /dev/null +++ b/script/config/java/library.gradle @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'java-library' +apply from: "$rootDir/script/quality/quality-java.gradle" + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + diff --git a/script/quality/checkstyle/checkstyle-config.xml b/script/quality/checkstyle/checkstyle-config.xml new file mode 100644 index 0000000..57c5c17 --- /dev/null +++ b/script/quality/checkstyle/checkstyle-config.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/script/quality/checkstyle/checkstyle-xsl.xsl b/script/quality/checkstyle/checkstyle-xsl.xsl new file mode 100644 index 0000000..29a59ef --- /dev/null +++ b/script/quality/checkstyle/checkstyle-xsl.xsl @@ -0,0 +1,372 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CheckStyle Audit + + + + + + + <h2>Frame Alert</h2> + <p> + This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. + </p> + + + + + + + + + + + + +

CheckStyle Audit

Designed for use with CheckStyle and Ant.
+
+
+ + + + + + + + + + + + +
+ + + + + +
+ + + .bannercell { + border: 0px; + padding: 0px; + } + body { + margin-left: 10; + margin-right: 10; + font:normal 80% arial,helvetica,sanserif; + background-color:#FFFFFF; + color:#000000; + } + .a td { + background: #efefef; + } + .b td { + background: #fff; + } + th, td { + text-align: left; + vertical-align: top; + } + th { + font-weight:bold; + background: #ccc; + color: black; + } + table, th, td { + font-size:100%; + border: none + } + table.log tr td, tr th { + + } + h2 { + font-weight:bold; + font-size:140%; + margin-bottom: 5; + } + h3 { + font-size:100%; + font-weight:bold; + background: #525D76; + color: white; + text-decoration: none; + padding: 5px; + margin-right: 2px; + margin-left: 2px; + margin-bottom: 0; + } + + + + + + + + + + + + + + + +

Files

+

Summary

+

+ + + + + +
+

+ + +
+ + +

Files

+ + + + + + + + +
NameErrors
+
+ + + + + + + + + + + + + + + + + + + + + files/.html + + + + + + + + + + + + + + + + + + + + + + + + + + + files/.html + + + + + + + + + + + + + ../ + + + + + + ../ + + + + + + + + + + + + + + + + + + + + + + stylesheet.css + + + + +

File

+ + + + + + + + + + + + +
Error DescriptionLine
+ + +
+
+
+ + +

Summary

+ + + + + + + + + + + + +
FilesErrors
+
+ + + + a + b + + + + + + + + + +
\ No newline at end of file diff --git a/script/quality/checkstyle/java.header b/script/quality/checkstyle/java.header new file mode 100644 index 0000000..340afa3 --- /dev/null +++ b/script/quality/checkstyle/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright 2017 Amit Kumar. +^ \* +^ \* Licensed under the Apache License, Version 2.0 \(the "License"\); +^ \* you may not use this file except in compliance with the License. +^ \* You may obtain a copy of the License at +^ \* +^ \* http://www.apache.org/licenses/LICENSE-2.0 +^ \* +^ \* Unless required by applicable law or agreed to in writing, software distributed +^ \* under the License is distributed on an "AS IS" BASIS, +^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +^ \* See the License for the specific language governing permissions and +^ \* limitations under the License. +^ \*/$ \ No newline at end of file diff --git a/script/quality/checkstyle/suppressions.xml b/script/quality/checkstyle/suppressions.xml new file mode 100644 index 0000000..448ed3b --- /dev/null +++ b/script/quality/checkstyle/suppressions.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/script/quality/checkstyle/xml.header b/script/quality/checkstyle/xml.header new file mode 100644 index 0000000..bcc4b4f --- /dev/null +++ b/script/quality/checkstyle/xml.header @@ -0,0 +1,16 @@ +^<\?xml version="1.0" encoding="utf-8"\?>$ +^$ \ No newline at end of file diff --git a/script/quality/findbugs/android-exclude-filter.xml b/script/quality/findbugs/android-exclude-filter.xml new file mode 100644 index 0000000..c6b4a7e --- /dev/null +++ b/script/quality/findbugs/android-exclude-filter.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/script/quality/pmd/pmd-ruleset.xml b/script/quality/pmd/pmd-ruleset.xml new file mode 100644 index 0000000..5dcc2b4 --- /dev/null +++ b/script/quality/pmd/pmd-ruleset.xml @@ -0,0 +1,59 @@ + + + + + + Custom ruleset for boilerplate application + + .*/R.java + .*/gen/.* + .*/test.*/.* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/script/quality/quality-android-app.gradle b/script/quality/quality-android-app.gradle new file mode 100644 index 0000000..089d366 --- /dev/null +++ b/script/quality/quality-android-app.gradle @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/quality/quality.gradle" + +android.applicationVariants.all { variant -> + generateCheckstyleTaskForVariant(variant) + generatePMDTaskForVariant(variant) + generateFindbugsTaskForVariant(variant) + generateCheckQualityTaskForVariant(variant) +} \ No newline at end of file diff --git a/script/quality/quality-android-lib.gradle b/script/quality/quality-android-lib.gradle new file mode 100644 index 0000000..8f1ee12 --- /dev/null +++ b/script/quality/quality-android-lib.gradle @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/quality/quality.gradle" + +android.libraryVariants.all { variant -> + generateCheckstyleTaskForVariant(variant) + generatePMDTaskForVariant(variant) + generateFindbugsTaskForVariant(variant) + generateCheckQualityTaskForVariant(variant) +} \ No newline at end of file diff --git a/script/quality/quality-java.gradle b/script/quality/quality-java.gradle new file mode 100644 index 0000000..add699b --- /dev/null +++ b/script/quality/quality-java.gradle @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply from: "$rootDir/script/quality/quality.gradle" + +generateCheckstyleTask("", "", "main") +generatePMDTask("", "", "main") +generateFindbugsTask("", "", "main") +generateCheckQualityTask("main", false) + diff --git a/script/quality/quality.gradle b/script/quality/quality.gradle new file mode 100644 index 0000000..21c3f17 --- /dev/null +++ b/script/quality/quality.gradle @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Set up Checkstyle, Findbugs and PMD to perform extensive code analysis. + * + * Gradle tasks added: + * - checkstyle + * - findbugs + * - pmd + * + * The three tasks above are added as dependencies of the check task so running check will + * run all of them. + */ + +apply plugin: 'checkstyle' +apply plugin: 'findbugs' +apply plugin: 'pmd' + +apply from: "$rootDir/script/utils.gradle" + +dependencies { + checkstyle 'com.puppycrawl.tools:checkstyle:7.7' +} + +ext.qualityConfigDir = "$rootDir/script/quality"; +ext.reportsDir = "$buildDir/reports" + +check.dependsOn 'checkQuality' + +class CheckQuality extends DefaultTask {} + +task checkQuality(type: CheckQuality) { + group = "Verification" + description = "Runs all static analysis checks on all build variants." +} + +def generateCheckQualityTask(String buildVariant, boolean withLint) { + buildVariant = buildVariant.capitalize() + + def checkQualityVariant = "check${buildVariant}Quality" + def checkQualityVariantTaskDependencies = [ + "checkstyle${buildVariant}", + "pmd${buildVariant}", + "findbugs${buildVariant}" + ] + if (withLint) { + checkQualityVariantTaskDependencies += "lint${buildVariant}" + } + + task(checkQualityVariant, type: CheckQuality, dependsOn: checkQualityVariantTaskDependencies) { + group = "Verification" + description = "Runs all static analysis checks on the ${buildVariant} build variant." + } + + tasks.checkQuality.dependsOn "${checkQualityVariant}" +} + +def generateCheckQualityTaskForVariant(variant) { + generateCheckQualityTask(variant.name, true) +} + +removeCheckTaskIf("checkstyle", Checkstyle) + +task checkstyle(type: Checkstyle) { + group = "Verification" + description = "Checks style of source code of all build variants." +} + +def generateCheckstyleTask(String flavor, String buildType, String buildVariant) { + def checkstyleVariant = "checkstyle${buildVariant.capitalize()}" + + task(checkstyleVariant, type: Checkstyle) { + group = "Verification" + description = "Checks style of source code for ${buildVariant} build variant." + + configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml") + configProperties.checkstyleSuppressionsPath = file("$qualityConfigDir/checkstyle/suppressions.xml").absolutePath + configProperties.checkstyleJavaHeaderPath = file("$qualityConfigDir/checkstyle/java.header").absolutePath + configProperties.checkstyleXmlHeaderPath = file("$qualityConfigDir/checkstyle/xml.header").absolutePath + + source resolveSourceDirs(flavor, buildType, buildVariant) + classpath = files() // intentionally blank to prevent duplicate analysis + include '**/*.java' + include '**/*.xml' + exclude '**/gen/**' + + reports { + xml.enabled = false + html.enabled = true + xml { + destination "$reportsDir/checkstyle/${buildVariant}/${checkstyleVariant}.xml" + } + html { + destination "$reportsDir/checkstyle/${buildVariant}/${checkstyleVariant}.html" + } + } + } + + tasks.checkstyle.dependsOn checkstyleVariant +} + +def generateCheckstyleTaskForVariant(variant) { + def flavor = variant.flavorName + def buildType = variant.buildType.name + def buildVariant = flavor + (flavor.isEmpty() ? buildType : buildType.capitalize()) + generateCheckstyleTask(flavor, buildType, buildVariant) +} + +removeCheckTaskIf("pmd", Pmd) + +task pmd(type: Pmd) { + group = "Verification" + description = "Finds bugs in source code on all build variants." +} + +def generatePMDTask(String flavor, String buildType, String buildVariant) { + def pmdVariant = "pmd${buildVariant.capitalize()}" + + task(pmdVariant, type: Pmd) { + group = "Verification" + description = "Finds bugs in source code on the {$buildVariant} build variant." + + ignoreFailures = false + ruleSetFiles = files("$qualityConfigDir/pmd/pmd-ruleset.xml") + ruleSets = [] + + source resolveSourceDirs(flavor, buildType, buildVariant) + include '**/*.java' + exclude '**/gen/**' + + reports { + xml.enabled = false + html.enabled = true + xml { + destination "$reportsDir/pmd/${buildVariant}/${pmdVariant}.xml" + } + html { + destination "$reportsDir/pmd/${buildVariant}/${pmdVariant}.html" + } + } + } + + tasks.pmd.dependsOn pmdVariant +} + +def generatePMDTaskForVariant(variant) { + def flavor = variant.flavorName + def buildType = variant.buildType.name + def buildVariant = flavor + (flavor.isEmpty() ? buildType : buildType.capitalize()) + generatePMDTask(flavor, buildType, buildVariant) +} + +removeCheckTaskIf("findbugs", FindBugs) + +task findbugs(type: FindBugs) { + group = "Verification" + description = "Finds bugs in bytecode on all build variants." +} + +def generateFindbugsTask(String flavor, String buildType, String buildVariant) { + def findbugsDependency = buildType.isEmpty() ? "assemble" : "assemble${buildVariant.capitalize()}" + def findbugsVariant = "findbugs${buildVariant.capitalize()}" + + task(findbugsVariant, type: FindBugs, dependsOn: "${findbugsDependency}") { + group = "Verification" + description = "Finds bugs in bytecode on the ${buildVariant} build variant." + + ignoreFailures = false + effort = "max" + reportLevel = "high" + excludeFilter = new File("$qualityConfigDir/findbugs/android-exclude-filter.xml") + + def classesDir = resolveClassesDir(flavor, buildType, buildVariant) + source resolveSourceDirs(flavor, buildType, buildVariant) + classes = files(classesDir) + classpath = files() // intentionally blank to prevent duplicate analysis + include '**/*.java' + exclude '**/gen/**' + + reports { + xml.enabled = false + html.enabled = true + xml { + destination "$reportsDir/findbugs/${buildVariant}/${findbugsVariant}.xml" + } + html { + destination "$reportsDir/findbugs/${buildVariant}/${findbugsVariant}.html" + } + } + } + + tasks.findbugs.dependsOn findbugsVariant +} + +def generateFindbugsTaskForVariant(variant) { + def flavor = variant.flavorName + def buildType = variant.buildType.name + def buildVariant = flavor + (flavor.isEmpty() ? buildType : buildType.capitalize()) + generateFindbugsTask(flavor, buildType, buildVariant) +} + +ext { + generateCheckQualityTask = this.&generateCheckQualityTask + generateCheckQualityTaskForVariant = this.&generateCheckQualityTaskForVariant + generateCheckstyleTask = this.&generateCheckstyleTask + generateCheckstyleTaskForVariant = this.&generateCheckstyleTaskForVariant + generatePMDTask = this.&generatePMDTask + generatePMDTaskForVariant = this.&generatePMDTaskForVariant + generateFindbugsTask = this.&generateFindbugsTask + generateFindbugsTaskForVariant = this.&generateFindbugsTaskForVariant +} + diff --git a/script/utils.gradle b/script/utils.gradle new file mode 100644 index 0000000..ffe67d7 --- /dev/null +++ b/script/utils.gradle @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2017 Amit Kumar. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed + * under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +def resolveSourceDirs(String flavor, String buildType, String buildVariant) { + def sourceDirs = [ + "${projectDir}/src/main/java", + ] + + if (!buildType.isEmpty()) { + sourceDirs += "${projectDir}/src/${buildType}/java" + if (!flavor.isEmpty()) { + sourceDirs += "${projectDir}/src/${flavor}/java" + } + } + + def buildVariantDir = "${projectDir}/src/${buildVariant}/java" + if (!sourceDirs.contains(buildVariantDir)) { + sourceDirs += buildVariantDir + } + + return sourceDirs +} + +def resolveClassesDir(String flavor, String buildType, String buildVariant) { + if (!buildType.isEmpty() && !flavor.isEmpty()) { + return "${buildDir}/intermediates/classes/${flavor}/${buildType}" + } else if (!buildType.isEmpty()) { + return "${buildDir}/intermediates/classes/${buildType}" + } else { + return "${buildDir}/classes/${buildVariant}" + } +} + +def removeCheckTaskIf(taskName, taskType) { + def checkDependencyTaskName = "${taskName}Test" + def checkDependencyTask = tasks.findByName(checkDependencyTaskName) + + // remove all instances of the task + tasks.removeIf { task -> + task.name.contains(taskName) + } + + // redefine deprecated check dependency task (for VerificationTasks) + if (checkDependencyTask != null) { + // deprecate this check task (unfortunately we are unable to remove it) + task(checkDependencyTaskName, type: taskType, overwrite: true) { + group = null + description = "Deprecated. This does nothing" + } + } +} + +ext { + resolveSourceDirs = this.&resolveSourceDirs + resolveClassesDir = this.&resolveClassesDir + removeCheckTaskIf = this.&removeCheckTaskIf +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..579d921 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':mobile-app', ':presentation', ':remote', ':data', ':domain', ':cache'