forked from cangwang/Gank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common_config.gradle
92 lines (84 loc) · 3.12 KB
/
common_config.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project.ext {
compileSdkVersion25 = 25
buildToolsVersion25 = "25.0.2"
minSdkVersion14 = 14
targetSdkVersion25 = 25
applicationId = "material.com.gank"
isDebug = false;
isLib = false;
isSettingDebug = false;
isNewsDebug = false;
//设置App配置
setAppDefaultConfig = {
extension->
extension.apply plugin: 'com.android.application'
extension.description "app"
setAndroidConfig extension.android
setDependencies extension.dependencies
}
//设置Lib配置
setLibDefaultConfig = {
extension ->
extension.apply plugin: 'com.android.library'
extension.description "lib"
setAndroidConfig extension.android
extension.android {
defaultConfig {
defaultPublishConfig 'release'
publishNonDefault true
}
}
setDependencies extension.dependencies
}
setDefaultConfig = {
extension->
setAndroidConfig extension.android
setDependencies extension.dependencies
}
//设置Android配置
setAndroidConfig ={
extension->
extension.compileSdkVersion 25
extension.buildToolsVersion "25.0.2"
extension.defaultConfig {
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [ moduleName : extension.project.getName() ]
}
}
}
extension.buildTypes{
debug{
extension.defaultConfig{minSdkVersion 21}
}
release{
extension.defaultConfig{minSdkVersion 14}
}
}
extension.dataBinding{
enabled = true
}
extension.project.tasks.whenTaskAdded { task ->
if (task.name.contains("lint")//不启动lint代码扫描潜在bug可以使用
||task.name.equals("clean")
||task.name.contains("Aidl") //项目中有用到aidl则不可以舍弃这个任务
||task.name.contains("mockableAndroidJar")//用不到测试的时候就可以先关闭
||task.name.contains("UnitTest")//用不到测试的时候就可以先关闭
||task.name.contains("AndroidTest")//用不到NDK和JNI的也关闭掉
|| task.name.contains("Ndk")
|| task.name.contains("Jni")
) {
task.enabled = false
}
}
}
//设置依赖
setDependencies = {
extension->
extension.compile fileTree(dir: 'libs', include: ['*.jar'])
extension.annotationProcessor 'com.alibaba:arouter-compiler:1.1.4'
}
}