-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camera] Define clang modules in for iOS #2115
Conversation
Here's the first run: |
| @@ -0,0 +1,88 @@ | |||
| #!/bin/bash | |||
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.
Is there a reason this script can't be Dart? It seems like anything non-trivial should be Dart if it all possible, as it's easier to maintain.
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.
All the Cirrus tests are run from shell scripts, and this was closely cribbed from check_publish.sh. I will defer to the plugins team as to whatever they find most maintainable (I'd prefer to not to be the sole owner of this effort).
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.
I'm fine deferring final decision to the plugins team. I would strongly encourage them to view adding a new non-trivial script as a good opportunity to begin a transition to Dart though :)
(Also worth considering is that at some point we're going to have Windows plugins in this repo, and probably will want to run scripts for them, and I cannot stress enough how much we want to those scripts to be in Dart rather than Batch.)
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.
So it's kind of scattered. A lot of our CI scripts start off in bash here, but then ultimately end up deferred to a completely separate Dart tool maintained in the flutter/plugin_tools repo. It's kind of hard to follow but the flow is that CI calls a bash script, and the bash script downloads and runs random commands from that repo by calling the package via flutter_plugin_tools, see these lines.
I think it probably makes the most sense for this functionality to live as a command in that tool instead of in bash given how much is going on here. The meat of this is easier to do in shell since it needs to run pod lint, but I'm pretty sure that repo does expose process run commands that could be called instead. That said the bash is relatively straightforward here so I wouldn't block the PR on moving it either, I don't think maintaining it in this form would be a huge burden.
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.
I created flutter/flutter#41511 and assigned it to myself. I'll work on it once I convert a few more plugins to modules and get the plugin template done in flutter tools.
script/lint_darwin_plugins.sh
Outdated
| function lint_package() { | ||
| local package_name=$1 | ||
| local platform=$2 | ||
| local podspec_dir="$REPO_DIR/packages/$package_name/$platform/$package_name.podspec" |
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.
This structure is about to start changing, per https://docs.google.com/document/d/1PeS-QSAFydHXhjZrqkub-GRPMs83roh8VwhbUScWuGQ/edit#
It would be good to support the new structure as well (the plan is option 1, as I understand it) from the start so we don't accidentally start losing coverage as plugins migrate.
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.
I changed it to find all podspecs in each top-level package directory.
| # So that users can run this script from anywhere and it will work as expected. | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)" | ||
| REPO_DIR="$(dirname "$SCRIPT_DIR")" | ||
| readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)" |
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.
Neat, I didn't know bash had this.
| @@ -0,0 +1,88 @@ | |||
| #!/bin/bash | |||
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.
So it's kind of scattered. A lot of our CI scripts start off in bash here, but then ultimately end up deferred to a completely separate Dart tool maintained in the flutter/plugin_tools repo. It's kind of hard to follow but the flow is that CI calls a bash script, and the bash script downloads and runs random commands from that repo by calling the package via flutter_plugin_tools, see these lines.
I think it probably makes the most sense for this functionality to live as a command in that tool instead of in bash given how much is going on here. The meat of this is easier to do in shell since it needs to run pod lint, but I'm pretty sure that repo does expose process run commands that could be called instead. That said the bash is relatively straightforward here so I wouldn't block the PR on moving it either, I don't think maintaining it in this form would be a huge burden.
mklim
left a comment
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.
LGTM
script/lint_darwin_plugins.sh
Outdated
| # Build as frameworks. | ||
| # This will also run any tests set up as a test_spec. See https://blog.cocoapods.org/CocoaPods-1.3.0. | ||
| pod lib lint "$podspec_dir" --allow-warnings --fail-fast --silent | ||
| if [[ $? -ne 0 ]]; then |
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.
nit: Please quote the variables here and throughout.
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.
Thanks, I forgot to check that. Hopefully I got them all.
- Limit the supported podspec platform to iOS so tests don't run (and fail) for macOS. - Define the module by setting `DEFINES_MODULE` in the podspec. See [CocoaPod modular headers docs](http://blog.cocoapods.org/CocoaPods-1.5.0/). - Explicitly set `VALID_ARCHS` to architectures included in the Flutter universal binary. This is the CocoaPods-suggested workaround to prevent tests from running on the i386 simulator. See CocoaPods/CocoaPods#8159.
- Limit the supported podspec platform to iOS so tests don't run (and fail) for macOS. - Define the module by setting `DEFINES_MODULE` in the podspec. See [CocoaPod modular headers docs](http://blog.cocoapods.org/CocoaPods-1.5.0/). - Explicitly set `VALID_ARCHS` to architectures included in the Flutter universal binary. This is the CocoaPods-suggested workaround to prevent tests from running on the i386 simulator. See CocoaPods/CocoaPods#8159.
- Limit the supported podspec platform to iOS so tests don't run (and fail) for macOS. - Define the module by setting `DEFINES_MODULE` in the podspec. See [CocoaPod modular headers docs](http://blog.cocoapods.org/CocoaPods-1.5.0/). - Explicitly set `VALID_ARCHS` to architectures included in the Flutter universal binary. This is the CocoaPods-suggested workaround to prevent tests from running on the i386 simulator. See CocoaPods/CocoaPods#8159.
Description
DEFINES_MODULEin the podspec. See CocoaPod modular headers docs.VALID_ARCHSto architectures included in the Flutter universal binary. This is the CocoaPods-suggested workaround to prevent tests from running on the i386 simulator. See Fix linting when armv7 is included but i386 isn't CocoaPods/CocoaPods#8159.Related Issues
Fixes flutter/flutter#41439.
See also flutter/flutter#41007.
Tests
s.platformands.pod_target_xcconfigchanges.pod lib lint.Checklist
///).flutter analyze) does not report any problems on my PR.Breaking Change