From da4937867ee261f3c79452645fbecd19f75622e3 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Tue, 26 Nov 2019 16:19:52 -0800 Subject: [PATCH 1/5] Lint all podspecs on every PR and commit, convert to dart script --- .cirrus.yml | 4 +- script/lint_darwin_plugins.sh | 88 ----------------------------------- 2 files changed, 2 insertions(+), 90 deletions(-) delete mode 100755 script/lint_darwin_plugins.sh diff --git a/.cirrus.yml b/.cirrus.yml index 753bc90911ae..4c39c2140cdc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -122,8 +122,8 @@ task: - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh ios --no-codesign - - name: lint_darwin_plugins - script: ./script/lint_darwin_plugins.sh + - name: lint_podspecs + script: dart ./script/lint_podspecs.dart - name: build-ipas+drive-examples env: PATH: $PATH:/usr/local/bin diff --git a/script/lint_darwin_plugins.sh b/script/lint_darwin_plugins.sh deleted file mode 100755 index 7e749707128c..000000000000 --- a/script/lint_darwin_plugins.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/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 - - # These podspecs are temporary multi-platform adoption dummy files. - local skipped_podspecs=( - "url_launcher_web.podspec" - "google_sign_in_web.podspec" - ) - - # TODO: These packages have analyzer warnings. Remove plugins from this list as issues are fixed. - local skip_analysis_packages=( - "camera.podspec" # https://github.com/flutter/flutter/issues/42673 - ) - find "${package_dir}" -type f -name "*\.podspec" | while read podspec; do - local podspecBasename=$(basename "${podspec}") - if [[ "${skipped_podspecs[*]}" =~ "${podspecBasename}" ]]; then - continue - fi - - # TODO: Remove --allow-warnings flag https://github.com/flutter/flutter/issues/41444 - local lint_args=( - lib - lint - "${podspec}" - --allow-warnings - --fail-fast - --silent - ) - if [[ ! "${skip_analysis_packages[*]}" =~ "${podspecBasename}" ]]; then - lint_args+=(--analyze) - echo "Linting and analyzing ${podspecBasename}" - else - echo "Linting ${podspecBasename}" - fi - - # 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 "${lint_args[@]}" - if [[ "$?" -ne 0 ]]; then - error "Package ${package_name} has framework issues. Run \"pod lib lint ${podspec} --analyze\" to inspect." - failure_count+=1 - fi - - # Build as libraries. - lint_args+=(--use-libraries) - pod "${lint_args[@]}" - if [[ "$?" -ne 0 ]]; then - error "Package ${package_name} has library issues. Run \"pod lib lint ${podspec} --use-libraries --analyze\" to inspect." - failure_count+=1 - fi - done - - return "${failure_count}" -} - -function lint_packages() { - if [[ ! "$(which pod)" ]]; then - echo "pod not installed. Skipping." - return - fi - - local failure_count=0 - for package_name in "$@"; do - 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 From c2159076b519671122fc0ea001eb57cd269a5b09 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 17 Apr 2020 15:11:09 -0700 Subject: [PATCH 2/5] Rebase --- .cirrus.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 4c39c2140cdc..fca3e2de8601 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -122,8 +122,13 @@ task: - if [[ "$CHANNEL" -eq "stable" ]]; then find . | grep _web$ | xargs rm -rf; fi - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh ios --no-codesign - - name: lint_podspecs - script: dart ./script/lint_podspecs.dart + - name: lint_darwin_plugins + script: + # TODO(jmagman): Lint macOS podspecs but skip any that fail library validation. + - find . -name "*.podspec" | xargs grep -l "osx" | xargs rm + # Skip the dummy podspecs used to placate the tool. + - find . -name "*_web*.podspec" -o -name "*_mac*.podspec" | xargs rm + - ./script/incremental_build.sh podspecs --no-analyze camera --skip google_sign_in --skip webview_flutter - name: build-ipas+drive-examples env: PATH: $PATH:/usr/local/bin @@ -162,8 +167,6 @@ task: script: - flutter channel master - ./script/build_all_plugins_app.sh macos - - name: lint_darwin_plugins - script: ./script/lint_darwin_plugins.sh - name: build-apps+drive-examples env: PATH: $PATH:/usr/local/bin From c495513ec6286abe690b1a3f8304455dbe88018c Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 17 Apr 2020 16:36:45 -0700 Subject: [PATCH 3/5] Add shard to lint task --- .cirrus.yml | 3 +++ script/incremental_build.sh | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index fca3e2de8601..7f3bff71464d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -123,6 +123,9 @@ task: - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh ios --no-codesign - name: lint_darwin_plugins + matrix: + PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2" + PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2" script: # TODO(jmagman): Lint macOS podspecs but skip any that fail library validation. - find . -name "*.podspec" | xargs grep -l "osx" | xargs rm diff --git a/script/incremental_build.sh b/script/incremental_build.sh index 3b0b97f0dbe6..d847f807ad77 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -29,21 +29,21 @@ elif [[ "${ACTIONS[@]}" == "analyze" ]]; then fi BRANCH_NAME="${BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"}" -if [[ "${BRANCH_NAME}" == "master" ]]; then +# if [[ "${BRANCH_NAME}" == "master" ]]; then echo "Running for all packages" (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) -else - # Sets CHANGED_PACKAGES - check_changed_packages +# else +# # Sets CHANGED_PACKAGES +# check_changed_packages - if [[ "$CHANGED_PACKAGES" == "" ]]; then - echo "No changes detected in packages." - echo "Running for all packages" - (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) - else - echo running "${ACTIONS[@]}" - (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $PLUGIN_SHARDING) - echo "Running version check for changed packages" - (cd "$REPO_DIR" && pub global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") - fi +# if [[ "$CHANGED_PACKAGES" == "" ]]; then +# echo "No changes detected in packages." +# echo "Running for all packages" +# (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) +# else +# echo running "${ACTIONS[@]}" +# (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $PLUGIN_SHARDING) +# echo "Running version check for changed packages" +# (cd "$REPO_DIR" && pub global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") +# fi fi From 24923b3c91218ab061b7b9efea6b57e3c837ab6b Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 17 Apr 2020 16:37:18 -0700 Subject: [PATCH 4/5] env --- .cirrus.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 7f3bff71464d..b2b3ca34368a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -123,9 +123,10 @@ task: - flutter channel $CHANNEL - ./script/build_all_plugins_app.sh ios --no-codesign - name: lint_darwin_plugins - matrix: - PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2" - PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2" + env: + matrix: + PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2" + PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2" script: # TODO(jmagman): Lint macOS podspecs but skip any that fail library validation. - find . -name "*.podspec" | xargs grep -l "osx" | xargs rm From 50d08afd99eeb0435643fdd40abd404933d6b080 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 17 Apr 2020 16:46:37 -0700 Subject: [PATCH 5/5] accidently checked in testing file --- script/incremental_build.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/script/incremental_build.sh b/script/incremental_build.sh index d847f807ad77..3b0b97f0dbe6 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -29,21 +29,21 @@ elif [[ "${ACTIONS[@]}" == "analyze" ]]; then fi BRANCH_NAME="${BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"}" -# if [[ "${BRANCH_NAME}" == "master" ]]; then +if [[ "${BRANCH_NAME}" == "master" ]]; then echo "Running for all packages" (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) -# else -# # Sets CHANGED_PACKAGES -# check_changed_packages +else + # Sets CHANGED_PACKAGES + check_changed_packages -# if [[ "$CHANGED_PACKAGES" == "" ]]; then -# echo "No changes detected in packages." -# echo "Running for all packages" -# (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) -# else -# echo running "${ACTIONS[@]}" -# (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $PLUGIN_SHARDING) -# echo "Running version check for changed packages" -# (cd "$REPO_DIR" && pub global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") -# fi + if [[ "$CHANGED_PACKAGES" == "" ]]; then + echo "No changes detected in packages." + echo "Running for all packages" + (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) + else + echo running "${ACTIONS[@]}" + (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $PLUGIN_SHARDING) + echo "Running version check for changed packages" + (cd "$REPO_DIR" && pub global run flutter_plugin_tools version-check --base_sha="$(get_branch_base_sha)") + fi fi