Skip to content

Commit 7930f39

Browse files
committed
Resolve comments
1 parent 08cb7ef commit 7930f39

File tree

5 files changed

+19
-25
lines changed

5 files changed

+19
-25
lines changed

.github/workflows/metalava-semver-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
distribution: temurin
2424
cache: gradle
2525

26-
- name: Copy new api.txt files
26+
- name: Copy existing api.txt files
2727
run: ./gradlew copyApiTxtFile
2828

2929
- name: Checkout PR

plugins/src/main/java/com/google/firebase/gradle/plugins/BaseFirebaseLibraryPlugin.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@ abstract class BaseFirebaseLibraryPlugin : Plugin<Project> {
127127
Coverage.apply(library)
128128
}
129129

130+
protected fun setupMetalavaSemver(project: Project, library: FirebaseLibraryExtension) {
131+
project.tasks.register<CopyApiTask>("copyApiTxtFile") {
132+
apiTxtFile.set(project.file("api.txt"))
133+
output.set(project.file("existing_api.txt"))
134+
}
135+
136+
project.tasks.register<SemVerTask>("metalavaSemver") {
137+
apiTxtFile.set(project.file("api.txt"))
138+
existingApiFile.set(project.file("existing_api.txt"))
139+
currentVersionString.value(library.version)
140+
previousVersionString.value(library.previousVersion)
141+
}
142+
}
143+
130144
protected fun getApiInfo(
131145
project: Project,
132146
srcDirs: ConfigurableFileCollection,

plugins/src/main/java/com/google/firebase/gradle/plugins/FirebaseAndroidLibraryPlugin.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,7 @@ class FirebaseAndroidLibraryPlugin : BaseFirebaseLibraryPlugin() {
161161
)
162162
}
163163

164-
project.tasks.register<CopyApiTask>("copyApiTxtFile") {
165-
apiTxtFile.set(project.file("api.txt"))
166-
output.set(project.file("old_api.txt"))
167-
}
168-
169-
project.tasks.register<SemVerTask>("metalavaSemver") {
170-
apiTxtFile.set(project.file("api.txt"))
171-
otherApiFile.set(project.file("old_api.txt"))
172-
currentVersionString.value(firebaseLibrary.version)
173-
previousVersionString.value(firebaseLibrary.previousVersion)
174-
}
164+
setupMetalavaSemver(project, firebaseLibrary)
175165
}
176166

177167
private fun setupApiInformationAnalysis(project: Project, android: LibraryExtension) {

plugins/src/main/java/com/google/firebase/gradle/plugins/FirebaseJavaLibraryPlugin.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,7 @@ class FirebaseJavaLibraryPlugin : BaseFirebaseLibraryPlugin() {
104104
dependsOn("copyPreviousArtifacts")
105105
}
106106

107-
project.tasks.register<CopyApiTask>("copyApiTxtFile") {
108-
apiTxtFile.set(project.file("api.txt"))
109-
output.set(project.file("old_api.txt"))
110-
}
111-
112-
project.tasks.register<SemVerTask>("metalavaSemver") {
113-
apiTxtFile.set(project.file("api.txt"))
114-
otherApiFile.set(project.file("old_api.txt"))
115-
currentVersionString.value(firebaseLibrary.version)
116-
previousVersionString.value(firebaseLibrary.previousVersion)
117-
}
107+
setupMetalavaSemver(project, firebaseLibrary)
118108
}
119109

120110
private fun setupApiInformationAnalysis(project: Project) {

plugins/src/main/java/com/google/firebase/gradle/plugins/SemVerTask.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import org.gradle.api.tasks.TaskAction
2828

2929
abstract class SemVerTask : DefaultTask() {
3030
@get:InputFile abstract val apiTxtFile: RegularFileProperty
31-
@get:InputFile abstract val otherApiFile: RegularFileProperty
31+
@get:InputFile abstract val existingApiFile: RegularFileProperty
3232
@get:Input abstract val currentVersionString: Property<String>
3333
@get:Input abstract val previousVersionString: Property<String>
3434

@@ -51,7 +51,7 @@ abstract class SemVerTask : DefaultTask() {
5151
"--source-files",
5252
apiTxtFile.get().asFile.absolutePath,
5353
"--check-compatibility:api:released",
54-
otherApiFile.get().asFile.absolutePath,
54+
existingApiFile.get().asFile.absolutePath,
5555
) +
5656
MAJOR.flatMap { m -> listOf("--error", m) } +
5757
MINOR.flatMap { m -> listOf("--error", m) } +

0 commit comments

Comments
 (0)