-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
108 lines (93 loc) · 2.68 KB
/
build.gradle
File metadata and controls
108 lines (93 loc) · 2.68 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
println "-----MyAndroid configure start-----"
// 入口是这里,就算前面有代码也在它之后执行
// 适用于apply plugin
buildscript {
ext {
//def repo2 = 'file:../build/maven'
repo_snapshot = "${rootProject.rootDir.path}/.aar/maven/libs-snapshot"
repo_release = "${rootProject.rootDir.path}/.aar/maven/libs-release"
repo_username = 'admin'
repo_password = 'admin123'
}
// plugin的仓库
repositories {
maven { url uri(repo_snapshot) }
maven { url uri(repo_release) }
mavenCentral()
google()
jcenter()
}
// plugin的名字和版本
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
classpath 'com.garfield:store_plugin:0.0.1'
}
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
}
}
// 适用于dependencies
allprojects {
// module依赖库所在的仓库
repositories {
maven { url uri(repo_snapshot) }
maven { url uri(repo_release) }
//mavenLocal() //从本地Maven仓库中获取依赖 本地地址: {user.home}\/.m2\/repository
//flatDir { dirs 'libs' }
mavenCentral()
google()
jcenter()
//maven { url 'https://jitpack.io' }
}
// 所有工程都可以直接使用
ext {}
}
// 同上,仅为所有module服务,不包括根p
subprojects {
project ->
project.afterEvaluate {
// 不能在配置之前调用,会导致依赖在pom中看不到
project.apply from: "${rootProject.rootDir.path}/upload.gradle"
}
repositories {}
ext {}
}
// 只为根p添加属性,module必须通过rootProject使用
ext {
minSdkVersion = 19
targetSdkVersion = 27
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
supportVersion = "27.1.1"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
task testRoot(type: DefaultTask) {
group '组Root'
doFirst {
println "testRoot doFirst"
}
doLast {
println "testRoot doLast"
}
onlyIf { //闭包返回false就跳过
true
}
}
//class CustomTask extends DefaultTask {
// @TaskAction
// def doSelf() {
// println "CustomTask 自己"
// }
//}
task('task2').doLast {
println "打印Task -> Root task2"
}
println "-----MyAndroid configure end-----"
//println gradlePropertiesProp //aa
//println System.properties['system'] //bb
//System.getenv(key)