Skip to content

Commit 3b7e1e4

Browse files
emilypgooglerlazo
andauthored
Adjust Metalava SemVer task (#6846)
Reverses the order in which branches and comparisons are done. This will mean the actual test behavior lags behind by one commit, so to test this I will open a PR to this branch not to be merged with example changes. See test success here #6849 --------- Co-authored-by: Rodrigo Lazo <[email protected]>
1 parent a362e45 commit 3b7e1e4

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ jobs:
99
permissions:
1010
pull-requests: write
1111
steps:
12-
- name: Checkout main
12+
- name: Checkout PR
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14-
with:
15-
ref: ${{ github.base_ref }}
1614

1715
- name: Set up JDK 17
1816
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
@@ -21,13 +19,13 @@ jobs:
2119
distribution: temurin
2220
cache: gradle
2321

24-
- name: Copy previous api.txt files
22+
- name: Copy new api.txt files
2523
run: ./gradlew copyApiTxtFile
2624

27-
- name: Checkout PR
25+
- name: Checkout main
2826
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2927
with:
30-
ref: ${{ github.head_ref }}
28+
ref: ${{ github.base_ref }}
3129
clean: false
3230

3331
- name: Run Metalava SemVer check

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,12 @@ class FirebaseAndroidLibraryPlugin : BaseFirebaseLibraryPlugin() {
163163

164164
project.tasks.register<CopyApiTask>("copyApiTxtFile") {
165165
apiTxtFile.set(project.file("api.txt"))
166-
output.set(project.file("previous_api.txt"))
166+
output.set(project.file("new_api.txt"))
167167
}
168168

169169
project.tasks.register<SemVerTask>("metalavaSemver") {
170-
apiTxtFile.set(project.file("api.txt"))
171-
otherApiFile.set(project.file("previous_api.txt"))
172-
outputApiFile.set(project.file("opi.txt"))
170+
apiTxtFile.set(project.file("new_api.txt"))
171+
otherApiFile.set(project.file("api.txt"))
173172
currentVersionString.value(firebaseLibrary.version)
174173
previousVersionString.value(firebaseLibrary.previousVersion)
175174
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ class FirebaseJavaLibraryPlugin : BaseFirebaseLibraryPlugin() {
106106

107107
project.tasks.register<CopyApiTask>("copyApiTxtFile") {
108108
apiTxtFile.set(project.file("api.txt"))
109-
output.set(project.file("previous_api.txt"))
109+
output.set(project.file("new_api.txt"))
110110
}
111111

112112
project.tasks.register<SemVerTask>("metalavaSemver") {
113-
apiTxtFile.set(project.file("api.txt"))
114-
otherApiFile.set(project.file("previous_api.txt"))
115-
outputApiFile.set(project.file("opi.txt"))
113+
apiTxtFile.set(project.file("new_api.txt"))
114+
otherApiFile.set(project.file("api.txt"))
116115
currentVersionString.value(firebaseLibrary.version)
117116
previousVersionString.value(firebaseLibrary.previousVersion)
118117
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import org.gradle.api.file.RegularFileProperty
2424
import org.gradle.api.provider.Property
2525
import org.gradle.api.tasks.Input
2626
import org.gradle.api.tasks.InputFile
27-
import org.gradle.api.tasks.OutputFile
2827
import org.gradle.api.tasks.TaskAction
2928

3029
abstract class SemVerTask : DefaultTask() {
@@ -33,7 +32,7 @@ abstract class SemVerTask : DefaultTask() {
3332
@get:Input abstract val currentVersionString: Property<String>
3433
@get:Input abstract val previousVersionString: Property<String>
3534

36-
@get:OutputFile abstract val outputApiFile: RegularFileProperty
35+
// TODO cache output
3736

3837
@TaskAction
3938
fun run() {

0 commit comments

Comments
 (0)