-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
65 lines (55 loc) · 1.82 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
//项目根目录下的build.gradle,对应脚本执行时的rootProject对象
buildscript{
//buildscript下的repositories是gradle脚本自身需要的资源,
repositories{
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
// classpath('com.yl:login:3.0.0')
classpath "com.android.tools.build:gradle:7.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22"
}
}
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}
task clean(type: Delete) {
println 'task clean'
delete rootProject.buildDir
}
task outputUrl() {
println 'task outputUrl'
}
//allprojects下的repositories是项目所有模块需要的资源。
allprojects {
//文件使用或覆盖了已过时的 API警告
// gradle.projectsEvaluated {
// tasks.withType(JavaCompile) {
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
// }
// }
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
repositories.each {
println "123"
println it.getUrl() // 输出url
}
//如果工程中的大多数module都是支持到Java8,那么可以在根目录中的build.gradle中配置最低
//对于某个支持到Java9的module,当然可以在它里面的build.gradle配置Java9的支持:
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
//全局变量,使用rootProject.ext调用
ext {
minSdkVersion = 21
targetSdkVersion = 31
}
//kotlin版本的全局变量。
ext.appcompat = '1.3.0'