Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ task:
matrix:
- name: build_all_plugins_ipa
script: ./script/build_all_plugins_app.sh ios --no-codesign
- name: lint_darwin_plugins
script: ./script/lint_darwin_plugins.sh
- name: build-ipas+drive-examples
env:
PATH: $PATH:/usr/local/bin
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.5

* Define clang modules for iOS.

## 0.5.4+3

* Update and migrate iOS example project.
Expand Down
16 changes: 16 additions & 0 deletions packages/camera/ios/Tests/CameraPluginTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import camera;
@import XCTest;

@interface CameraPluginTests : XCTestCase
@end

@implementation CameraPluginTests

- (void)testModuleImport {
// This test will fail to compile if the module cannot be imported.
// Make sure this plugin supports modules. See https://github.com/flutter/flutter/issues/41007.
// If not already present, add this line to the podspec:
// s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
}

@end
9 changes: 6 additions & 3 deletions packages/camera/ios/camera.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ A new flutter plugin project.
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'

s.ios.deployment_target = '8.0'
end
s.platform = :ios, '8.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS' => 'armv7 arm64 x86_64' }

s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'Tests/**/*'
end
end
2 changes: 1 addition & 1 deletion packages/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera
description: A Flutter plugin for getting information about and controlling the
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
and streaming image buffers to dart.
version: 0.5.4+3
version: 0.5.5

authors:
- Flutter Team <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions script/build_all_plugins_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# sure all first party plugins can be compiled together.

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

readonly REPO_DIR="$(dirname "$SCRIPT_DIR")"

source "$SCRIPT_DIR/common.sh"
check_changed_packages > /dev/null
Expand Down
4 changes: 2 additions & 2 deletions script/check_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -e
# It doesn't actually publish anything.

# 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)"
readonly REPO_DIR="$(dirname "$SCRIPT_DIR")"

source "$SCRIPT_DIR/common.sh"

Expand Down
4 changes: 2 additions & 2 deletions script/incremental_build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -e

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)"
readonly REPO_DIR="$(dirname "$SCRIPT_DIR")"

source "$SCRIPT_DIR/common.sh"

Expand Down
87 changes: 87 additions & 0 deletions script/lint_darwin_plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/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.


# This script lints and tests iOS and macOS platform code.

# So that users can run this script from anywhere and it will work as expected.
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
readonly REPO_DIR="$(dirname "$SCRIPT_DIR")"

source "$SCRIPT_DIR/common.sh"

function lint_package() {
local package_name="$1"
local package_dir="${REPO_DIR}/packages/$package_name/"
local failure_count=0

for podspec in "$(find "${package_dir}" -name '*\.podspec')"; do
echo "Linting $package_name.podspec"

# Build as frameworks.
# This will also run any tests set up as a test_spec. See https://blog.cocoapods.org/CocoaPods-1.3.0.
# TODO: Add --analyze flag https://github.com/flutter/flutter/issues/41443
# TODO: Remove --allow-warnings flag https://github.com/flutter/flutter/issues/41444
pod lib lint "${podspec}" --allow-warnings --fail-fast --silent
if [[ "$?" -ne 0 ]]; then
error "Package ${package_name} has framework issues. Run \"pod lib lint $podspec\" to inspect."
failure_count+=1
fi

# Build as libraries.
pod lib lint "${podspec}" --allow-warnings --use-libraries --fail-fast --silent
if [[ "$?" -ne 0 ]]; then
error "Package ${package_name} has library issues. Run \"pod lib lint $podspec --use-libraries\" to inspect."
failure_count+=1
fi
done

return "${failure_count}"
}

function lint_packages() {
if [[ ! "$(which pod)" ]]; then
echo "pod not installed. Skipping."
return
fi

# TODO: These packages have linter errors. Remove plugins from this list as linter issues are fixed.
local skipped_packages=(
'android_alarm_manager'
'android_intent'
'battery'
'connectivity'
'device_info'
'google_maps_flutter'
'google_sign_in'
'image_picker'
'in_app_purchase'
'instrumentation_adapter'
'local_auth'
'package_info'
'path_provider'
'quick_actions'
'sensors'
'share'
'shared_preferences'
'url_launcher'
'video_player'
'webview_flutter'
)

local failure_count=0
for package_name in "$@"; do
if [[ "${skipped_packages[*]}" =~ "${package_name}" ]]; then
continue
fi
lint_package "${package_name}"
failure_count+="$?"
done

return "${failure_count}"
}

# Sets CHANGED_PACKAGE_LIST
check_changed_packages

if [[ "${#CHANGED_PACKAGE_LIST[@]}" != 0 ]]; then
lint_packages "${CHANGED_PACKAGE_LIST[@]}"
fi