mirror of
https://github.com/android10/Android-CleanArchitecture.git
synced 2026-03-13 10:13:41 +08:00
Organize build logic.
This commit is contained in:
17
build.gradle
17
build.gradle
@@ -1,3 +1,5 @@
|
||||
apply from: 'buildsrc/dependencies.gradle'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
@@ -8,21 +10,16 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
description 'Creates the gradle wrapper.'
|
||||
gradleVersion '2.2.1'
|
||||
}
|
||||
|
||||
allprojects {
|
||||
ext {
|
||||
androidBuildToolsVersion = "21.1.2"
|
||||
androidMinSdkVersion = 15
|
||||
androidTargetSdkVersion = 21
|
||||
androidCompileSdkVersion = 21
|
||||
androidApplicationId = 'com.fernandocejas.android10.sample.presentation'
|
||||
androidVersionCode = 1
|
||||
androidVersionName = "1.0"
|
||||
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
74
buildsrc/dependencies.gradle
Normal file
74
buildsrc/dependencies.gradle
Normal file
@@ -0,0 +1,74 @@
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
//Android
|
||||
androidBuildToolsVersion = "21.1.2"
|
||||
androidMinSdkVersion = 15
|
||||
androidTargetSdkVersion = 21
|
||||
androidCompileSdkVersion = 21
|
||||
|
||||
//Libraries
|
||||
daggerVersion = '2.0-SNAPSHOT'
|
||||
butterKnifeVersion = '6.0.0'
|
||||
recyclerViewVersion = '21.0.3'
|
||||
rxJavaVersion = '1.0.3'
|
||||
rxAndroidVersion = '0.23.0'
|
||||
javaxAnnotationVersion = '10.0-b28'
|
||||
gsonVersion = '2.3'
|
||||
|
||||
//Testing
|
||||
robolectricVersion = '2.4'
|
||||
jUnitVersion = '4.11'
|
||||
mockitoVersion = '1.9.5'
|
||||
dexmakerVersion = '1.0'
|
||||
espressoVersion = '2.0'
|
||||
testingSupportLibVersion = '0.1'
|
||||
|
||||
|
||||
presentationDependencies = [
|
||||
daggerCompiler: "com.google.dagger:dagger-compiler:${daggerVersion}",
|
||||
dagger: "com.google.dagger:dagger:${daggerVersion}",
|
||||
butterKnife: "com.jakewharton:butterknife:${butterKnifeVersion}",
|
||||
recyclerView: "com.android.support:recyclerview-v7:${recyclerViewVersion}",
|
||||
rxJava: "io.reactivex:rxjava:${rxJavaVersion}",
|
||||
rxAndroid: "io.reactivex:rxandroid:${rxAndroidVersion}",
|
||||
javaxAnnotation: "org.glassfish:javax.annotation:${javaxAnnotationVersion}",
|
||||
]
|
||||
|
||||
presentationTestDependencies = [
|
||||
mockito: "org.mockito:mockito-core:${mockitoVersion}",
|
||||
dexmaker: "com.google.dexmaker:dexmaker:${dexmakerVersion}",
|
||||
dexmakerMockito: "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}",
|
||||
espresso: "com.android.support.test.espresso:espresso-core:${espressoVersion}",
|
||||
testingSupportLib: "com.android.support.test:testing-support-lib:${testingSupportLibVersion}",
|
||||
]
|
||||
|
||||
domainDependencies = [
|
||||
rxJava: "io.reactivex:rxjava:${rxJavaVersion}",
|
||||
]
|
||||
|
||||
domainTestDependencies = [
|
||||
junit: "junit:junit:${jUnitVersion}",
|
||||
mockito: "org.mockito:mockito-core:${mockitoVersion}",
|
||||
]
|
||||
|
||||
dataDependencies = [
|
||||
daggerCompiler: "com.google.dagger:dagger-compiler:${daggerVersion}",
|
||||
dagger: "com.google.dagger:dagger:${daggerVersion}",
|
||||
gson: "com.google.code.gson:gson:${gsonVersion}",
|
||||
rxJava: "io.reactivex:rxjava:${rxJavaVersion}",
|
||||
rxAndroid: "io.reactivex:rxandroid:${rxAndroidVersion}",
|
||||
javaxAnnotation: "org.glassfish:javax.annotation:${javaxAnnotationVersion}",
|
||||
]
|
||||
|
||||
dataTestDependencies = [
|
||||
junit: "junit:junit:${jUnitVersion}",
|
||||
mockito: "org.mockito:mockito-core:${mockitoVersion}",
|
||||
robolectric: "org.robolectric:robolectric:${robolectricVersion}",
|
||||
]
|
||||
}
|
||||
@@ -15,9 +15,10 @@ dependencies {
|
||||
//noinspection GroovyAssignabilityCheck
|
||||
testCompile files(dataLayer.android.bootClasspath)
|
||||
|
||||
testCompile 'org.mockito:mockito-core:1.9.5'
|
||||
testCompile 'junit:junit:4.11'
|
||||
testCompile 'org.robolectric:robolectric:2.4'
|
||||
def dataTestDependencies = rootProject.ext.dataTestDependencies
|
||||
testCompile dataTestDependencies.junit
|
||||
testCompile dataTestDependencies.mockito
|
||||
testCompile dataTestDependencies.robolectric
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -34,16 +34,14 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def domainLayer = project(':domain')
|
||||
def dataDependencies = rootProject.ext.dataDependencies
|
||||
|
||||
//project dependencies
|
||||
compile domainLayer
|
||||
compile project(':domain')
|
||||
|
||||
//library dependencies
|
||||
apt "com.google.dagger:dagger-compiler:2.0-SNAPSHOT"
|
||||
provided 'org.glassfish:javax.annotation:10.0-b28'
|
||||
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
|
||||
compile('com.google.code.gson:gson:2.3')
|
||||
compile 'io.reactivex:rxjava:1.0.3'
|
||||
compile 'io.reactivex:rxandroid:0.23.0'
|
||||
apt dataDependencies.daggerCompiler
|
||||
compile dataDependencies.dagger
|
||||
compile dataDependencies.gson
|
||||
compile dataDependencies.rxJava
|
||||
compile dataDependencies.rxAndroid
|
||||
provided dataDependencies.javaxAnnotation
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
dependencies {
|
||||
//library dependencies
|
||||
compile 'io.reactivex:rxjava:1.0.3'
|
||||
def domainDependencies = rootProject.ext.domainDependencies
|
||||
def domainTestDependencies = rootProject.ext.domainTestDependencies
|
||||
|
||||
//test dependencies
|
||||
testCompile 'junit:junit:4.11'
|
||||
testCompile 'org.mockito:mockito-core:1.9.5'
|
||||
compile domainDependencies.rxJava
|
||||
|
||||
testCompile domainTestDependencies.junit
|
||||
testCompile domainTestDependencies.mockito
|
||||
}
|
||||
@@ -1,18 +1,5 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Settings specified in this file will override any Gradle settings
|
||||
# configured through the IDE.
|
||||
|
||||
# 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.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# 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
|
||||
#Gradle configuration
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
org.gradle.configureondemand=true
|
||||
|
||||
@@ -10,6 +10,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
|
||||
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
|
||||
|
||||
applicationId globalConfiguration.getAt("androidApplicationId")
|
||||
versionCode globalConfiguration.getAt("androidVersionCode")
|
||||
versionName globalConfiguration.getAt("androidVersionName")
|
||||
@@ -39,25 +40,23 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def domainLayer = project(':domain')
|
||||
def dataLayer = project(':data')
|
||||
def presentationDependencies = rootProject.ext.presentationDependencies
|
||||
def presentationTestDependencies = rootProject.ext.presentationTestDependencies
|
||||
|
||||
compile domainLayer
|
||||
compile dataLayer
|
||||
compile project(':domain')
|
||||
compile project(':data')
|
||||
|
||||
apt "com.google.dagger:dagger-compiler:2.0-SNAPSHOT"
|
||||
apt presentationDependencies.daggerCompiler
|
||||
compile presentationDependencies.dagger
|
||||
compile presentationDependencies.butterKnife
|
||||
compile presentationDependencies.recyclerView
|
||||
compile presentationDependencies.rxJava
|
||||
compile presentationDependencies.rxAndroid
|
||||
provided presentationDependencies.javaxAnnotation
|
||||
|
||||
provided 'org.glassfish:javax.annotation:10.0-b28'
|
||||
|
||||
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
|
||||
compile 'com.jakewharton:butterknife:6.0.0'
|
||||
compile 'com.android.support:recyclerview-v7:21.0.3'
|
||||
compile 'io.reactivex:rxjava:1.0.3'
|
||||
compile 'io.reactivex:rxandroid:0.23.0'
|
||||
|
||||
androidTestCompile 'org.mockito:mockito-core:1.9.5'
|
||||
androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
|
||||
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
|
||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
|
||||
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
|
||||
androidTestCompile presentationTestDependencies.mockito
|
||||
androidTestCompile presentationTestDependencies.dexmaker
|
||||
androidTestCompile presentationTestDependencies.dexmakerMockito
|
||||
androidTestCompile presentationTestDependencies.espresso
|
||||
androidTestCompile presentationTestDependencies.testingSupportLib
|
||||
}
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
include ':presentation', ':domain', ':data', ':data-test'
|
||||
include ':presentation'
|
||||
include ':domain'
|
||||
include ':data'
|
||||
include ':data-test'
|
||||
|
||||
Reference in New Issue
Block a user