Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully adds Swift Package Manager support to the patrol package. The changes involve restructuring the darwin source files to follow SPM conventions, creating a Package.swift file, and updating the example project to use the Swift package instead of CocoaPods for patrol. The file organization and configuration changes are well-executed. I have one suggestion for improving the robustness of the Package.swift script.
| let xcodeDevDir: String = { | ||
| let task = Process() | ||
| task.executableURL = URL(fileURLWithPath: "/usr/bin/xcode-select") | ||
| task.arguments = ["-p"] | ||
| let pipe = Pipe() | ||
| task.standardOutput = pipe | ||
| try? task.run() | ||
| task.waitUntilExit() | ||
| let data = pipe.fileHandleForReading.readDataToEndOfFile() | ||
| return String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) | ||
| ?? "/Applications/Xcode.app/Contents/Developer" | ||
| }() |
There was a problem hiding this comment.
The current implementation to get the Xcode developer directory uses try?, which silently ignores any errors from the xcode-select -p command. If the command fails (e.g., command line tools are not installed or configured), it will fall back to a default path which might be incorrect, potentially leading to hard-to-debug build failures. It would be more robust to handle potential errors explicitly using a do-catch block and also check if the returned path is empty.
let xcodeDevDir: String = {
let task = Process()
task.executableURL = URL(fileURLWithPath: "/usr/bin/xcode-select")
task.arguments = ["-p"]
let pipe = Pipe()
task.standardOutput = pipe
do {
try task.run()
task.waitUntilExit()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
if let path = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines), !path.isEmpty {
return path
}
} catch {
// `xcode-select` is not available or failed, fall back to the default path.
}
return "/Applications/Xcode.app/Contents/Developer"
}()
🚀 Preview Deployment Ready!Preview URL: https://pr-2976-patrol-docs.vercel.app Latest Deployment
This preview URL is stable and will be updated with each new commit to this PR. |
Summary
Package.swiftmanifest for the Patrol plugin, enabling Flutter's native SPM integration asan alternative to CocoaPods
Sources/patrol/,Sources/HTTPParserC/), since SPM doesn't support mixing C and Swift, while maintaining CocoaPods compatibility by updating podspec pathsplugin builds correctly under SPM without hard-coded paths
FlutterGeneratedPluginSwiftPackageand addHEADER_SEARCH_PATHSfor the patrol ObjC headersdevandprodschemesRunnerUITests.mwith a conditional#importfallback for thePATROL_INTEGRATION_TEST_IOS_RUNNERmacroDetails
The plugin now supports both CocoaPods and SPM side-by-side:
patrol.podspecupdated to point at the new source locations underpatrol/Sources/Package.swiftdefines two targets (HTTPParserCfor the C HTTP parser,patrolfor all Swift sources) withCocoaAsyncSocketas an external dependencyimport Foundation.build/directories