File tree Expand file tree Collapse file tree 5 files changed +19
-25
lines changed
plugins/src/main/java/com/google/firebase/gradle/plugins Expand file tree Collapse file tree 5 files changed +19
-25
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import org.gradle.api.tasks.TaskAction
2828
2929abstract 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) } +
You can’t perform that action at this time.
0 commit comments