14
14
15
15
package com.google.firebase.gradle.plugins.ci
16
16
17
+ import com.google.firebase.gradle.plugins.FirebaseLibraryExtension
17
18
import com.google.gson.Gson
18
19
import java.io.File
19
20
import org.gradle.api.DefaultTask
@@ -22,16 +23,21 @@ import org.gradle.api.tasks.Input
22
23
import org.gradle.api.tasks.OutputFile
23
24
import org.gradle.api.tasks.TaskAction
24
25
import org.gradle.api.tasks.options.Option
26
+ import org.gradle.kotlin.dsl.findByType
25
27
26
28
abstract class ChangedModulesTask : DefaultTask () {
27
29
@get:Input
28
- @set:Option(option = " changed-git-paths" , description = " Hellos " )
30
+ @set:Option(option = " changed-git-paths" , description = " The list of changed paths " )
29
31
abstract var changedGitPaths: List <String >
30
32
31
33
@get:Input
32
- @set:Option(option = " output-file-path" , description = " Hello " )
34
+ @set:Option(option = " output-file-path" , description = " The file to output json to " )
33
35
abstract var outputFilePath: String
34
36
37
+ @get:Input
38
+ @set:Option(option = " only-firebase-sdks" , description = " Only list Firebase SDKs" )
39
+ abstract var onlyFirebaseSDKs: Boolean
40
+
35
41
@get:OutputFile val outputFile by lazy { File (outputFilePath) }
36
42
37
43
init {
@@ -43,14 +49,25 @@ abstract class ChangedModulesTask : DefaultTask() {
43
49
val projects =
44
50
AffectedProjectFinder (project, changedGitPaths.toSet(), listOf ())
45
51
.find()
52
+ .filter {
53
+ val ext = it.extensions.findByType(FirebaseLibraryExtension ::class .java)
54
+ ! onlyFirebaseSDKs || it.extensions.findByType<FirebaseLibraryExtension >() != null
55
+ }
46
56
.map { it.path }
47
57
.toSet()
48
58
49
59
val result = project.rootProject.subprojects.associate { it.path to mutableSetOf<String >() }
50
60
project.rootProject.subprojects.forEach { p ->
51
61
p.configurations.forEach { c ->
52
62
c.dependencies.filterIsInstance<ProjectDependency >().forEach {
53
- result[it.dependencyProject.path]?.add(p.path)
63
+ if (
64
+ ! onlyFirebaseSDKs ||
65
+ it.dependencyProject.extensions.findByType<FirebaseLibraryExtension >() != null
66
+ ) {
67
+ if (! onlyFirebaseSDKs || p.extensions.findByType<FirebaseLibraryExtension >() != null ) {
68
+ result[it.dependencyProject.path]?.add(p.path)
69
+ }
70
+ }
54
71
}
55
72
}
56
73
}
0 commit comments