Skip to content

Commit 45af5f9

Browse files
VinayGuthalrlazo
andauthored
Update buildSrc/src/main/java/com/google/firebase/gradle/plugins/semver/ApiDiffer.kt
Co-authored-by: Rodrigo Lazo <[email protected]>
1 parent 3c32637 commit 45af5f9

File tree

1 file changed

+6
-6
lines changed
  • buildSrc/src/main/java/com/google/firebase/gradle/plugins/semver

1 file changed

+6
-6
lines changed

buildSrc/src/main/java/com/google/firebase/gradle/plugins/semver/ApiDiffer.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ abstract class ApiDiffer : DefaultTask() {
5757
val beforeJar = readApi(previousJar.get())
5858
val apiDeltas = mutableListOf<Delta>()
5959
val classKeys = afterJar.keys union beforeJar.keys
60-
classKeys.forEach {
61-
val afterClass = afterJar.get(it)
62-
val beforeClass = beforeJar.get(it)
63-
val allDeltas = DeltaType.values()
64-
allDeltas.forEach { apiDeltas.addAll(it.getViolations(beforeClass, afterClass)) }
65-
}
60+
val apiDeltas =
61+
classKeys
62+
.map { className -> Pair(beforeJar.get(className), afterJar.get(className)) }
63+
.flatMap { (before, after) ->
64+
DeltaType.values().flatMap { it.getViolations(before, after) }
65+
}
6666
var deltaViolations: List<Delta> = mutableListOf()
6767
if (curVersionDelta == VersionDelta.MINOR) {
6868
deltaViolations = apiDeltas.filter { it.versionDelta == VersionDelta.MAJOR }

0 commit comments

Comments
 (0)