-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
108 lines (91 loc) · 3.5 KB
/
build.gradle
File metadata and controls
108 lines (91 loc) · 3.5 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.buildConfig = [
compileSdk : 28, // SDK 编译版本
minSdk : 19, // 最小 SDK 版本
instantMinSdk: 21, // Instant Run 的最小 SDK 版本
targetSdk : 28, // 目标 SDK 版本
version : [
major: 1, // 主版本号
minor: 0, // 子版本号
patch: 0, // 修正版本号
],
]
// 版本名采用 GNU 风格,主版本号.子版本号.修正版本号,例如 1.2.10
ext.buildConfig.version['name'] = "${buildConfig.version.major}.${buildConfig.version.minor}.${buildConfig.version.patch}"
// 版本号由版本名映射,主版本号 * 10000 + 子版本号 * 100 + 修正版本号,例如 1.2.10 -> 10210
ext.buildConfig.version['code'] = buildConfig.version.major * 10000 + buildConfig.version.minor * 100 + buildConfig.version.patch
ext.versions = [
plugin : [
android : '3.4.1',
ktlint : '7.2.1',
],
androidx : [
test: [
coreKtx : '1.1.0',
runner : '1.1.1',
rules : '1.1.1',
junit : '1.1.0',
truth : '1.1.0',
orchestrator: "1.1.0",
],
],
kotlin : [
stdlib: '1.3.31',
]
]
ext.mavenUrl = [
aliyun : 'http://maven.aliyun.com/nexus/content/groups/public/',
plugins : 'https://plugins.gradle.org/m2/'
]
ext.deps = [
plugin : [
android : "com.android.tools.build:gradle:${versions.plugin.android}",
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin.stdlib}",
ktlint : "org.jlleitschuh.gradle:ktlint-gradle:${versions.plugin.ktlint}",
],
kotlin : [
stdlib: "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin.stdlib}",
junit : "org.jetbrains.kotlin:kotlin-test-junit:${versions.kotlin.stdlib}",
]
]
repositories {
maven{ url mavenUrl.aliyun}
maven { url mavenUrl.plugins}
google()
gradlePluginPortal()
}
dependencies {
classpath deps.plugin.android
classpath deps.plugin.kotlin
classpath deps.plugin.ktlint
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
apply plugin: 'org.jlleitschuh.gradle.ktlint'
ktlint {
android = true
}
repositories {
maven{ url mavenUrl.aliyun}
maven { url mavenUrl.plugins}
google()
jcenter()
}
configurations.all {
resolutionStrategy {
eachDependency { details ->
// Force all Kotlin stdlib artifacts to use the same version.
if (details.requested.group == 'org.jetbrains.kotlin'
&& details.requested.name.startsWith('kotlin-stdlib')) {
details.useVersion versions.kotlin.stdlib
}
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}