diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 066b2c4ae1a..e5fe6fe0b01 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -121,22 +121,6 @@ jobs: with: credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - uses: google-github-actions/setup-gcloud@v0 - # create composite indexes with Terraform - - name: Setup Terraform - if: contains(matrix.module, ':firebase-firestore') - uses: hashicorp/setup-terraform@v2 - - name: Terraform Init - if: contains(matrix.module, ':firebase-firestore') - run: | - cd firebase-firestore - terraform init - continue-on-error: true - - name: Terraform Apply - if: github.event_name == 'pull_request' && contains(matrix.module, ':firebase-firestore') - run: | - cd firebase-firestore - terraform apply -var-file=../google-services.json -auto-approve - continue-on-error: true - name: ${{ matrix.module }} Integ Tests env: FIREBASE_CI: 1 @@ -178,6 +162,34 @@ jobs: with: credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - uses: google-github-actions/setup-gcloud@v0 + + # create composite indexes with Terraform + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + - name: Terraform Init + run: | + cd firebase-firestore + terraform init + continue-on-error: true + - name: Terraform Apply + if: github.event_name == 'pull_request' + run: | + cd firebase-firestore + + # Define a temporary file, redirect both stdout and stderr to the file + output_file=$(mktemp) + if ! terraform apply -var-file=../google-services.json -auto-approve > "$output_file" 2>&1 ; then + cat "$output_file" + if cat "$output_file" | grep -q "index already exists"; then + echo "===================================================================================" + echo -e "\e[93m\e[1mTerraform apply failed due to index already exists; We can safely ignore this error.\e[0m" + echo "===================================================================================" + fi + exit 1 + fi + rm -f "$output_file" + continue-on-error: true + - name: Firestore Named DB Integ Tests env: FIREBASE_CI: 1 diff --git a/appcheck/firebase-appcheck-debug-testing/gradle.properties b/appcheck/firebase-appcheck-debug-testing/gradle.properties index dab68d6f646..5328ce212de 100644 --- a/appcheck/firebase-appcheck-debug-testing/gradle.properties +++ b/appcheck/firebase-appcheck-debug-testing/gradle.properties @@ -1,2 +1,2 @@ version=17.1.1 -latestReleasedVersion=17.0.1 +latestReleasedVersion=17.1.0 diff --git a/appcheck/firebase-appcheck-debug/gradle.properties b/appcheck/firebase-appcheck-debug/gradle.properties index dab68d6f646..5328ce212de 100644 --- a/appcheck/firebase-appcheck-debug/gradle.properties +++ b/appcheck/firebase-appcheck-debug/gradle.properties @@ -1,2 +1,2 @@ version=17.1.1 -latestReleasedVersion=17.0.1 +latestReleasedVersion=17.1.0 diff --git a/appcheck/firebase-appcheck-interop/gradle.properties b/appcheck/firebase-appcheck-interop/gradle.properties index dab68d6f646..5328ce212de 100644 --- a/appcheck/firebase-appcheck-interop/gradle.properties +++ b/appcheck/firebase-appcheck-interop/gradle.properties @@ -1,2 +1,2 @@ version=17.1.1 -latestReleasedVersion=17.0.1 +latestReleasedVersion=17.1.0 diff --git a/appcheck/firebase-appcheck-playintegrity/gradle.properties b/appcheck/firebase-appcheck-playintegrity/gradle.properties index dab68d6f646..5328ce212de 100644 --- a/appcheck/firebase-appcheck-playintegrity/gradle.properties +++ b/appcheck/firebase-appcheck-playintegrity/gradle.properties @@ -1,2 +1,2 @@ version=17.1.1 -latestReleasedVersion=17.0.1 +latestReleasedVersion=17.1.0 diff --git a/appcheck/firebase-appcheck/gradle.properties b/appcheck/firebase-appcheck/gradle.properties index dab68d6f646..5328ce212de 100644 --- a/appcheck/firebase-appcheck/gradle.properties +++ b/appcheck/firebase-appcheck/gradle.properties @@ -1,2 +1,2 @@ version=17.1.1 -latestReleasedVersion=17.0.1 +latestReleasedVersion=17.1.0 diff --git a/buildSrc/src/main/java/com/google/firebase/gradle/plugins/PostReleasePlugin.kt b/buildSrc/src/main/java/com/google/firebase/gradle/plugins/PostReleasePlugin.kt index 204304e70ee..439a45a18b4 100644 --- a/buildSrc/src/main/java/com/google/firebase/gradle/plugins/PostReleasePlugin.kt +++ b/buildSrc/src/main/java/com/google/firebase/gradle/plugins/PostReleasePlugin.kt @@ -52,6 +52,10 @@ class PostReleasePlugin : Plugin { * is set to the current version of said module. After a release, this `version` should be bumped * up to differentiate between code at HEAD, and the latest released version. * + * Furthermore, this file may optionally contain a `latestReleasedVersion` variable (if the SDK + * has released). If this property is present, it should be updated to the related version that + * went out during the release. + * * @see VersionBumpTask * * @param project the [Project] to register this task to @@ -72,7 +76,9 @@ class PostReleasePlugin : Plugin { * @param project the [Project] to register this task to */ fun registerMoveUnreleasedChangesTask(project: Project) = - project.tasks.register("moveUnreleasedChanges") + project.tasks.register("moveUnreleasedChanges") { + onlyIf("CHANGELOG.md file must be present") { project.file("CHANGELOG.md").exists() } + } /** * Registers the `updatePinnedDependencies` for the provided [Project] diff --git a/buildSrc/src/main/java/com/google/firebase/gradle/plugins/VersionBumpTask.kt b/buildSrc/src/main/java/com/google/firebase/gradle/plugins/VersionBumpTask.kt index f99e18baf2e..a00e07cf09e 100644 --- a/buildSrc/src/main/java/com/google/firebase/gradle/plugins/VersionBumpTask.kt +++ b/buildSrc/src/main/java/com/google/firebase/gradle/plugins/VersionBumpTask.kt @@ -24,22 +24,29 @@ import org.gradle.api.tasks.TaskAction import org.gradle.kotlin.dsl.provideDelegate /** - * Bumps the `version` property of the specified [versionFile]. + * Bumps the `version` property of the specified [versionFile], and sets the + * `latestReleasedVersion`. * * Primarily utilized as a post-release clean up task in which we bump the versions of released - * modules to be one patch higher than their currently released counterparts. + * modules to be one patch higher than their currently released counterparts, and update their + * latest released version. * * @see PostReleasePlugin * * @property versionFile A [File] that contains the `version` property. Defaults to the * `gradle.properties` file at the project's root. + * @property releasedVersion A [ModuleVersion] of what to bump from. Defaults to the project + * version. * @property newVersion A [ModuleVersion] of what to set the version to. Defaults to one patch - * higher than the existing version. + * higher than [releasedVersion] */ abstract class VersionBumpTask : DefaultTask() { @get:[Optional InputFile] abstract val versionFile: Property + @get:[Optional Input] + abstract val releasedVersion: Property + @get:[Optional Input] abstract val newVersion: Property @@ -50,18 +57,23 @@ abstract class VersionBumpTask : DefaultTask() { @TaskAction fun build() { versionFile.get().rewriteLines { - if (it.startsWith("version=")) "version=${newVersion.get()}" else it + when { + it.startsWith("version=") -> "version=${newVersion.get()}" + it.startsWith("latestReleasedVersion") -> "latestReleasedVersion=${releasedVersion.get()}" + else -> it + } } } fun configure() { versionFile.convention(project.file("gradle.properties")) - newVersion.convention(computeNewVersion()) + releasedVersion.convention(computeReleasedVersion()) + newVersion.convention(releasedVersion.map { it.bump() }) } - fun computeNewVersion(): ModuleVersion? { + fun computeReleasedVersion(): ModuleVersion? { val version: String? by project - return version?.let { ModuleVersion.fromStringOrNull(it)?.bump() } + return version?.let { ModuleVersion.fromStringOrNull(it) } } } diff --git a/firebase-config/gradle.properties b/firebase-config/gradle.properties index eea304da3e2..4ef6fc9a4f1 100644 --- a/firebase-config/gradle.properties +++ b/firebase-config/gradle.properties @@ -15,6 +15,6 @@ # version=21.5.1 -latestReleasedVersion=21.4.1 +latestReleasedVersion=21.5.0 android.enableUnitTestBinaryResources=true diff --git a/firebase-crashlytics-ndk/gradle.properties b/firebase-crashlytics-ndk/gradle.properties index 05e2b82e19b..0a855dec93c 100644 --- a/firebase-crashlytics-ndk/gradle.properties +++ b/firebase-crashlytics-ndk/gradle.properties @@ -1,2 +1,2 @@ version=18.5.1 -latestReleasedVersion=18.4.3 +latestReleasedVersion=18.5.0 diff --git a/firebase-crashlytics/gradle.properties b/firebase-crashlytics/gradle.properties index 05e2b82e19b..0a855dec93c 100644 --- a/firebase-crashlytics/gradle.properties +++ b/firebase-crashlytics/gradle.properties @@ -1,2 +1,2 @@ version=18.5.1 -latestReleasedVersion=18.4.3 +latestReleasedVersion=18.5.0 diff --git a/firebase-database/gradle.properties b/firebase-database/gradle.properties index 888d0d3ce06..592e6fbc2d4 100644 --- a/firebase-database/gradle.properties +++ b/firebase-database/gradle.properties @@ -13,5 +13,5 @@ # limitations under the License. version=20.3.1 -latestReleasedVersion=20.2.2 +latestReleasedVersion=20.3.0 android.enableUnitTestBinaryResources=true diff --git a/firebase-dynamic-links/gradle.properties b/firebase-dynamic-links/gradle.properties index b61f9703909..f8def408bc3 100644 --- a/firebase-dynamic-links/gradle.properties +++ b/firebase-dynamic-links/gradle.properties @@ -13,5 +13,5 @@ # limitations under the License. version=21.2.1 -latestReleasedVersion=21.1.0 +latestReleasedVersion=21.2.0 android.enableUnitTestBinaryResources=true diff --git a/firebase-firestore/README.md b/firebase-firestore/README.md index b05694bd4a7..65bcaa62520 100644 --- a/firebase-firestore/README.md +++ b/firebase-firestore/README.md @@ -87,6 +87,28 @@ Run: ./gradlew :firebase-firestore:deviceCheck ``` +### Testing composite index query against production +#### Setting Up the Environment: +1. Create a `google-services.json` file in the root directory. This file should contain your target Firebase project's configuration. +2. If not already logged in, authenticate with your Google Cloud Platform (GCP) account using +`gcloud auth application-default login`. You can check your logged-in accounts by running +`gcloud auth list`. +3. Navigate to the `firebase-firestore` directory, create composite indexes by running: +``` +terraform init +terraform apply -var-file=../google-services.json -auto-approve +``` +Note: If the index creation encounters issues, such as concurrent operations, consider running the +index creation process again. Error messages indicating that indexes have already been created can +be safely disregarded. + +#### Adding new composite index query tests +1. To create a new composite index for local development, click on the provided link in the test +error message, which will direct you to the Firebase Console. +2. Add the newly created composite index to the `firestore_index_config.tf` file. The "__name__" +field is not required to be explicitly added to the file, as the index creation will auto complete +it on behalf. + ## Code Formatting Run below to format Java code: diff --git a/firebase-firestore/gradle.properties b/firebase-firestore/gradle.properties index 5bf5f729768..8ed9779de5f 100644 --- a/firebase-firestore/gradle.properties +++ b/firebase-firestore/gradle.properties @@ -1,2 +1,2 @@ version=24.9.1 -latestReleasedVersion=24.8.1 +latestReleasedVersion=24.9.0 diff --git a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/CompositeIndexQueryTest.java b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/CompositeIndexQueryTest.java index 368503aaebe..65e02c30f95 100644 --- a/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/CompositeIndexQueryTest.java +++ b/firebase-firestore/src/androidTest/java/com/google/firebase/firestore/CompositeIndexQueryTest.java @@ -30,14 +30,13 @@ * Guidance for Creating Tests: * ---------------------------- * When creating tests that require composite indexes, it is recommended to utilize the - * "CompositeIndexTestHelper" class. This utility class provides methods for creating - * and setting test documents and running queries with ease, ensuring proper data - * isolation and query construction. + * "CompositeIndexTestHelper" class. This utility class provides methods for creating and setting + * test documents and running queries with ease, ensuring proper data isolation and query + * construction. * - * Please remember to update the main index configuration file (firestore_index_config.tf) - * with any new composite indexes needed for the tests. This ensures synchronization with - * other testing environments, including CI. You can generate the required index link by - * clicking on the Firebase console link in the error message while running tests locally. + * To get started, please refer to the instructions provided in the README file. This will guide + * you through setting up your local testing environment and updating the Terraform configuration + * with any new composite indexes required for your testing scenarios. */ @RunWith(AndroidJUnit4.class) public class CompositeIndexQueryTest { diff --git a/firebase-functions/gradle.properties b/firebase-functions/gradle.properties index ccb218afc64..b062bbd224c 100644 --- a/firebase-functions/gradle.properties +++ b/firebase-functions/gradle.properties @@ -1,3 +1,3 @@ version=20.4.1 -latestReleasedVersion=20.3.1 +latestReleasedVersion=20.4.0 android.enableUnitTestBinaryResources=true diff --git a/firebase-inappmessaging-display/gradle.properties b/firebase-inappmessaging-display/gradle.properties index 2abed29384c..2a43f72bc44 100644 --- a/firebase-inappmessaging-display/gradle.properties +++ b/firebase-inappmessaging-display/gradle.properties @@ -1,2 +1,2 @@ version=20.4.1 -latestReleasedVersion=20.3.5 +latestReleasedVersion=20.4.0 diff --git a/firebase-inappmessaging/gradle.properties b/firebase-inappmessaging/gradle.properties index 2abed29384c..2a43f72bc44 100644 --- a/firebase-inappmessaging/gradle.properties +++ b/firebase-inappmessaging/gradle.properties @@ -1,2 +1,2 @@ version=20.4.1 -latestReleasedVersion=20.3.5 +latestReleasedVersion=20.4.0 diff --git a/firebase-installations-interop/CHANGELOG.md b/firebase-installations-interop/CHANGELOG.md index f514bbb890e..7e1c5ca7f52 100644 --- a/firebase-installations-interop/CHANGELOG.md +++ b/firebase-installations-interop/CHANGELOG.md @@ -1,3 +1,4 @@ # Unreleased +* [changed] Release to align with ktx changes diff --git a/firebase-installations-interop/gradle.properties b/firebase-installations-interop/gradle.properties index 80e6063b59e..ed2afba5676 100644 --- a/firebase-installations-interop/gradle.properties +++ b/firebase-installations-interop/gradle.properties @@ -1,2 +1,2 @@ -version=17.1.2 -latestReleasedVersion=17.1.0 +version=17.2.0 +latestReleasedVersion=17.1.1 diff --git a/firebase-installations/gradle.properties b/firebase-installations/gradle.properties index 8834def8954..42ba9a992ef 100644 --- a/firebase-installations/gradle.properties +++ b/firebase-installations/gradle.properties @@ -1,2 +1,2 @@ version=17.2.1 -latestReleasedVersion=17.1.4 +latestReleasedVersion=17.2.0 diff --git a/firebase-messaging-directboot/gradle.properties b/firebase-messaging-directboot/gradle.properties index 52e8846b8d3..132e2e93480 100644 --- a/firebase-messaging-directboot/gradle.properties +++ b/firebase-messaging-directboot/gradle.properties @@ -1,3 +1,3 @@ version=23.3.1 -latestReleasedVersion=23.2.1 +latestReleasedVersion=23.3.0 android.enableUnitTestBinaryResources=true diff --git a/firebase-messaging/gradle.properties b/firebase-messaging/gradle.properties index 52e8846b8d3..132e2e93480 100644 --- a/firebase-messaging/gradle.properties +++ b/firebase-messaging/gradle.properties @@ -1,3 +1,3 @@ version=23.3.1 -latestReleasedVersion=23.2.1 +latestReleasedVersion=23.3.0 android.enableUnitTestBinaryResources=true diff --git a/firebase-ml-modeldownloader/gradle.properties b/firebase-ml-modeldownloader/gradle.properties index 6d7cd23c4f8..275fa9c6af8 100644 --- a/firebase-ml-modeldownloader/gradle.properties +++ b/firebase-ml-modeldownloader/gradle.properties @@ -1,2 +1,2 @@ version=24.2.1 -latestReleasedVersion=24.1.3 +latestReleasedVersion=24.2.0 diff --git a/firebase-perf/gradle.properties b/firebase-perf/gradle.properties index 3ad6bad0a52..5afaadb7ad8 100644 --- a/firebase-perf/gradle.properties +++ b/firebase-perf/gradle.properties @@ -16,6 +16,6 @@ # version=20.5.1 -latestReleasedVersion=20.4.1 +latestReleasedVersion=20.5.0 android.enableUnitTestBinaryResources=true diff --git a/firebase-sessions/gradle.properties b/firebase-sessions/gradle.properties index d554a79ced8..1031a2a59e1 100644 --- a/firebase-sessions/gradle.properties +++ b/firebase-sessions/gradle.properties @@ -13,4 +13,4 @@ # limitations under the License. version=1.1.1 -latestReleasedVersion=1.0.2 +latestReleasedVersion=1.1.0 diff --git a/firebase-storage/gradle.properties b/firebase-storage/gradle.properties index 85d57a06840..592e6fbc2d4 100644 --- a/firebase-storage/gradle.properties +++ b/firebase-storage/gradle.properties @@ -13,5 +13,5 @@ # limitations under the License. version=20.3.1 -latestReleasedVersion=20.2.1 +latestReleasedVersion=20.3.0 android.enableUnitTestBinaryResources=true