Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@jmagman
Copy link
Member

@jmagman jmagman commented Sep 27, 2019

Description

Related Issues

Fixes flutter/flutter#41439.
See also flutter/flutter#41007.

Tests

  • Add a test_spec to the podspec so the CocoaPods linter will test them. These tests fail before the s.platform and s.pod_target_xcconfig changes.
  • Add Cirrus script to lint and test plugins with iOS platform code. This uses CocoaPods's built-in test_specs and lints and tests via pod lib lint.
  • Exclude every iOS plugin except for camera from this script until they can be migrated. Linter errors/warnings for all plugins:
find . -name "*\.podspec" -exec pod lib lint {} --analyze --verbose  \;

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See [Contributor Guide]).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the [Flutter Style Guide].
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy].
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the [CLA].
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@jmagman jmagman self-assigned this Sep 27, 2019
@jmagman
Copy link
Member Author

jmagman commented Sep 27, 2019

  • Add Cirrus script to lint and test plugins with iOS platform code. This uses CocoaPods's built-in test_specs and lints and tests via pod lib lint.

Here's the first run:
https://cirrus-ci.com/task/5308706226438144?command=main#L5

@jmagman jmagman changed the title WIP [camera] Define clang modules in for iOS [camera] Define clang modules in for iOS Sep 27, 2019
@jmagman jmagman marked this pull request as ready for review September 27, 2019 02:46
@@ -0,0 +1,88 @@
#!/bin/bash
Copy link
Contributor

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.

Copy link
Member Author

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).

Copy link
Contributor

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.)

Copy link
Contributor

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.

Copy link
Member Author

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.

function lint_package() {
local package_name=$1
local platform=$2
local podspec_dir="$REPO_DIR/packages/$package_name/$platform/$package_name.podspec"
Copy link
Contributor

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.

Copy link
Member Author

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)"
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

@mklim mklim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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.

@mklim mklim merged commit 15b8029 into flutter:master Sep 30, 2019
@jmagman jmagman deleted the module-camera branch September 30, 2019 19:24
mormih pushed a commit to mormih/plugins that referenced this pull request Nov 17, 2019
- 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.
sungmin-park pushed a commit to sungmin-park/flutter-plugins that referenced this pull request Dec 17, 2019
- 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.
Akachu pushed a commit to Akachu/flutter_camera that referenced this pull request Apr 27, 2020
- 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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[camera] Define clang modules plugin for iOS

4 participants