diff --git a/.cirrus.yml b/.cirrus.yml index 02c7551b3500..0caa1a226807 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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 diff --git a/packages/camera/CHANGELOG.md b/packages/camera/CHANGELOG.md index b6c68aa7cf9f..c32ef103ae1c 100644 --- a/packages/camera/CHANGELOG.md +++ b/packages/camera/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.5 + +* Define clang modules for iOS. + ## 0.5.4+3 * Update and migrate iOS example project. diff --git a/packages/camera/ios/Tests/CameraPluginTests.m b/packages/camera/ios/Tests/CameraPluginTests.m new file mode 100644 index 000000000000..e5be3980bad0 --- /dev/null +++ b/packages/camera/ios/Tests/CameraPluginTests.m @@ -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 diff --git a/packages/camera/ios/camera.podspec b/packages/camera/ios/camera.podspec index 0db7485005ed..dfe566ca79cc 100644 --- a/packages/camera/ios/camera.podspec +++ b/packages/camera/ios/camera.podspec @@ -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 diff --git a/packages/camera/pubspec.yaml b/packages/camera/pubspec.yaml index 9640da5ff166..9ed9b55203f0 100644 --- a/packages/camera/pubspec.yaml +++ b/packages/camera/pubspec.yaml @@ -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 diff --git a/script/build_all_plugins_app.sh b/script/build_all_plugins_app.sh index dcf3bcdfd2a3..6b70ee00e9b1 100755 --- a/script/build_all_plugins_app.sh +++ b/script/build_all_plugins_app.sh @@ -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)" +readonly REPO_DIR="$(dirname "$SCRIPT_DIR")" source "$SCRIPT_DIR/common.sh" check_changed_packages > /dev/null diff --git a/script/check_publish.sh b/script/check_publish.sh index 39a6894cf5fa..05a237ee97ee 100755 --- a/script/check_publish.sh +++ b/script/check_publish.sh @@ -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" diff --git a/script/incremental_build.sh b/script/incremental_build.sh index adb0acc72b97..0e0fb051e70c 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -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" diff --git a/script/lint_darwin_plugins.sh b/script/lint_darwin_plugins.sh new file mode 100755 index 000000000000..5e5d018c391c --- /dev/null +++ b/script/lint_darwin_plugins.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +# 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