Skip to content

Commit

Permalink
Organize build logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
android10 committed Mar 1, 2015
1 parent d80a9d7 commit 65ec607
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 70 deletions.
17 changes: 7 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
apply from: 'buildsrc/dependencies.gradle'

buildscript {
repositories {
jcenter()
Expand All @@ -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 changes: 74 additions & 0 deletions buildsrc/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -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}",
]
}
7 changes: 4 additions & 3 deletions data-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 10 additions & 12 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ android {
}

dependencies {
def domainLayer = project(':domain')

//project dependencies
compile domainLayer

//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'
def dataDependencies = rootProject.ext.dataDependencies

compile project(':domain')

apt dataDependencies.daggerCompiler
compile dataDependencies.dagger
compile dataDependencies.gson
compile dataDependencies.rxJava
compile dataDependencies.rxAndroid
provided dataDependencies.javaxAnnotation
}
11 changes: 6 additions & 5 deletions domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
23 changes: 5 additions & 18 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
41 changes: 20 additions & 21 deletions presentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -39,25 +40,23 @@ android {
}

dependencies {
def domainLayer = project(':domain')
def dataLayer = project(':data')

compile domainLayer
compile dataLayer

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.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'
def presentationDependencies = rootProject.ext.presentationDependencies
def presentationTestDependencies = rootProject.ext.presentationTestDependencies

compile project(':domain')
compile project(':data')

apt presentationDependencies.daggerCompiler
compile presentationDependencies.dagger
compile presentationDependencies.butterKnife
compile presentationDependencies.recyclerView
compile presentationDependencies.rxJava
compile presentationDependencies.rxAndroid
provided presentationDependencies.javaxAnnotation

androidTestCompile presentationTestDependencies.mockito
androidTestCompile presentationTestDependencies.dexmaker
androidTestCompile presentationTestDependencies.dexmakerMockito
androidTestCompile presentationTestDependencies.espresso
androidTestCompile presentationTestDependencies.testingSupportLib
}
5 changes: 4 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
include ':presentation', ':domain', ':data', ':data-test'
include ':presentation'
include ':domain'
include ':data'
include ':data-test'

0 comments on commit 65ec607

Please sign in to comment.