Last active
June 17, 2016 00:10
-
-
Save Orange168/3e42a562bafd6b9b0174114140f3e498 to your computer and use it in GitHub Desktop.
globalConfiguration gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply from: 'buildsystem/ci.gradle' | |
apply from: 'buildsystem/dependencies.gradle' | |
buildscript { | |
repositories { | |
jcenter() | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:2.2.0-alpha3' | |
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' | |
classpath "com.fernandocejas.frodo:frodo-plugin:0.8.1" | |
} | |
} | |
allprojects { | |
ext { | |
androidApplicationId = 'com.fernanependocejas.android10.sample.presentation' | |
androidVersionCode = 1 | |
androidVersionName = "1.0" | |
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" | |
testApplicationId = 'com.fernandocejas.android10.sample.presentation.test' | |
} | |
} | |
=========================================================================================== | |
Usage | |
========================================================================================== | |
在模块中中使用 | |
def globalConfiguration = rootProject.extensions.getByName("ext") | |
compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
repositories { | |
jcenter() | |
} | |
} | |
ext { | |
//Android | |
androidBuildToolsVersion = "23.0.1" | |
androidMinSdkVersion = 15 | |
androidTargetSdkVersion = 21 | |
androidCompileSdkVersion = 21 | |
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: "javax.annotation:jsr250-api:${javaxAnnotationVersion}", | |
] | |
} | |
=========================================================================================== | |
Usage at gralde file | |
=========================================================================================== | |
1. 全局在工程build.gradle 中导入 apply from: 'buildsystem/dependencies.gradle' | |
// 错误理解2. 局部在本模块build.gradle中导入 apply from: 'buildsystem/dependencies.gradle' | |
def presentationDependencies = rootProject.ext.presentationDependencies | |
compile presentationDependencies.dagger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment