-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(firestore): Swift Package Manager support #13329
Merged
Merged
Changes from all commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
d70a20b
chore(firestore): initial SPM move
russellwheatley 047bf04
chore: initial macOS SPM
russellwheatley af7ef51
ios updates
russellwheatley 5871bf5
ios pigeon
russellwheatley 570d760
update imports
russellwheatley 1029482
ios podspec working
russellwheatley 19b3dad
update package.swift
russellwheatley 4130346
hide .build config
russellwheatley 42f7f15
try package.swift in root of repo
russellwheatley 3354b03
push latest package.swift
russellwheatley 53aec13
rm: package.swift file for experiment
russellwheatley e65a2f8
update point to Sources
russellwheatley a6651c9
url firestore
russellwheatley f6587d6
update package.swift root
russellwheatley a5615ae
update
russellwheatley 8cacdac
ignore build files
russellwheatley eac1404
fix: reinsert package.swift core and fix path to core from firestore
russellwheatley a7cfe90
fix: imports for Swift integration are correct
russellwheatley f91c6e2
Merge branch 'main' into spm-firestore
russellwheatley 0c5b666
test: see if I can source firebase core from remote
russellwheatley c59875d
cloud firestore example test
russellwheatley 980770e
reinsert package.swift file for firebase core
russellwheatley fa94b1a
try using publicHeadersPath
russellwheatley 5fa6cd9
further tweaks to test
russellwheatley 71180b3
try without headerSearchPath
russellwheatley 0436baf
change
russellwheatley 7528a42
fix: firestore working
russellwheatley 18ad50d
fix: add dummy remote firebase core source
russellwheatley 48156bc
wrapper method that causes duplicate symbols
russellwheatley d83fd50
rm podfile from example
russellwheatley eee275f
working version of firestore and core
russellwheatley 418065e
fix: import of core header files
russellwheatley 75ef674
fix: headers for cocopod builds
russellwheatley 4599687
fix: header files for swift or cocoapods
russellwheatley baa4510
spm core generate tag script
russellwheatley b43893c
rm dummy file
russellwheatley fb60fc9
symlink files for swift firebase core
russellwheatley d6d6fce
update the package.swift in root of project
russellwheatley 636d1fc
update package.swift files to point to flutterfire repo
russellwheatley b59e17c
reinsert Podfile for firestore
russellwheatley be0d164
update branch ahead of main merge
russellwheatley 2b09f9f
Merge branch 'main' into spm-firestore
russellwheatley d5cfa4a
fix: import headers for shared iOS
russellwheatley 863744f
chore: rm dead code
russellwheatley d71500e
update Package.swifts to get versions
russellwheatley b3bdb32
tests: swift integration for core & firestore
russellwheatley 727754d
format
russellwheatley f7bf67e
test: fix tests
russellwheatley e4df845
fix: symlinks to macOS
russellwheatley 86e83d5
public symlinks
russellwheatley 2247b23
chore: update symlinks for macOS
russellwheatley cbf4869
firestore macos packag.swift file
russellwheatley fff70c9
update core macos package.swift
russellwheatley b9ed5b7
fix: firestore macOS headers
russellwheatley da92423
license header
russellwheatley af70d95
debug swift integration
russellwheatley 30c398f
add colon
russellwheatley c301949
tests: fix swift integration
russellwheatley 4469aee
test: code sign for ios only
russellwheatley e18c11a
update macOS podspec
russellwheatley c59fbf7
deleted symlink
russellwheatley 48b72f6
gitkeep
russellwheatley 2135f99
test: update swift integration code
russellwheatley 403e3b8
test swift
russellwheatley 6b44ed9
macos build
russellwheatley a5e559e
rm macOS swift builds
russellwheatley ccbfadb
increase timeout
russellwheatley 7366c6c
swift integration time increase
russellwheatley 6d5f9b6
rm unneeded property in pubspec
russellwheatley 728650f
Merge branch 'main' into spm-firestore
russellwheatley df03b5d
Merge branch 'main' into spm-firestore
russellwheatley 89ab888
chore: every plugin with Swift needs access to firebase-ios-sdk version
russellwheatley 035ca20
chore: pull version only from cloud_firestore plugin
russellwheatley 8845393
license header
russellwheatley 960a303
hard code version
russellwheatley cb32fba
revert
russellwheatley a39cc57
remove caret from version
russellwheatley e68f3bd
format
russellwheatley ad688cb
Merge branch 'main' into spm-firestore
russellwheatley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<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'); | ||
} | ||
} | ||
|
||
Future<void> 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<ProcessResult> _runCommand( | ||
String command, List<String> 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, '', ''); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we need to do the other packages? Or is it just because cloud_firestore has its own SPM package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's just for the packages which have Swift support; core + firestore.