-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild.gradle
107 lines (96 loc) · 2.98 KB
/
build.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.61'
//配置3种环境
ext.isDev = 0
ext.isBeta = 1
ext.isRelease = 2
//当前打包环境
ext.curEnv = isRelease
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
//根据是否为远程依赖设置依赖远程库还是本地库
ext.projectCompat = { name ->
def realName = name.replace(":", "")
if (isMaven(realName)) {
return "com.libo:${realName}:${mavenVersion(realName)}"
} else {
return project(name)
}
}
//判断当前组件是否为远程依赖
ext.isMaven = { name ->
Properties properties = new Properties()
def file = rootProject.file("${name}/maven.properties")
if (file.exists()) {
InputStream inputStream = file.newDataInputStream()
properties.load(inputStream)
def str = properties.getProperty('MAVEN')
if (str == null) {
return false
} else {
return Boolean.parseBoolean(str)
}
}
return false
}
//读取maven.property文件中库版本
ext.mavenVersion = { name ->
println("mavenVersion::${name}")
Properties properties = new Properties()
def file = rootProject.file("${name}/maven.properties")
if (file.exists()) {
InputStream inputStream = file.newDataInputStream()
properties.load(inputStream)
def str = properties.getProperty('VERSION')
if (str == null) {
throw Exception(file.path + " VERSION == null")
} else {
return str
}
}
return ""
}
}
//设置全局SDK版本
ext.commonConfit = [
minSdkVersion : 21,
targetSdkVersion : 26,
compileSdkVersion: 29,
versionName : "1.0.0",
versionCode : 1,
]
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
credentials {
username '605c8c634639bfa6ebf357c5'
password '0j)7TdpkQy6B'
}
url 'https://packages.aliyun.com/maven/repository/2088958-release-NjyZEe/'
}
maven {
credentials {
username '605c8c634639bfa6ebf357c5'
password '0j)7TdpkQy6B'
}
url 'https://packages.aliyun.com/maven/repository/2088958-snapshot-Svd6Nt/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}