Skip to content

Fix: Make metalavaSemver depend on copyApiTxtFile #7088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ class FirebaseAndroidLibraryPlugin : BaseFirebaseLibraryPlugin() {
)
}

project.tasks.register<CopyApiTask>("copyApiTxtFile") {
apiTxtFile.set(project.file("api.txt"))
output.set(project.file("new_api.txt"))
}
val copyApiTxtFileTask =
project.tasks.register<CopyApiTask>("copyApiTxtFile") {
apiTxtFile.set(project.file("api.txt"))
output.set(project.file("new_api.txt"))
}

project.tasks.register<SemVerTask>("metalavaSemver") {
apiTxtFile.set(project.file("new_api.txt"))
apiTxtFile.set(copyApiTxtFileTask.flatMap { it.output })
Comment on lines 170 to +171

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The metalavaSemver task is currently configured to compare api.txt with a copy of itself (new_api.txt). This makes the check ineffective as it will always pass without detecting API changes. To properly check for semantic versioning changes, the task should compare the API generated from the current source code against the checked-in api.txt file (representing the last released API).

otherApiFile.set(project.file("api.txt"))
currentVersionString.value(firebaseLibrary.version)
previousVersionString.value(firebaseLibrary.previousVersion)
Expand Down
Loading