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 {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
@@ -8,21 +10,16 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
description 'Creates the gradle wrapper.'
|
||||||
|
gradleVersion '2.2.1'
|
||||||
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
ext {
|
ext {
|
||||||
androidBuildToolsVersion = "21.1.2"
|
|
||||||
androidMinSdkVersion = 15
|
|
||||||
androidTargetSdkVersion = 21
|
|
||||||
androidCompileSdkVersion = 21
|
|
||||||
androidApplicationId = 'com.fernandocejas.android10.sample.presentation'
|
androidApplicationId = 'com.fernandocejas.android10.sample.presentation'
|
||||||
androidVersionCode = 1
|
androidVersionCode = 1
|
||||||
androidVersionName = "1.0"
|
androidVersionName = "1.0"
|
||||||
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
|
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
|
//noinspection GroovyAssignabilityCheck
|
||||||
testCompile files(dataLayer.android.bootClasspath)
|
testCompile files(dataLayer.android.bootClasspath)
|
||||||
|
|
||||||
testCompile 'org.mockito:mockito-core:1.9.5'
|
def dataTestDependencies = rootProject.ext.dataTestDependencies
|
||||||
testCompile 'junit:junit:4.11'
|
testCompile dataTestDependencies.junit
|
||||||
testCompile 'org.robolectric:robolectric:2.4'
|
testCompile dataTestDependencies.mockito
|
||||||
|
testCompile dataTestDependencies.robolectric
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -34,16 +34,14 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
def domainLayer = project(':domain')
|
def dataDependencies = rootProject.ext.dataDependencies
|
||||||
|
|
||||||
//project dependencies
|
compile project(':domain')
|
||||||
compile domainLayer
|
|
||||||
|
|
||||||
//library dependencies
|
apt dataDependencies.daggerCompiler
|
||||||
apt "com.google.dagger:dagger-compiler:2.0-SNAPSHOT"
|
compile dataDependencies.dagger
|
||||||
provided 'org.glassfish:javax.annotation:10.0-b28'
|
compile dataDependencies.gson
|
||||||
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
|
compile dataDependencies.rxJava
|
||||||
compile('com.google.code.gson:gson:2.3')
|
compile dataDependencies.rxAndroid
|
||||||
compile 'io.reactivex:rxjava:1.0.3'
|
provided dataDependencies.javaxAnnotation
|
||||||
compile 'io.reactivex:rxandroid:0.23.0'
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ sourceCompatibility = 1.7
|
|||||||
targetCompatibility = 1.7
|
targetCompatibility = 1.7
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//library dependencies
|
def domainDependencies = rootProject.ext.domainDependencies
|
||||||
compile 'io.reactivex:rxjava:1.0.3'
|
def domainTestDependencies = rootProject.ext.domainTestDependencies
|
||||||
|
|
||||||
//test dependencies
|
compile domainDependencies.rxJava
|
||||||
testCompile 'junit:junit:4.11'
|
|
||||||
testCompile 'org.mockito:mockito-core:1.9.5'
|
testCompile domainTestDependencies.junit
|
||||||
|
testCompile domainTestDependencies.mockito
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,5 @@
|
|||||||
# Project-wide Gradle settings.
|
#Gradle configuration
|
||||||
|
org.gradle.daemon=true
|
||||||
# IDE (e.g. Android Studio) users:
|
org.gradle.jvmargs=-Dfile.encoding=UTF-8
|
||||||
# Settings specified in this file will override any Gradle settings
|
org.gradle.parallel=true
|
||||||
# configured through the IDE.
|
org.gradle.configureondemand=true
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
|
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
|
||||||
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
|
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
|
||||||
|
|
||||||
applicationId globalConfiguration.getAt("androidApplicationId")
|
applicationId globalConfiguration.getAt("androidApplicationId")
|
||||||
versionCode globalConfiguration.getAt("androidVersionCode")
|
versionCode globalConfiguration.getAt("androidVersionCode")
|
||||||
versionName globalConfiguration.getAt("androidVersionName")
|
versionName globalConfiguration.getAt("androidVersionName")
|
||||||
@@ -39,25 +40,23 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
def domainLayer = project(':domain')
|
def presentationDependencies = rootProject.ext.presentationDependencies
|
||||||
def dataLayer = project(':data')
|
def presentationTestDependencies = rootProject.ext.presentationTestDependencies
|
||||||
|
|
||||||
compile domainLayer
|
compile project(':domain')
|
||||||
compile dataLayer
|
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'
|
androidTestCompile presentationTestDependencies.mockito
|
||||||
|
androidTestCompile presentationTestDependencies.dexmaker
|
||||||
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
|
androidTestCompile presentationTestDependencies.dexmakerMockito
|
||||||
compile 'com.jakewharton:butterknife:6.0.0'
|
androidTestCompile presentationTestDependencies.espresso
|
||||||
compile 'com.android.support:recyclerview-v7:21.0.3'
|
androidTestCompile presentationTestDependencies.testingSupportLib
|
||||||
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'
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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