Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/futureware-tech/si…
Browse files Browse the repository at this point in the history
…mulator-action-bde6805eedaeaba7775a9959970edc7d8bf10c4d
  • Loading branch information
russellwheatley authored Dec 11, 2024
2 parents f2438d5 + b083217 commit 034e4bd
Show file tree
Hide file tree
Showing 471 changed files with 5,168 additions and 2,163 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/all_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,28 @@ jobs:
"flutter build web"
swift-integration:
runs-on: macos-latest
timeout-minutes: 40
timeout-minutes: 30
env:
FLUTTER_DEPENDENCIES: "cloud_firestore firebase_remote_config cloud_functions firebase_database firebase_auth firebase_storage firebase_analytics firebase_messaging firebase_app_check firebase_in_app_messaging firebase_performance firebase_dynamic_links firebase_crashlytics firebase_ml_model_downloader"
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
# TODO - enabling swift is on `master` channel at the moment. Update when it's on `stable`
channel: 'master'
- name: Setup firebase_core example app to test Swift integration
# run this before running melos boostrap to ensure the example app is set up
run: |
cd packages/firebase_core/firebase_core/example
flutter pub add $FLUTTER_DEPENDENCIES
cd ../../../..
- uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa
with:
melos-version: '5.3.0'
- name: 'Swift Integration Setup'
run: flutter config --enable-swift-package-manager
- name: 'Build Apps with Swift Package Manager'
run: dart ./.github/workflows/scripts/swift-integration.dart
run: dart ./.github/workflows/scripts/swift-integration.dart $FLUTTER_DEPENDENCIES

test:
runs-on: ubuntu-latest
Expand Down
50 changes: 15 additions & 35 deletions .github/workflows/scripts/swift-integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,31 @@
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');
await buildSwiftExampleApp('ios', 'firebase_remote_config');
await buildSwiftExampleApp('macos', 'firebase_remote_config');
await buildSwiftExampleApp('ios', 'cloud_functions');
await buildSwiftExampleApp('macos', 'cloud_functions');
}

Future<void> 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');
void main(List<String> arguments) async {
if (arguments.isEmpty) {
throw Exception('No FlutterFire dependency arguments provided.');
}
final plugins = arguments.join(',');
await buildSwiftExampleApp('ios', plugins);
await buildSwiftExampleApp('macos', plugins);
}

Future<void> buildSwiftExampleApp(String platform, String plugin) async {
Future<void> buildSwiftExampleApp(String platform, String plugins) async {
final initialDirectory = Directory.current;
final platformName = platform == 'ios' ? 'iOS' : 'macOS';

print('Building $plugin $platformName example app with swift (SPM)');
print('Building example app with swift (SPM) integration for $plugins');

final directory = Directory('packages/$plugin/$plugin/example/$platform');
final directory =
Directory('packages/firebase_core/firebase_core/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-Release.xcconfig');
}
// Change to the appropriate directory
Directory.current = directory;

// Remove Podfile and deintegrate pods
await _runCommand('rm', ['Podfile']);
await _runCommand('pod', ['deintegrate']);

Expand All @@ -78,7 +54,11 @@ Future<void> buildSwiftExampleApp(String platform, String plugin) async {
exit(1);
} else {
print(
'Successfully built $plugin $platformName project using Swift Package Manager.');
'Successfully built $plugins for $platformName project using Swift Package Manager.');

Directory.current = Directory('..');
print('See contents of pubspec.yaml:');
await _runCommand('cat', ['pubspec.yaml']);
}

Directory.current = initialDirectory;
Expand Down
216 changes: 216 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import Foundation
import PackageDescription

// auto-generated by melos post commit hook script
let firebase_core_version: String = "3.8.1"
let firebase_ios_sdk_version: String = "11.4.0"

// Shared Swift package manager code for firebase core
let package = Package(
name: "remote_firebase_core",
Expand All @@ -21,7 +25,10 @@ let package = Package(
dependencies: [
// TODO: this is fine for now, but will require a way of retrieving the firebase-ios-sdk
// likely create a script that runs in preCommit hook of melos
.package(url: "https://github.com/firebase/firebase-ios-sdk", from: "11.0.0"),
.package(
url: "https://github.com/firebase/firebase-ios-sdk",
from: Version(firebase_ios_sdk_version)!
),
],
targets: [
.target(
Expand All @@ -30,7 +37,12 @@ let package = Package(
.product(name: "FirebaseInstallations", package: "firebase-ios-sdk"),
],
path: "Sources/firebase_core_shared",
publicHeadersPath: "include"
publicHeadersPath: "include",
cSettings: [
.headerSearchPath("include/firebase_core"),
.define("LIBRARY_VERSION", to: "\"\(firebase_core_version)\""),
.define("LIBRARY_NAME", to: "\"flutter-fire-core\""),
]
),
]
)
1 change: 1 addition & 0 deletions Sources/firebase_core_shared/FLTFirebaseCorePlugin.m
1 change: 1 addition & 0 deletions Sources/firebase_core_shared/include/messages.g.h
1 change: 1 addition & 0 deletions Sources/firebase_core_shared/messages.g.m
39 changes: 39 additions & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,45 @@ This document is listing all the compatible versions of the FlutterFire plugins.

# Versions

## [Flutter BoM 3.3.0 (2024-12-04)](https://github.com/firebase/flutterfire/blob/main/CHANGELOG.md#2024-12-04)

Install this version using FlutterFire CLI

```bash
flutterfire install 3.3.0
```

### Included Native Firebase SDK Versions
| Firebase SDK | Version | Link |
|--------------|---------|------|
| Android SDK | 33.5.1 | [Release Notes](https://firebase.google.com/support/release-notes/android) |
| iOS SDK | 11.4.0 | [Release Notes](https://firebase.google.com/support/release-notes/ios) |
| Web SDK | 10.11.1 | [Release Notes](https://firebase.google.com/support/release-notes/js) |
| Windows SDK | 12.0.0 | [Release Notes](https://firebase.google.com/support/release-notes/cpp-relnotes) |

### FlutterFire Plugin Versions
| Plugin | Version | Dart Version | Flutter Version |
|--------|---------|--------------|-----------------|
| [cloud_firestore](https://pub.dev/packages/cloud_firestore/versions/5.5.1) | 5.5.1 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [cloud_functions](https://pub.dev/packages/cloud_functions/versions/5.2.0) | 5.2.0 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_analytics](https://pub.dev/packages/firebase_analytics/versions/11.3.6) | 11.3.6 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_app_check](https://pub.dev/packages/firebase_app_check/versions/0.3.1+7) | 0.3.1+7 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_app_installations](https://pub.dev/packages/firebase_app_installations/versions/0.3.1+7) | 0.3.1+7 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_auth](https://pub.dev/packages/firebase_auth/versions/5.3.4) | 5.3.4 | >=3.2.0 <4.0.0 | >=3.16.0 |
| [firebase_core](https://pub.dev/packages/firebase_core/versions/3.8.1) | 3.8.1 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_crashlytics](https://pub.dev/packages/firebase_crashlytics/versions/4.2.0) | 4.2.0 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_data_connect](https://pub.dev/packages/firebase_data_connect/versions/0.1.2+5) | 0.1.2+5 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_database](https://pub.dev/packages/firebase_database/versions/11.2.0) | 11.2.0 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_dynamic_links](https://pub.dev/packages/firebase_dynamic_links/versions/6.0.11) | 6.0.11 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_in_app_messaging](https://pub.dev/packages/firebase_in_app_messaging/versions/0.8.0+11) | 0.8.0+11 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_messaging](https://pub.dev/packages/firebase_messaging/versions/15.1.6) | 15.1.6 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_ml_model_downloader](https://pub.dev/packages/firebase_ml_model_downloader/versions/0.3.1+6) | 0.3.1+6 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_performance](https://pub.dev/packages/firebase_performance/versions/0.10.0+11) | 0.10.0+11 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_remote_config](https://pub.dev/packages/firebase_remote_config/versions/5.2.0) | 5.2.0 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_storage](https://pub.dev/packages/firebase_storage/versions/12.3.7) | 12.3.7 | >=3.2.0 <4.0.0 | >=3.3.0 |
| [firebase_vertexai](https://pub.dev/packages/firebase_vertexai/versions/1.0.4) | 1.0.4 | >=3.2.0 <4.0.0 | >=3.16.0 |


## [Flutter BoM 3.2.1 (2024-11-22)](https://github.com/firebase/flutterfire/blob/main/CHANGELOG.md#2024-11-22)

Install this version using FlutterFire CLI
Expand Down
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +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.dart && \
dart run scripts/generate_versions_spm.dart && \
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: |
Expand Down
4 changes: 4 additions & 0 deletions packages/_flutterfire_internals/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.47

- Update a dependency to the latest release.

## 1.3.46

- Update a dependency to the latest release.
Expand Down
6 changes: 3 additions & 3 deletions packages/_flutterfire_internals/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: _flutterfire_internals
description: A package hosting Dart code shared between FlutterFire plugins.
homepage: https://firebase.google.com/docs/firestore
repository: https://github.com/firebase/flutterfire/tree/main/packages/_flutterfire_internals
version: 1.3.46
version: 1.3.47

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'

dependencies:
collection: ^1.0.0
firebase_core: ^3.8.0
firebase_core_platform_interface: ^5.3.0
firebase_core: ^3.8.1
firebase_core_platform_interface: ^5.3.1
flutter:
sdk: flutter
meta: ^1.8.0
Expand Down
5 changes: 5 additions & 0 deletions packages/cloud_firestore/cloud_firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 5.5.1

- **FIX**(firestore,android): synchronize access to firestore instances ([#16675](https://github.com/firebase/flutterfire/issues/16675)). ([03e85ae6](https://github.com/firebase/flutterfire/commit/03e85ae63ece0924d376b98e35e8a73670b59fa8))
- **FIX**(firebase_core_platform_interface): move test APIs to test.dart ([#16672](https://github.com/firebase/flutterfire/issues/16672)). ([f618a3d8](https://github.com/firebase/flutterfire/commit/f618a3d8f9284f802dbf86526b0ea9a226ccf130))

## 5.5.0

- **FEAT**(firestore): Swift Package Manager support ([#13329](https://github.com/firebase/flutterfire/issues/13329)). ([0420eabb](https://github.com/firebase/flutterfire/commit/0420eabb3ab247e0e3998bedcb9779fe35c46920))
Expand Down
26 changes: 9 additions & 17 deletions packages/cloud_firestore/cloud_firestore/dartpad/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,15 @@ enum MovieQuery {
extension on Query<Movie> {
/// Create a firebase query from a [MovieQuery]
Query<Movie> queryBy(MovieQuery query) {
switch (query) {
case MovieQuery.fantasy:
return where('genre', arrayContainsAny: ['Fantasy']);

case MovieQuery.sciFi:
return where('genre', arrayContainsAny: ['Sci-Fi']);

case MovieQuery.likesAsc:
case MovieQuery.likesDesc:
return orderBy('likes', descending: query == MovieQuery.likesDesc);

case MovieQuery.year:
return orderBy('year', descending: true);

case MovieQuery.score:
return orderBy('score', descending: true);
}
return switch (query) {
MovieQuery.fantasy => where('genre', arrayContainsAny: ['Fantasy']),
MovieQuery.sciFi => where('genre', arrayContainsAny: ['Sci-Fi']),
MovieQuery.likesAsc ||
MovieQuery.likesDesc =>
orderBy('likes', descending: query == MovieQuery.likesDesc),
MovieQuery.year => orderBy('year', descending: true),
MovieQuery.score => orderBy('score', descending: true)
};
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,19 @@ class DefaultFirebaseOptions {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
return macos;
case TargetPlatform.windows:
return android;
case TargetPlatform.linux:
throw UnsupportedError(
return switch (defaultTargetPlatform) {
TargetPlatform.android => android,
TargetPlatform.iOS => ios,
TargetPlatform.macOS => macos,
TargetPlatform.windows => android,
TargetPlatform.linux => throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
),
_ => throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
)
};
}

static const FirebaseOptions web = FirebaseOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@ class DefaultFirebaseOptions {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
return macos;
case TargetPlatform.windows:
return android;
default:
throw UnsupportedError(
return switch (defaultTargetPlatform) {
TargetPlatform.android => android,
TargetPlatform.iOS => ios,
TargetPlatform.macOS => macos,
TargetPlatform.windows => android,
_ => throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
)
};
}

static const FirebaseOptions web = FirebaseOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,19 @@ class DefaultFirebaseOptions {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
return macos;
case TargetPlatform.windows:
return android;
case TargetPlatform.linux:
throw UnsupportedError(
return switch (defaultTargetPlatform) {
TargetPlatform.android => android,
TargetPlatform.iOS => ios,
TargetPlatform.macOS => macos,
TargetPlatform.windows => android,
TargetPlatform.linux => throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
),
_ => throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
)
};
}

static const FirebaseOptions web = FirebaseOptions(
Expand Down
Loading

0 comments on commit 034e4bd

Please sign in to comment.