generated from hiyasame/AmeProjectTemplate-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.gradle.kts
62 lines (58 loc) · 1.74 KB
/
settings.gradle.kts
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
@file:Suppress("UnstableApiUsage")
pluginManagement {
includeBuild("build_logic")
repositories {
maven { url = uri("https://maven.aliyun.com/repository/public") }
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://jitpack.io") }
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url = uri("$rootDir/build/maven") }
maven { url = uri("https://maven.aliyun.com/repository/public") }
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://jitpack.io") }
google()
mavenCentral()
}
}
rootProject.name = "StickerSet"
// 测试使用,排除掉不需要的模块
val excludeList = listOf<String>(
)
//对文件夹进行遍历,深度为2
rootDir.walk()
.maxDepth(2)
.asSequence()
.filter {
//过滤掉干扰文件夹
val isDirectory = it.isDirectory
val isSubModule = file("$it/build.gradle").exists() || file("$it/build.gradle.kts").exists()
val isIndependentProject = file("$it/settings.gradle").exists() || file("$it/settings.gradle.kts").exists()
isDirectory && isSubModule && !isIndependentProject
}
.filter {
//对module进行过滤
"(api_.+)|(module_.+)|(lib_.+)".toRegex().matches(it.name) && it.name !in excludeList
}
.map {
//将file映射到相对路径
val parentFile = it.parentFile
if (parentFile.path == rootDir.path) {
":${it.name}"
} else {
":${parentFile.name}:${it.name}"
}
}
.forEach {
//进行include
include(it)
}
/**
* 每次新建模块会自动添加 include(),请删除掉,因为上面会自动读取
*/