From 0420eabb3ab247e0e3998bedcb9779fe35c46920 Mon Sep 17 00:00:00 2001 From: Russell Wheatley Date: Tue, 12 Nov 2024 13:23:04 +0000 Subject: [PATCH] feat(firestore): Swift Package Manager support (#13329) --- .github/workflows/all_plugins.yaml | 2 +- .../workflows/scripts/swift-integration.dart | 105 ++++++++++++ .../workflows/scripts/swift-integration.sh | 63 ------- melos.yaml | 1 + .../ios/Runner.xcodeproj/project.pbxproj | 20 +++ .../xcshareddata/xcschemes/Runner.xcscheme | 18 ++ .../ios/cloud_firestore.podspec | 9 +- .../ios/cloud_firestore/Package.swift | 116 +++++++++++++ .../FLTDocumentSnapshotStreamHandler.m | 12 +- .../FLTFirebaseFirestoreExtension.m | 2 +- .../FLTFirebaseFirestorePlugin.m | 26 +-- .../FLTFirebaseFirestoreReader.m | 11 +- .../FLTFirebaseFirestoreUtils.m | 8 +- .../FLTFirebaseFirestoreWriter.m | 8 +- .../FLTLoadBundleStreamHandler.m | 8 +- .../FLTQuerySnapshotStreamHandler.m | 14 +- .../FLTSnapshotsInSyncStreamHandler.m | 5 +- .../FLTTransactionStreamHandler.m | 10 +- .../cloud_firestore}/FirestoreMessages.g.m | 0 .../cloud_firestore}/FirestorePigeonParser.m | 0 .../cloud_firestore/Resources}/.gitkeep | 0 .../FLTDocumentSnapshotStreamHandler.h | 6 + .../Private/FLTFirebaseFirestoreExtension.h | 0 .../Private/FLTFirebaseFirestoreReader.h | 0 .../Private/FLTFirebaseFirestoreUtils.h | 4 + .../Private/FLTFirebaseFirestoreWriter.h | 0 .../Private/FLTLoadBundleStreamHandler.h | 4 + .../Private/FLTQuerySnapshotStreamHandler.h | 0 .../Private/FLTSnapshotsInSyncStreamHandler.h | 0 .../Private/FLTTransactionStreamHandler.h | 11 +- .../Private/FirestorePigeonParser.h | 11 +- .../Public/CustomPigeonHeaderFirestore.h | 0 .../Public/FLTFirebaseFirestorePlugin.h | 4 + .../Public/FirestoreMessages.g.h | 0 .../ios/generated_firebase_sdk_version.txt | 1 + .../FLTDocumentSnapshotStreamHandler.m | 1 - .../Classes/FLTFirebaseFirestoreExtension.m | 1 - .../Classes/FLTFirebaseFirestorePlugin.m | 1 - .../Classes/FLTFirebaseFirestoreReader.m | 1 - .../macos/Classes/FLTFirebaseFirestoreUtils.m | 1 - .../Classes/FLTFirebaseFirestoreWriter.m | 1 - .../Classes/FLTLoadBundleStreamHandler.m | 1 - .../Classes/FLTQuerySnapshotStreamHandler.m | 1 - .../Classes/FLTSnapshotsInSyncStreamHandler.m | 1 - .../Classes/FLTTransactionStreamHandler.m | 1 - .../macos/Classes/FirestoreMessages.g.m | 1 - .../macos/Classes/FirestorePigeonParser.m | 1 - .../FLTDocumentSnapshotStreamHandler.h | 1 - .../Private/FLTFirebaseFirestoreExtension.h | 1 - .../Private/FLTFirebaseFirestoreReader.h | 1 - .../Private/FLTFirebaseFirestoreUtils.h | 1 - .../Private/FLTFirebaseFirestoreWriter.h | 1 - .../Private/FLTLoadBundleStreamHandler.h | 1 - .../Private/FLTQuerySnapshotStreamHandler.h | 1 - .../Private/FLTSnapshotsInSyncStreamHandler.h | 1 - .../Private/FLTTransactionStreamHandler.h | 1 - .../Classes/Private/FirestorePigeonParser.h | 1 - .../Public/CustomPigeonHeaderFirestore.h | 1 - .../Public/FLTFirebaseFirestorePlugin.h | 1 - .../Classes/Public/FirestoreMessages.g.h | 1 - .../macos/cloud_firestore.podspec | 8 +- .../macos/cloud_firestore/Package.swift | 154 ++++++++++++++++++ .../FLTDocumentSnapshotStreamHandler.m | 1 + .../FLTFirebaseFirestoreExtension.m | 1 + .../FLTFirebaseFirestorePlugin.m | 1 + .../FLTFirebaseFirestoreReader.m | 1 + .../FLTFirebaseFirestoreUtils.m | 1 + .../FLTFirebaseFirestoreWriter.m | 1 + .../FLTLoadBundleStreamHandler.m | 1 + .../FLTQuerySnapshotStreamHandler.m | 1 + .../FLTSnapshotsInSyncStreamHandler.m | 1 + .../FLTTransactionStreamHandler.m | 1 + .../cloud_firestore/FirestoreMessages.g.m | 1 + .../cloud_firestore/FirestorePigeonParser.m | 1 + .../cloud_firestore/Resources}/.gitkeep | 0 .../FLTDocumentSnapshotStreamHandler.h | 1 + .../Private/FLTFirebaseFirestoreExtension.h | 1 + .../Private/FLTFirebaseFirestoreReader.h | 1 + .../Private/FLTFirebaseFirestoreUtils.h | 1 + .../Private/FLTFirebaseFirestoreWriter.h | 1 + .../Private/FLTLoadBundleStreamHandler.h | 1 + .../Private/FLTQuerySnapshotStreamHandler.h | 1 + .../Private/FLTSnapshotsInSyncStreamHandler.h | 1 + .../Private/FLTTransactionStreamHandler.h | 1 + .../Private/FirestorePigeonParser.h | 1 + .../Public/CustomPigeonHeaderFirestore.h | 1 + .../Public/FLTFirebaseFirestorePlugin.h | 1 + .../Public/FirestoreMessages.g.h | 1 + .../pigeons/messages.dart | 5 +- .../ios/Runner.xcodeproj/project.pbxproj | 56 +++---- .../ios/firebase_core/Package.swift | 22 ++- .../macos/firebase_core/Package.swift | 22 ++- scripts/generate_ios_sdk_version_txt_spm.dart | 71 ++++++++ 93 files changed, 689 insertions(+), 178 deletions(-) create mode 100644 .github/workflows/scripts/swift-integration.dart delete mode 100755 .github/workflows/scripts/swift-integration.sh create mode 100644 packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Package.swift rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTDocumentSnapshotStreamHandler.m (87%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTFirebaseFirestoreExtension.m (90%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTFirebaseFirestorePlugin.m (97%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTFirebaseFirestoreReader.m (97%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTFirebaseFirestoreUtils.m (97%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTFirebaseFirestoreWriter.m (97%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTLoadBundleStreamHandler.m (90%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTQuerySnapshotStreamHandler.m (91%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTSnapshotsInSyncStreamHandler.m (87%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FLTTransactionStreamHandler.m (94%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FirestoreMessages.g.m (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore}/FirestorePigeonParser.m (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Assets => cloud_firestore/Sources/cloud_firestore/Resources}/.gitkeep (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTDocumentSnapshotStreamHandler.h (91%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTFirebaseFirestoreExtension.h (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTFirebaseFirestoreReader.h (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTFirebaseFirestoreUtils.h (96%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTFirebaseFirestoreWriter.h (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTLoadBundleStreamHandler.h (91%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTQuerySnapshotStreamHandler.h (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTSnapshotsInSyncStreamHandler.h (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FLTTransactionStreamHandler.h (82%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Private/FirestorePigeonParser.h (90%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Public/CustomPigeonHeaderFirestore.h (100%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Public/FLTFirebaseFirestorePlugin.h (86%) rename packages/cloud_firestore/cloud_firestore/ios/{Classes => cloud_firestore/Sources/cloud_firestore/include/cloud_firestore}/Public/FirestoreMessages.g.h (100%) create mode 100644 packages/cloud_firestore/cloud_firestore/ios/generated_firebase_sdk_version.txt delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTDocumentSnapshotStreamHandler.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreExtension.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestorePlugin.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreReader.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreUtils.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreWriter.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTLoadBundleStreamHandler.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTQuerySnapshotStreamHandler.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTSnapshotsInSyncStreamHandler.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FLTTransactionStreamHandler.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FirestoreMessages.g.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/FirestorePigeonParser.m delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTDocumentSnapshotStreamHandler.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreExtension.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreReader.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreUtils.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreWriter.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTLoadBundleStreamHandler.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTQuerySnapshotStreamHandler.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTSnapshotsInSyncStreamHandler.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTTransactionStreamHandler.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FirestorePigeonParser.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Public/CustomPigeonHeaderFirestore.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FLTFirebaseFirestorePlugin.h delete mode 120000 packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FirestoreMessages.g.h create mode 100644 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Package.swift create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestorePigeonParser.m rename packages/cloud_firestore/cloud_firestore/macos/{Assets => cloud_firestore/Sources/cloud_firestore/Resources}/.gitkeep (100%) mode change 100755 => 100644 create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h create mode 120000 packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h create mode 100644 scripts/generate_ios_sdk_version_txt_spm.dart diff --git a/.github/workflows/all_plugins.yaml b/.github/workflows/all_plugins.yaml index 9b04276ad40d..8c0e545f645f 100644 --- a/.github/workflows/all_plugins.yaml +++ b/.github/workflows/all_plugins.yaml @@ -137,7 +137,7 @@ jobs: - name: 'Swift Integration Setup' run: flutter config --enable-swift-package-manager - name: 'Build Apps with Swift Package Manager' - run: ./.github/workflows/scripts/swift-integration.sh + run: dart ./.github/workflows/scripts/swift-integration.dart test: runs-on: ubuntu-latest diff --git a/.github/workflows/scripts/swift-integration.dart b/.github/workflows/scripts/swift-integration.dart new file mode 100644 index 000000000000..fe3d50e5e3ca --- /dev/null +++ b/.github/workflows/scripts/swift-integration.dart @@ -0,0 +1,105 @@ +// Copyright 2024, the Chromium project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; +import 'dart:convert'; + +void main() async { + await buildSwiftExampleApp('ios', 'firebase_core'); + await buildSwiftExampleApp('ios', 'cloud_firestore'); + await buildSwiftExampleApp('macos', 'firebase_core'); + await buildSwiftExampleApp('macos', 'cloud_firestore'); +} + +Future deleteFirstLine(String filePath) async { + final file = File(filePath); + + if (!file.existsSync()) { + print('File does not exist: $filePath'); + return; + } + + final lines = await file.readAsLines(); + if (lines.isNotEmpty) { + final updatedContent = lines.skip(1).join('\n'); + await file.writeAsString(updatedContent); + print('First line deleted from $filePath'); + } else { + print('File is empty: $filePath'); + } +} + +Future buildSwiftExampleApp(String platform, String plugin) async { + final initialDirectory = Directory.current; + final platformName = platform == 'ios' ? 'iOS' : 'macOS'; + + print('Building $plugin $platformName example app with swift (SPM)'); + + final directory = Directory('packages/$plugin/$plugin/example/$platform'); + if (!directory.existsSync()) { + print('Directory does not exist: ${directory.path}'); + exit(1); + } + + if (platform == 'macos') { + await deleteFirstLine( + 'packages/$plugin/$plugin/example/macos/Flutter/Flutter-Debug.xcconfig'); + } + // Change to the appropriate directory + Directory.current = directory; + + // Remove Podfile and deintegrate pods + await _runCommand('rm', ['Podfile']); + await _runCommand('pod', ['deintegrate']); + + // Determine the arguments for the flutter build command + final flutterArgs = ['build', platform]; + if (platform == 'ios') { + flutterArgs.add('--no-codesign'); + } + + // Run the flutter build command + final flutterResult = await _runCommand('flutter', flutterArgs); + + // Check if the flutter build command was successful + if (flutterResult.exitCode != 0) { + print('Flutter build failed with exit code ${flutterResult.exitCode}.'); + exit(1); + } + + // Check the output for the specific string + if (flutterResult.stdout.contains('Running pod install')) { + print('Failed. Pods are being installed when they should not be.'); + exit(1); + } else { + print( + 'Successfully built $plugin $platformName project using Swift Package Manager.'); + } + + Directory.current = initialDirectory; +} + +Future _runCommand( + String command, List arguments) async { + final process = await Process.start(command, arguments); + + // Listen to stdout + process.stdout.transform(utf8.decoder).listen((data) { + print(data); + }); + + // Listen to stderr + process.stderr.transform(utf8.decoder).listen((data) { + print('stderr output: $data'); + }); + + // Wait for the process to complete + final exitCode = await process.exitCode; + + if (exitCode != 0) { + print('Command failed: $command ${arguments.join(' ')}'); + } + + return ProcessResult(process.pid, exitCode, '', ''); +} diff --git a/.github/workflows/scripts/swift-integration.sh b/.github/workflows/scripts/swift-integration.sh deleted file mode 100755 index b9252eca47c7..000000000000 --- a/.github/workflows/scripts/swift-integration.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -set -e - -# Just Core example has pure Swift capability at the moment - - -# firebase_core iOS example - -# Setup for SPM integration - -echo "Building firebase core iOS example app with swift (SPM)" - -cd packages/firebase_core/firebase_core/example/ios -rm Podfile -pod deintegrate - -# Run the flutter build command and capture the output and exit status -flutter_output=$(flutter build ios --no-codesign) -flutter_exit_code=$? - -# Check if the flutter build command was successful -if [[ $flutter_exit_code -ne 0 ]]; then - echo "Flutter build failed with exit code $flutter_exit_code." - exit 1 -fi - -# Check the output for the specific string -if [[ "$flutter_output" =~ "Running pod install" ]]; then - echo "Failed. Pods are being installed when they should not be." - exit 1 -else - echo "Successfully built iOS project using Swift Package Manager." -fi - -# firebase_core macOS example - -# Setup for SPM integration - -echo "Building firebase core macOS example app with swift (SPM)" - -cd ../macos -rm Podfile -pod deintegrate - -# Run the flutter build command and capture the output and exit status -flutter_output=$(flutter build macos) -flutter_exit_code=$? - -# Check if the flutter build command was successful -if [[ $flutter_exit_code -ne 0 ]]; then - echo "Flutter build failed with exit code $flutter_exit_code." - exit 1 -fi - -# Check the output for the specific string -if [[ "$flutter_output" =~ "Running pod install" ]]; then - echo "Failed. Pods are being installed when they should not be." - exit 1 -else - echo "Successfully built macOS project using Swift Package Manager." - exit 0 -fi diff --git a/melos.yaml b/melos.yaml index 78ba09d39ad5..fea2edc6b45f 100644 --- a/melos.yaml +++ b/melos.yaml @@ -19,6 +19,7 @@ command: preCommit: | dart run scripts/generate_vertexai_version.dart && \ dart run scripts/generate_dataconnect_version.dart && \ + dart run scripts/generate_ios_sdk_version_txt_spm && \ git add packages/firebase_vertexai/firebase_vertexai/lib/src/vertex_version.dart && \ git add packages/firebase_data_connect/firebase_data_connect/lib/src/dataconnect_version.dart post: | diff --git a/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/project.pbxproj b/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/project.pbxproj index f8c4563deaa8..9c13c6557a87 100644 --- a/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; A83F699FC746D5736A6B5780 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8EC7192C60686BF1D599360 /* Pods_Runner.framework */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -56,6 +57,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, A83F699FC746D5736A6B5780 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -131,6 +133,9 @@ /* Begin PBXNativeTarget section */ 97C146ED1CF9000F007C117D /* Runner */ = { + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( @@ -157,6 +162,9 @@ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); isa = PBXProject; attributes = { LastUpgradeCheck = 1510; @@ -571,6 +579,18 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 5e31d3d342f3..e598ba7945d8 100644 --- a/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/cloud_firestore/cloud_firestore/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + '../LICENSE' } s.authors = 'The Chromium Authors' s.source = { :path => '.' } - - s.source_files = 'Classes/**/*.{h,m}' - s.public_header_files = 'Classes/Public/*.h' - s.private_header_files = 'Classes/Private/*.h' + s.source_files = 'cloud_firestore/Sources/cloud_firestore/**/*.{h,m}' + s.public_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Public/**/*.h' + s.private_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Private/**/*.h' s.ios.deployment_target = '13.0' s.dependency 'Flutter' @@ -37,7 +36,7 @@ Pod::Spec.new do |s| s.static_framework = true s.pod_target_xcconfig = { - 'GCC_PREPROCESSOR_DEFINITIONS' => "LIBRARY_VERSION=\\@\\\"#{library_version}\\\" LIBRARY_NAME=\\@\\\"flutter-fire-fst\\\"", + 'GCC_PREPROCESSOR_DEFINITIONS' => "LIBRARY_VERSION=\\\"#{library_version}\\\" LIBRARY_NAME=\\\"flutter-fire-fst\\\"", 'DEFINES_MODULE' => 'YES' } end diff --git a/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Package.swift b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Package.swift new file mode 100644 index 000000000000..d8afa1426792 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Package.swift @@ -0,0 +1,116 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +// Copyright 2024, the Chromium project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import Foundation +import PackageDescription + +enum ConfigurationError: Error { + case fileNotFound(String) + case parsingError(String) + case invalidFormat(String) +} + +let firestoreDirectory = String(URL(string: #file)!.deletingLastPathComponent().absoluteString + .dropLast()) + +func loadFirebaseSDKVersion() throws -> String { + let firebaseCoreScriptPath = NSString.path(withComponents: [ + firestoreDirectory, + "..", + "generated_firebase_sdk_version.txt", + ]) + do { + let version = try String(contentsOfFile: firebaseCoreScriptPath, encoding: .utf8) + .trimmingCharacters(in: .whitespacesAndNewlines) + return version + } catch { + throw ConfigurationError + .fileNotFound("Error loading or parsing generated_firebase_sdk_version.txt: \(error)") + } +} + +func loadPubspecVersions() throws -> (packageVersion: String, firebaseCoreVersion: String) { + let pubspecPath = NSString.path(withComponents: [firestoreDirectory, "..", "..", "pubspec.yaml"]) + do { + let yamlString = try String(contentsOfFile: pubspecPath, encoding: .utf8) + let lines = yamlString.split(separator: "\n") + + guard let packageVersionLine = lines.first(where: { $0.starts(with: "version:") }) else { + throw ConfigurationError.invalidFormat("No package version line found in pubspec.yaml") + } + var packageVersion = packageVersionLine.split(separator: ":")[1] + .trimmingCharacters(in: .whitespaces) + .replacingOccurrences(of: "+", with: "-") + packageVersion = packageVersion.replacingOccurrences(of: "^", with: "") + + guard let firebaseCoreVersionLine = lines.first(where: { $0.contains("firebase_core:") }) else { + throw ConfigurationError + .invalidFormat("No firebase_core dependency version line found in pubspec.yaml") + } + var firebaseCoreVersion = firebaseCoreVersionLine.split(separator: ":")[1] + .trimmingCharacters(in: .whitespaces) + firebaseCoreVersion = firebaseCoreVersion.replacingOccurrences(of: "^", with: "") + + return (packageVersion, firebaseCoreVersion) + } catch { + throw ConfigurationError.fileNotFound("Error loading or parsing pubspec.yaml: \(error)") + } +} + +let library_version: String +let firebase_sdk_version_string: String +let firebase_core_version_string: String +let shared_spm_tag = "-firebase-core-swift" + +do { + library_version = try loadPubspecVersions().packageVersion + firebase_sdk_version_string = try loadFirebaseSDKVersion() + firebase_core_version_string = try loadPubspecVersions().firebaseCoreVersion +} catch { + fatalError("Failed to load configuration: \(error)") +} + +guard let firebase_sdk_version = Version(firebase_sdk_version_string) else { + fatalError("Invalid Firebase SDK version: \(firebase_sdk_version_string)") +} + +guard let shared_spm_version = Version("\(firebase_core_version_string)\(shared_spm_tag)") else { + fatalError("Invalid firebase_core version: \(firebase_core_version_string)\(shared_spm_tag)") +} + +let package = Package( + name: "cloud_firestore", + platforms: [ + .iOS("13.0"), + ], + products: [ + .library(name: "cloud-firestore", targets: ["cloud_firestore"]), + ], + dependencies: [ + .package(url: "https://github.com/firebase/firebase-ios-sdk", from: firebase_sdk_version), + .package(url: "https://github.com/firebase/flutterfire", exact: shared_spm_version), + ], + targets: [ + .target( + name: "cloud_firestore", + dependencies: [ + .product(name: "FirebaseFirestore", package: "firebase-ios-sdk"), + // Wrapper dependency + .product(name: "firebase-core-shared", package: "flutterfire"), + ], + resources: [ + .process("Resources"), + ], + cSettings: [ + .headerSearchPath("include/cloud_firestore/Private"), + .headerSearchPath("include/cloud_firestore/Public"), + .define("LIBRARY_VERSION", to: "\"\(library_version)\""), + .define("LIBRARY_NAME", to: "\"flutter-fire-fst\""), + ] + ), + ] +) diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTDocumentSnapshotStreamHandler.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m similarity index 87% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTDocumentSnapshotStreamHandler.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m index 280fe82f139a..a787f8ad92b9 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTDocumentSnapshotStreamHandler.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m @@ -3,12 +3,16 @@ // found in the LICENSE file. @import FirebaseFirestore; +#if __has_include() #import +#else +#import +#endif -#import "Private/FLTDocumentSnapshotStreamHandler.h" -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FirestorePigeonParser.h" -#import "Public/CustomPigeonHeaderFirestore.h" +#import "include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" +#import "include/cloud_firestore/Private/FirestorePigeonParser.h" +#import "include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h" @interface FLTDocumentSnapshotStreamHandler () @property(readwrite, strong) id listenerRegistration; diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreExtension.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m similarity index 90% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreExtension.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m index c90dbe1f9e5f..33fd92271fc4 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreExtension.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m @@ -3,7 +3,7 @@ // found in the LICENSE file. @import FirebaseFirestore; -#import "Private/FLTFirebaseFirestoreExtension.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h" @interface FLTFirebaseFirestoreExtension () diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestorePlugin.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m similarity index 97% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestorePlugin.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m index 45baf0b4ca3b..cb2f5ee43ad1 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestorePlugin.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m @@ -3,19 +3,23 @@ // found in the LICENSE file. @import FirebaseFirestore; +#if __has_include() #import +#else +#import +#endif #import #import "FirebaseFirestoreInternal/FIRPersistentCacheIndexManager.h" -#import "Private/FLTDocumentSnapshotStreamHandler.h" -#import "Private/FLTFirebaseFirestoreReader.h" -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FLTLoadBundleStreamHandler.h" -#import "Private/FLTQuerySnapshotStreamHandler.h" -#import "Private/FLTSnapshotsInSyncStreamHandler.h" -#import "Private/FLTTransactionStreamHandler.h" -#import "Private/FirestorePigeonParser.h" -#import "Public/FLTFirebaseFirestorePlugin.h" +#import "include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" +#import "include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h" +#import "include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h" +#import "include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h" +#import "include/cloud_firestore/Private/FLTTransactionStreamHandler.h" +#import "include/cloud_firestore/Private/FirestorePigeonParser.h" +#import "include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h" NSString *const kFLTFirebaseFirestoreChannelName = @"plugins.flutter.io/firebase_firestore"; NSString *const kFLTFirebaseFirestoreQuerySnapshotEventChannelName = @@ -166,11 +170,11 @@ - (NSDictionary *_Nonnull)pluginConstantsForFIRApp:(FIRApp *)firebase_app { } - (NSString *_Nonnull)firebaseLibraryName { - return LIBRARY_NAME; + return @LIBRARY_NAME; } - (NSString *_Nonnull)firebaseLibraryVersion { - return LIBRARY_VERSION; + return @LIBRARY_VERSION; } - (NSString *_Nonnull)flutterChannelName { diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreReader.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m similarity index 97% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreReader.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m index e678b1cff779..e343ab9aafc5 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreReader.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m @@ -3,10 +3,15 @@ // found in the LICENSE file. @import FirebaseFirestore; -#import +@import FirebaseCore; -#import "Private/FLTFirebaseFirestoreReader.h" -#import "Private/FLTFirebaseFirestoreUtils.h" +#if __has_include() +#import +#else +#import +#endif +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" @implementation FLTFirebaseFirestoreReader diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreUtils.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m similarity index 97% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreUtils.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m index 3df29f13f1fc..d49fbc7f4a79 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreUtils.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m @@ -5,10 +5,10 @@ @import FirebaseFirestore; @import FirebaseCore; -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FLTFirebaseFirestoreExtension.h" -#import "Private/FLTFirebaseFirestoreReader.h" -#import "Private/FLTFirebaseFirestoreWriter.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h" @implementation FLTFirebaseFirestoreReaderWriter - (FlutterStandardWriter *_Nonnull)writerWithData:(NSMutableData *)data { diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreWriter.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m similarity index 97% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreWriter.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m index 8533a56be420..8e2ea182fa31 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTFirebaseFirestoreWriter.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m @@ -3,11 +3,11 @@ // found in the LICENSE file. @import FirebaseFirestore; -#import +@import FirebaseCore; -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FLTFirebaseFirestoreWriter.h" -#import "Public/FLTFirebaseFirestorePlugin.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" +#import "include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h" @implementation FLTFirebaseFirestoreWriter : FlutterStandardWriter - (void)writeValue:(id)value { diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTLoadBundleStreamHandler.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m similarity index 90% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTLoadBundleStreamHandler.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m index c9e91301a798..cc8bd9be9ae2 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTLoadBundleStreamHandler.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m @@ -10,10 +10,14 @@ // @import FirebaseFirestore; +#if __has_include() #import +#else +#import +#endif -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FLTLoadBundleStreamHandler.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" +#import "include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h" @interface FLTLoadBundleStreamHandler () @property(readwrite, strong) FIRLoadBundleTask *task; diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTQuerySnapshotStreamHandler.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m similarity index 91% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTQuerySnapshotStreamHandler.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m index 86c11b3d867b..bb80a2d6e69e 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTQuerySnapshotStreamHandler.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m @@ -3,12 +3,16 @@ // found in the LICENSE file. @import FirebaseFirestore; +#if __has_include() #import - -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FLTQuerySnapshotStreamHandler.h" -#import "Private/FirestorePigeonParser.h" -#import "Public/CustomPigeonHeaderFirestore.h" +#else +#import +#endif + +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" +#import "include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h" +#import "include/cloud_firestore/Private/FirestorePigeonParser.h" +#import "include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h" @interface FLTQuerySnapshotStreamHandler () @property(readwrite, strong) id listenerRegistration; diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTSnapshotsInSyncStreamHandler.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m similarity index 87% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTSnapshotsInSyncStreamHandler.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m index 6662ad2de277..1003be610006 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTSnapshotsInSyncStreamHandler.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m @@ -3,10 +3,9 @@ // found in the LICENSE file. @import FirebaseFirestore; -#import -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FLTSnapshotsInSyncStreamHandler.h" +#import "include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" @interface FLTSnapshotsInSyncStreamHandler () @property(readwrite, strong) id listenerRegistration; diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTTransactionStreamHandler.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m similarity index 94% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FLTTransactionStreamHandler.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m index 364ff7687c1a..29252ca4821c 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/FLTTransactionStreamHandler.m +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m @@ -3,11 +3,15 @@ // found in the LICENSE file. @import FirebaseFirestore; +#if __has_include() #import +#else +#import +#endif -#import "Private/FLTFirebaseFirestoreUtils.h" -#import "Private/FLTTransactionStreamHandler.h" -#import "Private/FirestorePigeonParser.h" +#import "include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h" +#import "include/cloud_firestore/Private/FLTTransactionStreamHandler.h" +#import "include/cloud_firestore/Private/FirestorePigeonParser.h" @interface FLTTransactionStreamHandler () @property(nonatomic, copy, nonnull) void (^started)(FIRTransaction *); diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FirestoreMessages.g.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FirestoreMessages.g.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/FirestorePigeonParser.m b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FirestorePigeonParser.m similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/FirestorePigeonParser.m rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FirestorePigeonParser.m diff --git a/packages/cloud_firestore/cloud_firestore/ios/Assets/.gitkeep b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/Resources/.gitkeep similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Assets/.gitkeep rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/Resources/.gitkeep diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTDocumentSnapshotStreamHandler.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h similarity index 91% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTDocumentSnapshotStreamHandler.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h index 9f8ecd7fdce6..fc97756c5d90 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTDocumentSnapshotStreamHandler.h +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h @@ -9,6 +9,12 @@ #import #endif +#if TARGET_OS_OSX +#import +#else +@import FirebaseFirestore; +#endif + #import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreExtension.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreExtension.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreReader.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreReader.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreUtils.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h similarity index 96% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreUtils.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h index ef5dc5a47db7..02c7ab21fd9a 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreUtils.h +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h @@ -10,7 +10,11 @@ #import #endif +#if TARGET_OS_OSX +#import +#else @import FirebaseFirestore; +#endif #import #import "FLTFirebaseFirestoreExtension.h" diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreWriter.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestoreWriter.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTLoadBundleStreamHandler.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h similarity index 91% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTLoadBundleStreamHandler.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h index 59f018b61e17..30dbfcd72dc8 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTLoadBundleStreamHandler.h +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h @@ -18,7 +18,11 @@ #import #endif +#if TARGET_OS_OSX +#import +#else @import FirebaseFirestore; +#endif #import diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTQuerySnapshotStreamHandler.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTQuerySnapshotStreamHandler.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTSnapshotsInSyncStreamHandler.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTSnapshotsInSyncStreamHandler.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTTransactionStreamHandler.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h similarity index 82% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTTransactionStreamHandler.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h index cc427a82b6a5..213570d9887b 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTTransactionStreamHandler.h +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h @@ -9,9 +9,16 @@ #import #endif +#if TARGET_OS_OSX +#import +#else @import FirebaseFirestore; -#import "FirestoreMessages.g.h" - +#endif +#if __has_include() +#import +#else +#import "../Public/FirestoreMessages.g.h" +#endif #import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h similarity index 90% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h index 7007a0973642..e197ef7592b0 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h @@ -4,10 +4,17 @@ * BSD-style license that can be found in the LICENSE file. */ +#if TARGET_OS_OSX +#import +#else @import FirebaseFirestore; +#endif #import -#import "FirestoreMessages.g.h" - +#if __has_include() +#import +#else +#import "../Public/FirestoreMessages.g.h" +#endif @interface FirestorePigeonParser : NSObject + (FIRFilter *_Nonnull)filterFromJson:(NSDictionary *_Nullable)map; diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Public/CustomPigeonHeaderFirestore.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Public/CustomPigeonHeaderFirestore.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Public/FLTFirebaseFirestorePlugin.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h similarity index 86% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Public/FLTFirebaseFirestorePlugin.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h index b8cbed4d1b43..85e38b5ee2a5 100644 --- a/packages/cloud_firestore/cloud_firestore/ios/Classes/Public/FLTFirebaseFirestorePlugin.h +++ b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h @@ -10,7 +10,11 @@ #endif #import +#if __has_include() #import +#else +#import +#endif #import "FirestoreMessages.g.h" @interface FLTFirebaseFirestorePlugin diff --git a/packages/cloud_firestore/cloud_firestore/ios/Classes/Public/FirestoreMessages.g.h b/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h similarity index 100% rename from packages/cloud_firestore/cloud_firestore/ios/Classes/Public/FirestoreMessages.g.h rename to packages/cloud_firestore/cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h diff --git a/packages/cloud_firestore/cloud_firestore/ios/generated_firebase_sdk_version.txt b/packages/cloud_firestore/cloud_firestore/ios/generated_firebase_sdk_version.txt new file mode 100644 index 000000000000..86b57ebe918f --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/ios/generated_firebase_sdk_version.txt @@ -0,0 +1 @@ +11.4.0 \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTDocumentSnapshotStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTDocumentSnapshotStreamHandler.m deleted file mode 120000 index 6dd7dcbb4a9a..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTDocumentSnapshotStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTDocumentSnapshotStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreExtension.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreExtension.m deleted file mode 120000 index 753bbb4becaa..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreExtension.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTFirebaseFirestoreExtension.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestorePlugin.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestorePlugin.m deleted file mode 120000 index a2aa780a3d1e..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestorePlugin.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTFirebaseFirestorePlugin.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreReader.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreReader.m deleted file mode 120000 index d71bd6d120b1..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreReader.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTFirebaseFirestoreReader.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreUtils.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreUtils.m deleted file mode 120000 index d17757bb8104..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreUtils.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTFirebaseFirestoreUtils.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreWriter.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreWriter.m deleted file mode 120000 index 9b170a0183ff..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTFirebaseFirestoreWriter.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTFirebaseFirestoreWriter.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTLoadBundleStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTLoadBundleStreamHandler.m deleted file mode 120000 index 691e4a65f7e1..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTLoadBundleStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTLoadBundleStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTQuerySnapshotStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTQuerySnapshotStreamHandler.m deleted file mode 120000 index f05e6a9aed0d..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTQuerySnapshotStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTQuerySnapshotStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTSnapshotsInSyncStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTSnapshotsInSyncStreamHandler.m deleted file mode 120000 index 68f3d6ce740b..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTSnapshotsInSyncStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTSnapshotsInSyncStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTTransactionStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTTransactionStreamHandler.m deleted file mode 120000 index d131da4f79d2..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FLTTransactionStreamHandler.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FLTTransactionStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FirestoreMessages.g.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FirestoreMessages.g.m deleted file mode 120000 index 85c29fb8d462..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FirestoreMessages.g.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FirestoreMessages.g.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/FirestorePigeonParser.m b/packages/cloud_firestore/cloud_firestore/macos/Classes/FirestorePigeonParser.m deleted file mode 120000 index e9bb61f6611f..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/FirestorePigeonParser.m +++ /dev/null @@ -1 +0,0 @@ -../../ios/Classes/FirestorePigeonParser.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTDocumentSnapshotStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTDocumentSnapshotStreamHandler.h deleted file mode 120000 index 2cf0cae9998c..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTDocumentSnapshotStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTDocumentSnapshotStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreExtension.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreExtension.h deleted file mode 120000 index 852428011b72..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreExtension.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTFirebaseFirestoreExtension.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreReader.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreReader.h deleted file mode 120000 index e64672bf3166..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreReader.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTFirebaseFirestoreReader.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreUtils.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreUtils.h deleted file mode 120000 index de4c1d88a379..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreUtils.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTFirebaseFirestoreUtils.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreWriter.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreWriter.h deleted file mode 120000 index 392a28cf9ba5..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTFirebaseFirestoreWriter.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTFirebaseFirestoreWriter.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTLoadBundleStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTLoadBundleStreamHandler.h deleted file mode 120000 index 206844b39802..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTLoadBundleStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTLoadBundleStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTQuerySnapshotStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTQuerySnapshotStreamHandler.h deleted file mode 120000 index ae0f05acbcc1..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTQuerySnapshotStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTQuerySnapshotStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTSnapshotsInSyncStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTSnapshotsInSyncStreamHandler.h deleted file mode 120000 index f43b78c2b268..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTSnapshotsInSyncStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTSnapshotsInSyncStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTTransactionStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTTransactionStreamHandler.h deleted file mode 120000 index 392204f063c2..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FLTTransactionStreamHandler.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FLTTransactionStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FirestorePigeonParser.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FirestorePigeonParser.h deleted file mode 120000 index c74caa9f3ec9..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Private/FirestorePigeonParser.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Private/FirestorePigeonParser.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/CustomPigeonHeaderFirestore.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/CustomPigeonHeaderFirestore.h deleted file mode 120000 index 684480e0808f..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/CustomPigeonHeaderFirestore.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Public/CustomPigeonHeaderFirestore.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FLTFirebaseFirestorePlugin.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FLTFirebaseFirestorePlugin.h deleted file mode 120000 index c2aada4a605f..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FLTFirebaseFirestorePlugin.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Public/FLTFirebaseFirestorePlugin.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FirestoreMessages.g.h b/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FirestoreMessages.g.h deleted file mode 120000 index ced0e7de07a6..000000000000 --- a/packages/cloud_firestore/cloud_firestore/macos/Classes/Public/FirestoreMessages.g.h +++ /dev/null @@ -1 +0,0 @@ -../../../ios/Classes/Public/FirestoreMessages.g.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore.podspec b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore.podspec index e433c03228ab..44815fe6d85a 100755 --- a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore.podspec +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore.podspec @@ -43,9 +43,9 @@ Pod::Spec.new do |s| s.authors = 'The Chromium Authors' s.source = { :path => '.' } - s.source_files = 'Classes/**/*.{h,m}' - s.public_header_files = 'Classes/Public/*.h' - s.private_header_files = 'Classes/Private/*.h' + s.source_files = 'cloud_firestore/Sources/cloud_firestore/**/*.{h,m}' + s.public_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Public/**/*.h' + s.private_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Private/**/*.h' s.platform = :osx, '10.13' @@ -59,7 +59,7 @@ Pod::Spec.new do |s| s.static_framework = true s.pod_target_xcconfig = { - 'GCC_PREPROCESSOR_DEFINITIONS' => "LIBRARY_VERSION=\\@\\\"#{library_version}\\\" LIBRARY_NAME=\\@\\\"flutter-fire-fst\\\"", + 'GCC_PREPROCESSOR_DEFINITIONS' => "LIBRARY_VERSION=\\\"#{library_version}\\\" LIBRARY_NAME=\\\"flutter-fire-fst\\\"", 'DEFINES_MODULE' => 'YES' } end diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Package.swift b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Package.swift new file mode 100644 index 000000000000..ea561c45394c --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Package.swift @@ -0,0 +1,154 @@ +// swift-tools-version: 5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +// Copyright 2024, the Chromium project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import Foundation +import PackageDescription + +enum ConfigurationError: Error { + case fileNotFound(String) + case parsingError(String) + case invalidFormat(String) +} + +let firestoreDirectory = String(URL(string: #file)!.deletingLastPathComponent().absoluteString + .dropLast()) + +func loadFirebaseSDKVersion() throws -> String { + let firebaseCoreScriptPath = NSString.path(withComponents: [ + firestoreDirectory, + "..", + "..", + "..", + "..", + "firebase_core", + "firebase_core", + "ios", + "firebase_sdk_version.rb", + ]) + do { + let content = try String(contentsOfFile: firebaseCoreScriptPath, encoding: .utf8) + let pattern = #"def firebase_sdk_version!\(\)\n\s+'([^']+)'\nend"# + if let regex = try? NSRegularExpression(pattern: pattern, options: []), + let match = regex.firstMatch( + in: content, + range: NSRange(content.startIndex..., in: content) + ) { + if let versionRange = Range(match.range(at: 1), in: content) { + return String(content[versionRange]) + } else { + throw ConfigurationError.invalidFormat("Invalid format in firebase_sdk_version.rb") + } + } else { + throw ConfigurationError.parsingError("No match found in firebase_sdk_version.rb") + } + } catch { + throw ConfigurationError + .fileNotFound("Error loading or parsing firebase_sdk_version.rb: \(error)") + } +} + +func loadFirebaseCoreVersion() throws -> String { + let firebaseCorePubspecPath = NSString.path(withComponents: [ + firestoreDirectory, + "..", + "..", + "..", + "..", + "firebase_core", + "firebase_core", + "pubspec.yaml", + ]) + do { + let yamlString = try String(contentsOfFile: firebaseCorePubspecPath, encoding: .utf8) + let lines = yamlString.split(separator: "\n") + + guard let versionLine = lines.first(where: { $0.starts(with: "version:") }) else { + throw ConfigurationError.invalidFormat("No version line found in pubspec.yaml") + } + let libraryVersion = versionLine.split(separator: ":")[1].trimmingCharacters(in: .whitespaces) + .replacingOccurrences(of: "+", with: "-") + + return libraryVersion + } catch { + throw ConfigurationError + .fileNotFound("Error loading or parsing firebase_core pubspec.yaml: \(error)") + } +} + +func loadPubspecVersion() throws -> String { + let pubspecPath = NSString.path(withComponents: [firestoreDirectory, "..", "..", "pubspec.yaml"]) + do { + let yamlString = try String(contentsOfFile: pubspecPath, encoding: .utf8) + let lines = yamlString.split(separator: "\n") + + guard let versionLine = lines.first(where: { $0.starts(with: "version:") }) else { + throw ConfigurationError.invalidFormat("No version line found in pubspec.yaml") + } + let libraryVersion = versionLine.split(separator: ":")[1].trimmingCharacters(in: .whitespaces) + .replacingOccurrences(of: "+", with: "-") + + return libraryVersion + } catch { + throw ConfigurationError.fileNotFound("Error loading or parsing pubspec.yaml: \(error)") + } +} + +let library_version: String +let firebase_sdk_version_string: String +let firebase_core_version_string: String +let shared_spm_tag = "-firebase-core-swift" + +do { + library_version = try loadPubspecVersion() + firebase_sdk_version_string = try loadFirebaseSDKVersion() + firebase_core_version_string = try loadFirebaseCoreVersion() +} catch { + fatalError("Failed to load configuration: \(error)") +} + +guard let firebase_sdk_version = Version(firebase_sdk_version_string) else { + fatalError("Invalid Firebase SDK version: \(firebase_sdk_version_string)") +} + +// TODO: - we can try using existing firebase_core tag once flutterfire/Package.swift is part of release cycle +// but I don't think it'll work as Swift versioning requires version-[tag name] +guard let shared_spm_version = Version("\(firebase_core_version_string)\(shared_spm_tag)") else { + fatalError("Invalid firebase_core version: \(firebase_core_version_string)\(shared_spm_tag)") +} + +let package = Package( + name: "cloud_firestore", + platforms: [ + .macOS("10.15"), + ], + products: [ + .library(name: "cloud-firestore", targets: ["cloud_firestore"]), + ], + dependencies: [ + .package(url: "https://github.com/firebase/firebase-ios-sdk", from: firebase_sdk_version), + .package(url: "https://github.com/firebase/flutterfire", exact: shared_spm_version), + ], + targets: [ + .target( + name: "cloud_firestore", + dependencies: [ + .product(name: "FirebaseFirestore", package: "firebase-ios-sdk"), + // Wrapper dependency + .product(name: "firebase-core-shared", package: "flutterfire"), + ], + resources: [ + .process("Resources"), + ], + cSettings: [ + .headerSearchPath("include/cloud_firestore/Private"), + .headerSearchPath("include/cloud_firestore/Public"), + .define("LIBRARY_VERSION", to: "\"\(library_version)\""), + .define("LIBRARY_NAME", to: "\"flutter-fire-fst\""), + ] + ), + ] +) diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m new file mode 120000 index 000000000000..aeb6ebc5c006 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTDocumentSnapshotStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m new file mode 120000 index 000000000000..bd4cf1dd5fde --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreExtension.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m new file mode 120000 index 000000000000..f791caf0cc3c --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestorePlugin.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m new file mode 120000 index 000000000000..e89ebb8929cc --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreReader.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m new file mode 120000 index 000000000000..babea1c24081 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreUtils.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m new file mode 120000 index 000000000000..e4b626a19876 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTFirebaseFirestoreWriter.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m new file mode 120000 index 000000000000..b4114c3d04d5 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTLoadBundleStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m new file mode 120000 index 000000000000..1f1bbb9f3bef --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTQuerySnapshotStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m new file mode 120000 index 000000000000..7e50903ad6be --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTSnapshotsInSyncStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m new file mode 120000 index 000000000000..66555a825643 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FLTTransactionStreamHandler.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m new file mode 120000 index 000000000000..83b8548becc8 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestorePigeonParser.m b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestorePigeonParser.m new file mode 120000 index 000000000000..32c6ef6bf146 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/FirestorePigeonParser.m @@ -0,0 +1 @@ +../../../../ios/cloud_firestore/Sources/cloud_firestore/FirestorePigeonParser.m \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/Assets/.gitkeep b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/Resources/.gitkeep old mode 100755 new mode 100644 similarity index 100% rename from packages/cloud_firestore/cloud_firestore/macos/Assets/.gitkeep rename to packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/Resources/.gitkeep diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h new file mode 120000 index 000000000000..61d4d26dcb13 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTDocumentSnapshotStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h new file mode 120000 index 000000000000..878691155dfe --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreExtension.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h new file mode 120000 index 000000000000..408a177ffc29 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreReader.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h new file mode 120000 index 000000000000..f09ad17e8322 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreUtils.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h new file mode 120000 index 000000000000..4c7ea1f49445 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTFirebaseFirestoreWriter.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h new file mode 120000 index 000000000000..be3fee9e19a9 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTLoadBundleStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h new file mode 120000 index 000000000000..31805df68cc2 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTQuerySnapshotStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h new file mode 120000 index 000000000000..a144ccda21cf --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTSnapshotsInSyncStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h new file mode 120000 index 000000000000..25a76252d90e --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FLTTransactionStreamHandler.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h new file mode 120000 index 000000000000..34aeced7af29 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Private/FirestorePigeonParser.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h new file mode 120000 index 000000000000..111ed085e8b8 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/CustomPigeonHeaderFirestore.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h new file mode 120000 index 000000000000..9d774a9ce963 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FLTFirebaseFirestorePlugin.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h new file mode 120000 index 000000000000..cfab6484dd12 --- /dev/null +++ b/packages/cloud_firestore/cloud_firestore/macos/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h @@ -0,0 +1 @@ +../../../../../../../ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h \ No newline at end of file diff --git a/packages/cloud_firestore/cloud_firestore_platform_interface/pigeons/messages.dart b/packages/cloud_firestore/cloud_firestore_platform_interface/pigeons/messages.dart index 45f42dd233c7..19a5ddfdc4ee 100644 --- a/packages/cloud_firestore/cloud_firestore_platform_interface/pigeons/messages.dart +++ b/packages/cloud_firestore/cloud_firestore_platform_interface/pigeons/messages.dart @@ -17,8 +17,9 @@ import 'package:pigeon/pigeon.dart'; className: 'GeneratedAndroidFirebaseFirestore', ), objcHeaderOut: - '../cloud_firestore/ios/Classes/Public/FirestoreMessages.g.h', - objcSourceOut: '../cloud_firestore/ios/Classes/FirestoreMessages.g.m', + '../cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/include/cloud_firestore/Public/FirestoreMessages.g.h', + objcSourceOut: + '../cloud_firestore/ios/cloud_firestore/Sources/cloud_firestore/FirestoreMessages.g.m', cppHeaderOut: '../cloud_firestore/windows/messages.g.h', cppSourceOut: '../cloud_firestore/windows/messages.g.cpp', cppOptions: CppOptions(namespace: 'cloud_firestore_windows'), diff --git a/packages/firebase_core/firebase_core/example/ios/Runner.xcodeproj/project.pbxproj b/packages/firebase_core/firebase_core/example/ios/Runner.xcodeproj/project.pbxproj index dbae6965e211..9f0caee183e9 100644 --- a/packages/firebase_core/firebase_core/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/firebase_core/firebase_core/example/ios/Runner.xcodeproj/project.pbxproj @@ -15,7 +15,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - CC8B39E3ACF96AAA7558280C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7EBB2450D3A9A002F48D58D3 /* Pods_Runner.framework */; }; + E766DA7F3F0A9F9BE32353CF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6052F8751F55A7BF8B2BF51 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -32,15 +32,14 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0F72582C036F53C7EA355605 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 42A2737C2B544A2E56A3A04E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 63CB8F00B8C52FB1D84FF6EC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 720AED231F4B8D9744E84B25 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 7EBB2450D3A9A002F48D58D3 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -49,7 +48,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B940C408F701618BB3D017B0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + B6052F8751F55A7BF8B2BF51 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E9CB62AF78D6D61CD2D1E629 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -58,17 +58,17 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - CC8B39E3ACF96AAA7558280C /* Pods_Runner.framework in Frameworks */, + E766DA7F3F0A9F9BE32353CF /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2CE3A5071D061A62942DA14B /* Frameworks */ = { + 482D7FAB0417043D5F05ECBE /* Frameworks */ = { isa = PBXGroup; children = ( - 7EBB2450D3A9A002F48D58D3 /* Pods_Runner.framework */, + B6052F8751F55A7BF8B2BF51 /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -76,9 +76,9 @@ 71DA98800DC8DF4E3AF74BFA /* Pods */ = { isa = PBXGroup; children = ( - 63CB8F00B8C52FB1D84FF6EC /* Pods-Runner.debug.xcconfig */, - B940C408F701618BB3D017B0 /* Pods-Runner.release.xcconfig */, - 42A2737C2B544A2E56A3A04E /* Pods-Runner.profile.xcconfig */, + 720AED231F4B8D9744E84B25 /* Pods-Runner.debug.xcconfig */, + E9CB62AF78D6D61CD2D1E629 /* Pods-Runner.release.xcconfig */, + 0F72582C036F53C7EA355605 /* Pods-Runner.profile.xcconfig */, ); path = Pods; sourceTree = ""; @@ -101,7 +101,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 71DA98800DC8DF4E3AF74BFA /* Pods */, - 2CE3A5071D061A62942DA14B /* Frameworks */, + 482D7FAB0417043D5F05ECBE /* Frameworks */, ); sourceTree = ""; }; @@ -144,7 +144,7 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 48B62E2CC1BC10B54D3853B7 /* [CP] Check Pods Manifest.lock */, + 9980DA9AFE8C30A0C57BB824 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, @@ -231,42 +231,42 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 48B62E2CC1BC10B54D3853B7 /* [CP] Check Pods Manifest.lock */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( ); + name = "Run Script"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { + 9980DA9AFE8C30A0C57BB824 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "Run Script"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/packages/firebase_core/firebase_core/ios/firebase_core/Package.swift b/packages/firebase_core/firebase_core/ios/firebase_core/Package.swift index 1e555687d7c1..a39f10863fc1 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_core/Package.swift +++ b/packages/firebase_core/firebase_core/ios/firebase_core/Package.swift @@ -66,11 +66,12 @@ func loadFirebaseSDKVersion() throws -> String { } } -let library_version: String +let library_version_string: String let firebase_sdk_version_string: String +let shared_spm_tag = "-firebase-core-swift" do { - library_version = try loadPubspecVersion() + library_version_string = try loadPubspecVersion() firebase_sdk_version_string = try loadFirebaseSDKVersion() } catch { fatalError("Failed to load configuration: \(error)") @@ -80,6 +81,12 @@ guard let firebase_sdk_version = Version(firebase_sdk_version_string) else { fatalError("Invalid Firebase SDK version: \(firebase_sdk_version_string)") } +// TODO: - we can try using existing firebase_core tag once flutterfire/Package.swift is part of release cycle +// but I don't think it'll work as Swift versioning requires version-[tag name] +guard let shared_spm_version = Version("\(library_version_string)\(shared_spm_tag)") else { + fatalError("Invalid firebase_core version: \(library_version_string)\(shared_spm_tag)") +} + let package = Package( name: "firebase_core", platforms: [ @@ -90,6 +97,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/firebase/firebase-ios-sdk", from: firebase_sdk_version), + .package(url: "https://github.com/firebase/flutterfire", exact: shared_spm_version), ], targets: [ .target( @@ -97,13 +105,21 @@ let package = Package( dependencies: [ // No product for firebase-core so we pull in the smallest one .product(name: "FirebaseInstallations", package: "firebase-ios-sdk"), + .product(name: "firebase-core-shared", package: "flutterfire"), + ], + exclude: [ + // These are now pulled in as a remote dependency from FlutterFire repo + "FLTFirebasePlugin.m", + "FLTFirebasePluginRegistry.m", + "include/firebase_core/FLTFirebasePlugin.h", + "include/firebase_core/FLTFirebasePluginRegistry.h", ], resources: [ .process("Resources"), ], cSettings: [ .headerSearchPath("include/firebase_core"), - .define("LIBRARY_VERSION", to: "\"\(library_version)\""), + .define("LIBRARY_VERSION", to: "\"\(library_version_string)\""), .define("LIBRARY_NAME", to: "\"flutter-fire-core\""), ] ), diff --git a/packages/firebase_core/firebase_core/macos/firebase_core/Package.swift b/packages/firebase_core/firebase_core/macos/firebase_core/Package.swift index c4d04289386e..bc5d45a12803 100644 --- a/packages/firebase_core/firebase_core/macos/firebase_core/Package.swift +++ b/packages/firebase_core/firebase_core/macos/firebase_core/Package.swift @@ -65,11 +65,12 @@ func loadFirebaseSDKVersion() throws -> String { } } -let library_version: String +let library_version_string: String let firebase_sdk_version_string: String +let shared_spm_tag = "-firebase-core-swift" do { - library_version = try loadPubspecVersion() + library_version_string = try loadPubspecVersion() firebase_sdk_version_string = try loadFirebaseSDKVersion() } catch { fatalError("Failed to load configuration: \(error)") @@ -79,6 +80,12 @@ guard let firebase_sdk_version = Version(firebase_sdk_version_string) else { fatalError("Invalid Firebase SDK version: \(firebase_sdk_version_string)") } +// TODO: - we can try using existing firebase_core tag once flutterfire/Package.swift is part of release cycle +// but I don't think it'll work as Swift versioning requires version-[tag name] +guard let shared_spm_version = Version("\(library_version_string)\(shared_spm_tag)") else { + fatalError("Invalid firebase_core version: \(library_version_string)\(shared_spm_tag)") +} + let package = Package( name: "firebase_core", platforms: [ @@ -89,6 +96,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/firebase/firebase-ios-sdk", from: firebase_sdk_version), + .package(url: "https://github.com/firebase/flutterfire", exact: shared_spm_version), ], targets: [ .target( @@ -96,13 +104,21 @@ let package = Package( dependencies: [ // No product for firebase-core so we pull in the smallest one .product(name: "FirebaseInstallations", package: "firebase-ios-sdk"), + .product(name: "firebase-core-shared", package: "flutterfire"), + ], + exclude: [ + // These are now pulled in as a remote dependency from FlutterFire repo + "FLTFirebasePlugin.m", + "FLTFirebasePluginRegistry.m", + "include/firebase_core/FLTFirebasePlugin.h", + "include/firebase_core/FLTFirebasePluginRegistry.h", ], resources: [ .process("Resources"), ], cSettings: [ .headerSearchPath("include/firebase_core"), - .define("LIBRARY_VERSION", to: "\"\(library_version)\""), + .define("LIBRARY_VERSION", to: "\"\(library_version_string)\""), .define("LIBRARY_NAME", to: "\"flutter-fire-core\""), ] ), diff --git a/scripts/generate_ios_sdk_version_txt_spm.dart b/scripts/generate_ios_sdk_version_txt_spm.dart new file mode 100644 index 000000000000..9dd55bdde5f5 --- /dev/null +++ b/scripts/generate_ios_sdk_version_txt_spm.dart @@ -0,0 +1,71 @@ +// Copyright 2024 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:melos/melos.dart' as melos; +import 'package:glob/glob.dart'; +import 'dart:io'; +import 'package:cli_util/cli_logging.dart' as logging; + +// Used to generate a simple txt file for Package.swift file to parse in order to use correct firebase-ios-sdk version + +void main(List args) async { + final workspace = await getMelosWorkspace(); + // get version from core + final firebaseCorePackage = workspace.filteredPackages.values + .firstWhere((package) => package.name == 'firebase_core'); + + final firebaseCoreIosVersionFile = File( + '${firebaseCorePackage.path}/ios/firebase_sdk_version.rb', + ); + + final firebaseiOSVersion = getFirebaseiOSVersion(firebaseCoreIosVersionFile); + + for (final package in workspace.filteredPackages.values) { + final packageSwiftFile = + File('${package.path}/ios/${package.name}/Package.swift'); + + // only want to write this for plugins that support Swift + // ignore core as it already has canonical firebase_sdk_version.rb + if (packageSwiftFile.existsSync() && package.name != 'firebase_core') { + final versionFile = + File('${package.path}/ios/generated_firebase_sdk_version.txt'); + versionFile.writeAsStringSync(firebaseiOSVersion); + } + } +} + +Future getMelosWorkspace() async { + final packageFilters = melos.PackageFilters( + includePrivatePackages: false, + ignore: [ + Glob('*web*'), + Glob('*platform*'), + Glob('*internals*'), + ], + ); + final workspace = await melos.MelosWorkspace.fromConfig( + await melos.MelosWorkspaceConfig.fromWorkspaceRoot(Directory.current), + logger: melos.MelosLogger(logging.Logger.standard()), + packageFilters: packageFilters, + ); + + return workspace; +} + +String getFirebaseiOSVersion(File firebaseCoreIosSdkVersion) { + if (firebaseCoreIosSdkVersion.existsSync()) { + final content = firebaseCoreIosSdkVersion.readAsStringSync(); + final versionMatch = RegExp(r"'(\d+\.\d+\.\d+)'").firstMatch(content); + + if (versionMatch != null && versionMatch.group(1) != null) { + return versionMatch.group(1)!; + } else { + throw Exception( + 'Firebase iOS SDK version not found in firebase_sdk_version.rb.', + ); + } + } else { + throw Exception('firebase_sdk_version.rb file does not exist.'); + } +}