-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcollectors.gradle
49 lines (42 loc) · 1.53 KB
/
collectors.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
List<Project> collectServices() {
return collectProjects(':services', null, null)
}
List<Project> collectConnectors() {
return collectProjects(':connectors', null, null)
}
List<Project> collectRegulators() {
return collectProjects(':regulators', null, null)
}
private List<Project> collectProjects(String rootProject,
List<String> including,
List<String> excluding) {
List<Project> resultProjects = new ArrayList<>()
project(rootProject).childProjects.values().forEach { project ->
if (including == null || including.contains(project.name)) {
if (excluding == null || !excluding.contains(project.name)) {
resultProjects.add(project)
}
}
}
return resultProjects
}
String obtainAarVersion(Project targetProject) {
if (targetProject.name == project(':sdk').name
|| targetProject.name == project(':sdk-full').name) {
return "${obtainVersion(targetProject)}"
}
return obtainVersion(':sdk') + "." + obtainVersion(targetProject)
}
String obtainVersion(String projectName) {
return obtainVersion(project(projectName))
}
static String obtainVersion(Project targetProject) {
return targetProject.android.defaultConfig.versionName
}
ext {
collectServices = this.&collectServices
collectConnectors = this.&collectConnectors
collectRegulators = this.&collectRegulators
obtainAarVersion = this.&obtainAarVersion
obtainVersion = this.&obtainVersion
}