Skip to content

Update semver tests and the pom validator tests to handle new sdk #5133

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

Merged
merged 3 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
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 @@ -109,11 +109,13 @@ class FirebaseLibraryPlugin : BaseFirebaseLibraryPlugin() {
from(project.zipTree("build/outputs/aar/${releaseAar}"))
into(project.file("semver/current-version"))
}

project.tasks.register<Copy>("extractPreviousClasses") {
dependsOn("copyPreviousArtifacts")

from(project.zipTree("semver/previous.aar"))
into(project.file("semver/previous-version"))
if (project.file("semver/previous.aar").exists()) {
Copy link
Member

Choose a reason for hiding this comment

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

Keep in mind that if this file is added by any task- this will fail. This check will occur at configuration time, not execution time.

from(project.zipTree("semver/previous.aar"))
into(project.file("semver/previous-version"))
}
}

val currentJarFile = project.file("semver/current-version/classes.jar").absolutePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ abstract class PomValidator : DefaultTask() {

@TaskAction
fun run() {
var diff = diffWithPomFromURL(getLatestReleasePomUrl())
try {
var diff = diffWithPomFromURL(getLatestReleasePomUrl())
Copy link
Member

Choose a reason for hiding this comment

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

I realize I accidentally left this as var- this should probably be changed to val


if (diff.isNotEmpty()) {
throw GradleException("Dependency version errors found:\n${diff}")
if (diff.isNotEmpty()) {
throw GradleException("Dependency version errors found:\n${diff}")
}
} catch (_: java.io.FileNotFoundException) {
// Gmaven artifact doesn't exist.
return
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ abstract class ApiDiffer : DefaultTask() {

@TaskAction
fun run() {
if (version.get().contains("beta") || previousVersionString.get().isNullOrEmpty()) {
return
}
val (pMajor, pMinor, _) = previousVersionString.get().split(".")
val (major, minor, _) = version.get().split(".")
val curVersionDelta: VersionDelta =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ abstract class GmavenCopier : DefaultTask() {
mavenHelper.getLatestReleasedVersion(),
!aarAndroidFile.get()
)
URL(gMavenPath).openStream().use { Files.copy(it, Paths.get(filePath.get())) }
try {
URL(gMavenPath).openStream().use { Files.copy(it, Paths.get(filePath.get())) }
} catch (_: java.io.FileNotFoundException) {
// Gmaven Artifact doesn't exist.
Copy link
Member

Choose a reason for hiding this comment

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

You should be fine to replace these empty returns with StopActionException for more information.

throw StopActionException("GMaven artifact doesn't exist")

return
}
}
}
2 changes: 1 addition & 1 deletion firebase-config/ktx/ktx.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
implementation project(':firebase-config')
implementation 'com.google.firebase:firebase-abt:21.1.1'
implementation 'com.google.firebase:firebase-installations-interop:17.1.0'
runtimeOnly project(':firebase-installations')
runtimeOnly 'com.google.firebase:firebase-installations:17.1.2'

implementation 'androidx.annotation:annotation:1.1.0'

Expand Down