mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
Merge pull request #1 from gspencergoog/setup_ci
Setup packages repo for CI, update analysis options, add CONTRIBUTING.md
This commit is contained in:
112
.travis.yml
Normal file
112
.travis.yml
Normal file
@ -0,0 +1,112 @@
|
||||
matrix:
|
||||
include:
|
||||
# Job 1) Run analyzer
|
||||
- os: linux
|
||||
env:
|
||||
- SHARD=Analyze
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
|
||||
packages:
|
||||
- libstdc++6
|
||||
- fonts-droid
|
||||
before_script:
|
||||
- git clone https://github.com/flutter/flutter.git
|
||||
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
|
||||
- flutter doctor
|
||||
- pub global activate flutter_plugin_tools
|
||||
script:
|
||||
- ./script/plugin_tools.sh analyze
|
||||
# Job 2) Check format and run tests
|
||||
- os: linux
|
||||
env:
|
||||
- SHARD=Format+Test
|
||||
jdk: oraclejdk8
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
|
||||
- llvm-toolchain-precise # for clang-format-5.0
|
||||
packages:
|
||||
- libstdc++6
|
||||
- fonts-droid
|
||||
before_script:
|
||||
- git clone https://github.com/flutter/flutter.git
|
||||
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
|
||||
- flutter doctor
|
||||
- pub global activate flutter_plugin_tools
|
||||
script:
|
||||
- flutter format `pwd`/packages
|
||||
- ./script/plugin_tools.sh test
|
||||
# Job 3) Build example APKs and run Java tests
|
||||
- os: linux
|
||||
env:
|
||||
- SHARD=Build-example-APKs+Java-Tests
|
||||
jdk: oraclejdk8
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
|
||||
packages:
|
||||
- lib32stdc++6 # https://github.com/flutter/flutter/issues/6207
|
||||
- libstdc++6
|
||||
- fonts-droid
|
||||
before_script:
|
||||
- wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
|
||||
- mkdir android-sdk
|
||||
- unzip -qq sdk-tools-linux-3859397.zip -d android-sdk
|
||||
- export ANDROID_HOME=`pwd`/android-sdk
|
||||
- export PATH=`pwd`/android-sdk/tools/bin:$PATH
|
||||
- mkdir -p /home/travis/.android # silence sdkmanager warning
|
||||
- echo 'count=0' > /home/travis/.android/repositories.cfg # silence sdkmanager warning
|
||||
# suppressing output of sdkmanager to keep log under 4MB (travis limit)
|
||||
- echo y | sdkmanager "tools" >/dev/null
|
||||
- echo y | sdkmanager "platform-tools" >/dev/null
|
||||
- echo y | sdkmanager "build-tools;26.0.3" >/dev/null
|
||||
- echo y | sdkmanager "platforms;android-26" >/dev/null
|
||||
- echo y | sdkmanager "extras;android;m2repository" >/dev/null
|
||||
- echo y | sdkmanager "extras;google;m2repository" >/dev/null
|
||||
- echo y | sdkmanager "patcher;v4" >/dev/null
|
||||
- sdkmanager --list
|
||||
- wget http://services.gradle.org/distributions/gradle-4.1-bin.zip
|
||||
- unzip -qq gradle-4.1-bin.zip
|
||||
- export GRADLE_HOME=$PWD/gradle-4.1
|
||||
- export PATH=$GRADLE_HOME/bin:$PATH
|
||||
- gradle -v
|
||||
- git clone https://github.com/flutter/flutter.git
|
||||
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
|
||||
- flutter doctor
|
||||
- pub global activate flutter_plugin_tools
|
||||
script:
|
||||
- ./script/plugin_tools.sh build-examples --apk
|
||||
- ./script/plugin_tools.sh java-test # must come after apk build
|
||||
# Job 4) Build example IPAs
|
||||
- os: osx
|
||||
env:
|
||||
- SHARD=Build-example-IPAs
|
||||
language: generic
|
||||
osx_image: xcode9.3
|
||||
before_script:
|
||||
- brew update
|
||||
- brew install libimobiledevice
|
||||
- brew install ideviceinstaller
|
||||
- brew install ios-deploy
|
||||
- pod repo update
|
||||
- gem update cocoapods
|
||||
- git clone https://github.com/flutter/flutter.git
|
||||
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
|
||||
- flutter doctor
|
||||
- pub global activate flutter_plugin_tools
|
||||
script:
|
||||
- ./script/plugin_tools.sh build-examples --ipa
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.pub-cache
|
92
CONTRIBUTING.md
Normal file
92
CONTRIBUTING.md
Normal file
@ -0,0 +1,92 @@
|
||||
Contributing to Flutter
|
||||
=======================
|
||||
|
||||
[](https://travis-ci.org/flutter/packages)
|
||||
|
||||
_See also: [Flutter's code of conduct](https://flutter.io/design-principles/#code-of-conduct)_
|
||||
|
||||
Things you will need
|
||||
--------------------
|
||||
|
||||
* Linux, Mac OS X, or Windows.
|
||||
* git (used for source version control).
|
||||
* An ssh client (used to authenticate with GitHub).
|
||||
|
||||
Getting the code and configuring your environment
|
||||
-------------------------------------------------
|
||||
|
||||
* Ensure all the dependencies described in the previous section are installed.
|
||||
* Fork `https://github.com/flutter/packages` into your own GitHub account. If
|
||||
you already have a fork, and are now installing a development environment on
|
||||
a new machine, make sure you've updated your fork so that you don't use stale
|
||||
configuration options from long ago.
|
||||
* If you haven't configured your machine with an SSH key that's known to github, then
|
||||
follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/)
|
||||
to generate an SSH key.
|
||||
* `git clone git@github.com:<your_name_here>/packages.git`
|
||||
* `cd packages`
|
||||
* `git remote add upstream git@github.com:flutter/packages.git` (So that you
|
||||
fetch from the master repository, not your clone, when running `git fetch`
|
||||
et al.)
|
||||
|
||||
Running the examples
|
||||
--------------------
|
||||
|
||||
To run an example with a prebuilt binary from the cloud, switch to that
|
||||
example's directory, run `flutter packages get` to make sure its dependencies have been
|
||||
downloaded, and use `flutter run`. Make sure you have a device connected over
|
||||
USB and debugging enabled on that device. For example:
|
||||
|
||||
* `cd packages/palette_generator/example/image_colors`
|
||||
* `flutter packages get`
|
||||
* `flutter run`
|
||||
|
||||
Contributing code
|
||||
-----------------
|
||||
|
||||
We gladly accept contributions via GitHub pull requests.
|
||||
|
||||
Please peruse our
|
||||
[style guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo) and
|
||||
[design principles](https://flutter.io/design-principles/) before
|
||||
working on anything non-trivial. These guidelines are intended to
|
||||
keep the code consistent and avoid common pitfalls.
|
||||
|
||||
To start working on a patch:
|
||||
|
||||
* `git fetch upstream`
|
||||
* `git checkout upstream/master -b <name_of_your_branch>`
|
||||
* Hack away.
|
||||
* Verify changes with [flutter_plugin_tools](https://pub.dartlang.org/packages/flutter_plugin_tools)
|
||||
```
|
||||
pub global activate flutter_plugin_tools
|
||||
pub global run flutter_plugin_tools format --plugins package_name
|
||||
pub global run flutter_plugin_tools analyze --plugins package_name
|
||||
pub global run flutter_plugin_tools test --plugins package_name
|
||||
```
|
||||
* `git commit -a -m "<your informative commit message>"`
|
||||
* `git push origin <name_of_your_branch>`
|
||||
|
||||
To send us a pull request:
|
||||
|
||||
* `git pull-request` (if you are using [Hub](http://github.com/github/hub/)) or
|
||||
go to `https://github.com/flutter/packages` and click the
|
||||
"Compare & pull request" button
|
||||
|
||||
Please make sure all your checkins have detailed commit messages explaining the patch.
|
||||
|
||||
Once you've gotten an LGTM from a project maintainer and once your PR has received
|
||||
the green light from all our automated testing (Travis, AppVeyor, etc), submit your
|
||||
changes to the `master` branch using one of the following methods:
|
||||
|
||||
* Wait for one of the project maintainers to submit it for you.
|
||||
* Click the green "Merge pull request" button on the GitHub UI of your pull
|
||||
request (requires commit access).
|
||||
|
||||
You must complete the [Contributor License Agreement](https://cla.developers.google.com/clas).
|
||||
You can do this online, and it only takes a minute.
|
||||
If you've never submitted code before, you must add your (or your
|
||||
organization's) name and contact info to the [AUTHORS](AUTHORS) file.
|
||||
|
||||
We grant commit access to people who have gained our trust and demonstrated
|
||||
a commitment to Flutter.
|
5
LICENSE
5
LICENSE
@ -1,4 +1,5 @@
|
||||
Copyright 2017, the Flutter project authors. All rights reserved.
|
||||
Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
@ -23,4 +24,4 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
39
README.md
39
README.md
@ -1,4 +1,37 @@
|
||||
# Helpful packages for Flutter
|
||||
# Flutter Packages
|
||||
|
||||
[](https://travis-ci.org/flutter/packages)
|
||||
[](https://cirrus-ci.com/github/flutter/packages)
|
||||
|
||||
This repo is a companion repo to the main [flutter repo](
|
||||
https://github.com/flutter/flutter). It contains the source code for Flutter's
|
||||
first-party packages (i.e., packages developed by the core Flutter team).
|
||||
Check the [`packages`](./packages) directory to see all packages.
|
||||
|
||||
These packages are also available on [pub](https://pub.dartlang.org/flutter/packages).
|
||||
|
||||
## Issues
|
||||
|
||||
Please file any issues, bugs, or feature requests in the [main flutter
|
||||
repo](https://github.com/flutter/flutter/issues/new).
|
||||
|
||||
## Contributing
|
||||
|
||||
If you wish to contribute a new package to the Flutter ecosystem, please
|
||||
see the documentation for [developing packages](https://flutter.io/developing-packages/). You can store
|
||||
your package source code in any GitHub repository (the present repo is only
|
||||
intended for packages developed by the core Flutter team). Once your package
|
||||
is ready you can [publish](https://flutter.io/developing-packages/#publish)
|
||||
to the [pub repository](https://pub.dartlang.org/).
|
||||
|
||||
If you wish to contribute a change to any of the existing packages in this repo,
|
||||
please review our [contribution guide](https://github.com/flutter/packages/blob/master/CONTRIBUTING.md),
|
||||
and send a [pull request](https://github.com/flutter/packages/pulls).
|
||||
|
||||
## Plugins
|
||||
These are the available packages in this repository.
|
||||
|
||||
| Plugin | Pub |
|
||||
|--------|-----|
|
||||
| [palette_generator](./packages/palette_generator/) | [](https://pub.dartlang.org/packages/palette_generator) |
|
||||
|
||||
This repository contains miscellaneous packages that help you build flutter
|
||||
apps. It is maintained by the Flutter team.
|
||||
|
@ -7,14 +7,15 @@
|
||||
# See the configuration guide for more
|
||||
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
|
||||
#
|
||||
# NOTE: Please keep this file in sync with
|
||||
# https://github.com/flutter/flutter/blob/master/.analysis_options
|
||||
# This file contains the analysis options used by Flutter tools, such as
|
||||
# IntelliJ, Android Studio, and the 'flutter analyze' command.
|
||||
#
|
||||
# This file is derived from the master file in the flutter repo, and should be
|
||||
# kept in sync with it.
|
||||
|
||||
analyzer:
|
||||
language:
|
||||
enableStrictCallChecks: true
|
||||
enableSuperMixins: true
|
||||
enableAssertInitializer: true
|
||||
strong-mode:
|
||||
implicit-dynamic: false
|
||||
errors:
|
||||
@ -25,98 +26,110 @@ analyzer:
|
||||
# allow having TODOs in the code
|
||||
todo: ignore
|
||||
exclude:
|
||||
- 'bin/cache/**'
|
||||
# the following two are relative to the stocks example and the flutter package respectively
|
||||
# see https://github.com/dart-lang/sdk/issues/28463
|
||||
- 'lib/i18n/stock_messages_*.dart'
|
||||
- 'lib/src/http/**'
|
||||
- 'flutter/**'
|
||||
|
||||
linter:
|
||||
rules:
|
||||
# these rules are documented on and in the same order as
|
||||
# the Dart Lint rules page to make maintenance easier
|
||||
# http://dart-lang.github.io/linter/lints/
|
||||
|
||||
# === error rules ===
|
||||
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
|
||||
- always_declare_return_types
|
||||
- always_put_control_body_on_new_line
|
||||
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
|
||||
- always_require_non_null_named_parameters
|
||||
- always_specify_types
|
||||
- annotate_overrides
|
||||
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
|
||||
- avoid_as
|
||||
# - avoid_bool_literals_in_conditional_expressions # not yet tested
|
||||
# - avoid_catches_without_on_clauses # we do this commonly
|
||||
# - avoid_catching_errors # we do this commonly
|
||||
- avoid_classes_with_only_static_members
|
||||
# - avoid_double_and_int_checks # only useful when targeting JS runtime
|
||||
- avoid_empty_else
|
||||
# - avoid_field_initializers_in_const_classes # not yet tested
|
||||
- avoid_function_literals_in_foreach_calls
|
||||
- avoid_init_to_null
|
||||
# - avoid_js_rounded_ints # only useful when targeting JS runtime
|
||||
- avoid_null_checks_in_equality_operators
|
||||
# - avoid_positional_boolean_parameters # not yet tested
|
||||
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
|
||||
- avoid_relative_lib_imports
|
||||
- avoid_renaming_method_parameters
|
||||
- avoid_return_types_on_setters
|
||||
# - avoid_returning_null # we do this commonly
|
||||
# - avoid_returning_this # https://github.com/dart-lang/linter/issues/842
|
||||
# - avoid_setters_without_getters # not yet tested
|
||||
# - avoid_single_cascade_in_expression_statements # not yet tested
|
||||
- avoid_slow_async_io
|
||||
# - avoid_types_as_parameter_names # https://github.com/dart-lang/linter/pull/954/files
|
||||
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
|
||||
# - avoid_unused_constructor_parameters # https://github.com/dart-lang/linter/pull/847
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
# - cascade_invocations # not yet tested
|
||||
# - close_sinks # https://github.com/flutter/flutter/issues/5789
|
||||
# - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
|
||||
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_catches
|
||||
- empty_constructor_bodies
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
# - invariant_booleans # https://github.com/flutter/flutter/issues/5790
|
||||
- iterable_contains_unrelated_type
|
||||
# - join_return_with_assignment # not yet tested
|
||||
- library_names
|
||||
- library_prefixes
|
||||
- list_remove_unrelated_type
|
||||
# - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
|
||||
- no_adjacent_strings_in_list
|
||||
- no_duplicate_case_values
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unrelated_type_equality_checks
|
||||
- valid_regexps
|
||||
|
||||
# === style rules ===
|
||||
- always_declare_return_types
|
||||
# - always_put_control_body_on_new_line
|
||||
- always_require_non_null_named_parameters
|
||||
- always_specify_types
|
||||
- annotate_overrides
|
||||
# - avoid_annotating_with_dynamic # not yet tested
|
||||
- avoid_as
|
||||
# - avoid_catches_without_on_clauses # not yet tested
|
||||
# - avoid_catching_errors # not yet tested
|
||||
# - avoid_classes_with_only_static_members # not yet tested
|
||||
# - avoid_function_literals_in_foreach_calls # not yet tested
|
||||
- avoid_init_to_null
|
||||
- avoid_null_checks_in_equality_operators
|
||||
# - avoid_positional_boolean_parameters # not yet tested
|
||||
- avoid_return_types_on_setters
|
||||
# - avoid_returning_null # not yet tested
|
||||
# - avoid_returning_this # not yet tested
|
||||
# - avoid_setters_without_getters # not yet tested
|
||||
# - avoid_types_on_closure_parameters # not yet tested
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
# - cascade_invocations # not yet tested
|
||||
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
|
||||
- directives_ordering
|
||||
- empty_catches
|
||||
- empty_constructor_bodies
|
||||
- implementation_imports
|
||||
# - join_return_with_assignment # not yet tested
|
||||
- library_names
|
||||
- library_prefixes
|
||||
- non_constant_identifier_names
|
||||
# - omit_local_variable_types # opposite of always_specify_types
|
||||
# - one_member_abstracts # too many false positives
|
||||
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
|
||||
- overridden_fields
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
# - parameter_assignments # we do this commonly
|
||||
- prefer_adjacent_string_concatenation
|
||||
- prefer_asserts_in_initializer_lists
|
||||
- prefer_bool_in_asserts
|
||||
- prefer_collection_literals
|
||||
# - prefer_conditional_assignment # not yet tested
|
||||
- prefer_conditional_assignment
|
||||
- prefer_const_constructors
|
||||
- prefer_const_constructors_in_immutables
|
||||
- prefer_const_declarations
|
||||
- prefer_const_literals_to_create_immutables
|
||||
# - prefer_constructors_over_static_methods # not yet tested
|
||||
- prefer_contains
|
||||
- prefer_equal_for_default_values
|
||||
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
|
||||
# - prefer_final_fields # https://github.com/dart-lang/linter/issues/506
|
||||
- prefer_final_fields
|
||||
- prefer_final_locals
|
||||
# - prefer_foreach # not yet tested
|
||||
- prefer_foreach
|
||||
# - prefer_function_declarations_over_variables # not yet tested
|
||||
- prefer_generic_function_type_aliases
|
||||
- prefer_initializing_formals
|
||||
# - prefer_interpolation_to_compose_strings # not yet tested
|
||||
# - prefer_iterable_whereType # https://github.com/dart-lang/sdk/issues/32463
|
||||
- prefer_is_empty
|
||||
- prefer_is_not_empty
|
||||
# - public_member_api_docs # this is the only difference from .analysis_options_repo
|
||||
# - recursive_getters # https://github.com/dart-lang/linter/issues/452
|
||||
- prefer_single_quotes
|
||||
- prefer_typing_uninitialized_variables
|
||||
- public_member_api_docs
|
||||
- recursive_getters
|
||||
- slash_for_doc_comments
|
||||
- sort_constructors_first
|
||||
- sort_unnamed_constructors_first
|
||||
- super_goes_last
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
# - type_annotate_public_apis # subset of always_specify_types
|
||||
- type_init_formals
|
||||
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
|
||||
@ -125,12 +138,14 @@ linter:
|
||||
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
|
||||
- unnecessary_null_aware_assignments
|
||||
- unnecessary_null_in_if_null_operators
|
||||
# - unnecessary_overrides # https://github.com/dart-lang/linter/issues/626 and https://github.com/dart-lang/linter/issues/627
|
||||
- unnecessary_overrides
|
||||
- unnecessary_parenthesis
|
||||
# - unnecessary_statements # not yet tested
|
||||
- unnecessary_this
|
||||
- unrelated_type_equality_checks
|
||||
- use_rethrow_when_possible
|
||||
# - use_setters_to_change_properties # not yet tested
|
||||
# - use_string_buffers # https://github.com/dart-lang/linter/pull/664
|
||||
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
|
||||
|
||||
# === pub rules ===
|
||||
- package_names
|
||||
- valid_regexps
|
||||
# - void_checks # not yet tested
|
35
script/incremental_build.sh
Executable file
35
script/incremental_build.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ev
|
||||
|
||||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
if [ "${BRANCH_NAME}" = "master" ]; then
|
||||
echo "Running for all packages"
|
||||
pub global run flutter_plugin_tools "$@"
|
||||
else
|
||||
# Make sure there is up-to-date master.
|
||||
git fetch origin master
|
||||
|
||||
FLUTTER_CHANGED_GLOBAL=0
|
||||
FLUTTER_CHANGED_PACKAGES=""
|
||||
|
||||
# Try get a merge base for the branch and calculate affected packages.
|
||||
# We need this check because some CIs can do a single branch clones with a limited history of commits.
|
||||
if BRANCH_BASE_SHA=$(git merge-base --fork-point FETCH_HEAD HEAD); then
|
||||
echo "Checking changes from $BRANCH_BASE_SHA..."
|
||||
FLUTTER_CHANGED_GLOBAL=`git diff --name-only $BRANCH_BASE_SHA HEAD | grep -v packages | wc -l`
|
||||
FLUTTER_CHANGED_PACKAGES=`git diff --name-only $BRANCH_BASE_SHA HEAD | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq | paste -s -d, -`
|
||||
else
|
||||
echo "Cannot find a merge base for the current branch to run an incremental build..."
|
||||
echo "Please rebase your branch onto the latest master!"
|
||||
fi
|
||||
|
||||
if [ "${FLUTTER_CHANGED_PACKAGES}" = "" ] || [ $FLUTTER_CHANGED_GLOBAL -gt 0 ]; then
|
||||
echo "Running for all packages"
|
||||
pub global run flutter_plugin_tools "$@"
|
||||
else
|
||||
echo "Running only for $FLUTTER_CHANGED_PACKAGES"
|
||||
pub global run flutter_plugin_tools "$@" --plugins=$FLUTTER_CHANGED_PACKAGES
|
||||
fi
|
||||
fi
|
18
script/plugin_tools.sh
Executable file
18
script/plugin_tools.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -ev
|
||||
|
||||
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
|
||||
echo "Running for all packages"
|
||||
pub global run flutter_plugin_tools "$@"
|
||||
else
|
||||
echo "Looking for changes in $TRAVIS_COMMIT_RANGE"
|
||||
FLUTTER_CHANGED_GLOBAL=`git diff --name-only $TRAVIS_COMMIT_RANGE | grep -v packages | wc -l`
|
||||
FLUTTER_CHANGED_PACKAGES=`git diff --name-only $TRAVIS_COMMIT_RANGE | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq | paste -s -d, -`
|
||||
if [ "${FLUTTER_CHANGED_PACKAGES}" = "" ] || [ $FLUTTER_CHANGED_GLOBAL -gt 0 ]; then
|
||||
echo "Running for all packages"
|
||||
pub global run flutter_plugin_tools "$@"
|
||||
else
|
||||
echo "Running only for $FLUTTER_CHANGED_PACKAGES"
|
||||
pub global run flutter_plugin_tools "$@" --plugins=$FLUTTER_CHANGED_PACKAGES
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user