-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
93 lines (76 loc) · 2.28 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
apply plugin: 'com.github.ben-manes.versions'
//import org.ajoberstar.grgit.Grgit
buildscript {
apply from: "dependencies/versions.gradle"
addRepos(repositories)
dependencies {
classpath deps.android_gradle_plugin
// classpath deps.grgit
//检查版本更新 ./gradlew dependencyUpdates -Drevision=release
classpath deps.lib_versions
classpath deps.kotlin.plugin
classpath deps.android_gradle_plugin
classpath deps.kotlin.serializationPlugin
}
}
allprojects {
// def git = Grgit.open(currentDir: projectDir)
addGitVersion(gitVersionTag(), gitVersionCode())
addRepos(repositories)
}
subprojects {
def isModule = false
def isAppModule = isModule || it.name == "app"
def dataBindingModules = ["app"]
//使用dataBinding的模块
def enableDataBinding = dataBindingModules.contains(it.name)
apply plugin: isAppModule ? 'com.android.application' : 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' // 拓展
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion build_versions.compile_sdk
defaultConfig {
if (isAppModule) applicationId "com.mrtan.app" //这里改成项目id
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode build_versions.androidVersionCode
versionName build_versions.androidVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
resConfigs "zh","en"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
if (enableDataBinding) {
dataBinding {
enabled true
}
}
}
dependencies {
implementation deps.kotlin.stdlib.common
}
}
def gitVersionCode() {
def out = new ByteArrayOutputStream()
exec {
commandLine 'git', 'tag'
standardOutput = out
}
return out.toString().split('\n').length
}
def gitVersionTag() {
def out = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = out
}
return out.toString().trim()
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// todo 资源文件混淆 https://github.com/shwenzhang/AndResGuard/blob/master/README.zh-cn.md