Merge pull request #3 from gspencergoog/cirrus_switch
Switch to using Cirrus instead of Travis, and add a check for publishability. This consisted of copying the setup from the flutter/plugins repo and renaming PLUGIN_SHARDING to BUILD_SHARDING. Moves packages/palette_generator/example/image_colors up one directory level to packages/palette_generator/example, since there's only the one example, and the plugin_tools and pub only seem to allow one example. That's really too bad, but I don't feel like fighting it at the moment. Fixed a formatting error (that was probably due to dartfmt changing), and an analyzer error (due to an updated analyzer).
55
.cirrus.yml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
task:
|
||||||
|
container:
|
||||||
|
image: cirrusci/flutter:latest
|
||||||
|
cpu: 4
|
||||||
|
memory: 8G
|
||||||
|
upgrade_script:
|
||||||
|
- flutter channel master
|
||||||
|
- flutter upgrade
|
||||||
|
- git fetch origin master
|
||||||
|
activate_script: pub global activate flutter_plugin_tools
|
||||||
|
matrix:
|
||||||
|
- name: publishable
|
||||||
|
script: ./script/check_publish.sh
|
||||||
|
- name: test+format
|
||||||
|
install_script:
|
||||||
|
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
|
- sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
|
||||||
|
- sudo apt-get update
|
||||||
|
- sudo apt-get install -y --allow-unauthenticated clang-format-5.0
|
||||||
|
format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0
|
||||||
|
test_script: ./script/incremental_build.sh test
|
||||||
|
- name: analyze
|
||||||
|
script: ./script/incremental_build.sh analyze
|
||||||
|
- name: build-apks+java-test
|
||||||
|
env:
|
||||||
|
matrix:
|
||||||
|
BUILD_SHARDING: "--shardIndex 0 --shardCount 2"
|
||||||
|
BUILD_SHARDING: "--shardIndex 1 --shardCount 2"
|
||||||
|
script:
|
||||||
|
- ./script/incremental_build.sh build-examples --apk
|
||||||
|
- ./script/incremental_build.sh java-test # must come after apk build
|
||||||
|
|
||||||
|
task:
|
||||||
|
name: build-ipas
|
||||||
|
osx_instance:
|
||||||
|
image: high-sierra-xcode-9.4
|
||||||
|
env:
|
||||||
|
PATH: $PATH:/usr/local/bin
|
||||||
|
matrix:
|
||||||
|
BUILD_SHARDING: "--shardIndex 0 --shardCount 2"
|
||||||
|
BUILD_SHARDING: "--shardIndex 1 --shardCount 2"
|
||||||
|
setup_script:
|
||||||
|
- brew update
|
||||||
|
- brew install libimobiledevice
|
||||||
|
- brew install ideviceinstaller
|
||||||
|
- brew install ios-deploy
|
||||||
|
- pod repo update
|
||||||
|
- git clone https://github.com/flutter/flutter.git
|
||||||
|
- git fetch origin master
|
||||||
|
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
|
||||||
|
- flutter doctor
|
||||||
|
- pub global activate flutter_plugin_tools
|
||||||
|
build_script:
|
||||||
|
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
|
||||||
|
- ./script/incremental_build.sh build-examples --ipa
|
112
.travis.yml
@ -1,112 +0,0 @@
|
|||||||
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
|
|
@ -1,7 +1,7 @@
|
|||||||
Contributing to Flutter
|
Contributing to Flutter
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
[](https://travis-ci.org/flutter/packages)
|
[](https://cirrus-ci.com/github/flutter/packages)
|
||||||
|
|
||||||
_See also: [Flutter's code of conduct](https://flutter.io/design-principles/#code-of-conduct)_
|
_See also: [Flutter's code of conduct](https://flutter.io/design-principles/#code-of-conduct)_
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ example's directory, run `flutter packages get` to make sure its dependencies ha
|
|||||||
downloaded, and use `flutter run`. Make sure you have a device connected over
|
downloaded, and use `flutter run`. Make sure you have a device connected over
|
||||||
USB and debugging enabled on that device. For example:
|
USB and debugging enabled on that device. For example:
|
||||||
|
|
||||||
* `cd packages/palette_generator/example/image_colors`
|
* `cd packages/palette_generator/example`
|
||||||
* `flutter packages get`
|
* `flutter packages get`
|
||||||
* `flutter run`
|
* `flutter run`
|
||||||
|
|
||||||
@ -64,6 +64,12 @@ 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 analyze --plugins package_name
|
||||||
pub global run flutter_plugin_tools test --plugins package_name
|
pub global run flutter_plugin_tools test --plugins package_name
|
||||||
```
|
```
|
||||||
|
* Check that the package can be published (but don't publish it until it has landed!):
|
||||||
|
|
||||||
|
```
|
||||||
|
cd packages/package_name; pub publish --dry-run
|
||||||
|
```
|
||||||
|
|
||||||
* `git commit -a -m "<your informative commit message>"`
|
* `git commit -a -m "<your informative commit message>"`
|
||||||
* `git push origin <name_of_your_branch>`
|
* `git push origin <name_of_your_branch>`
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Flutter Packages
|
# Flutter Packages
|
||||||
|
|
||||||
[](https://travis-ci.org/flutter/packages)
|
[](https://cirrus-ci.com/github/flutter/packages/master)
|
||||||
[](https://cirrus-ci.com/github/flutter/packages)
|
|
||||||
|
|
||||||
This repo is a companion repo to the main [flutter repo](
|
This repo is a companion repo to the main [flutter repo](
|
||||||
https://github.com/flutter/flutter). It contains the source code for Flutter's
|
https://github.com/flutter/flutter). It contains the source code for Flutter's
|
||||||
|
@ -18,4 +18,4 @@ import 'package:palette_generator/palette_generator.dart';
|
|||||||
```
|
```
|
||||||
|
|
||||||
Then use the `PaletteGenerator` Dart class in your code. To see how this is done,
|
Then use the `PaletteGenerator` Dart class in your code. To see how this is done,
|
||||||
check out the [image_colors example app](example/image_colors/README.md).
|
check out the [image_colors example app](example/README.md).
|
||||||
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 68 B |
@ -302,4 +302,3 @@ class PaletteSwatch extends StatelessWidget {
|
|||||||
return swatch;
|
return swatch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
palette_generator:
|
palette_generator:
|
||||||
path: ../..
|
path: ..
|
||||||
cupertino_icons: ^0.1.2
|
cupertino_icons: ^0.1.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
@ -6,13 +6,10 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
|
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/.dart_tool" />
|
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/android/app/src/main/java/io/flutter/packages" />
|
<excludeFolder url="file://$MODULE_DIR$/example/android/app/src/main/java/io/flutter/packages" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/image_colors/build" />
|
<excludeFolder url="file://$MODULE_DIR$/example/build" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/image_test/.dart_tool" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/image_test/.pub" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/example/image_test/build" />
|
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
@ -11,7 +11,7 @@ dependencies:
|
|||||||
path: ^1.6.1
|
path: ^1.6.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
mockito: ^2.2.3
|
mockito: ^3.0.0
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ void main() async {
|
|||||||
testImages[name] = await loadImage('$name.png');
|
testImages[name] = await loadImage('$name.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
testWidgets('Initialize the image cache', (WidgetTester tester) {
|
testWidgets('Initialize the image cache', (WidgetTester tester) async {
|
||||||
// We need to have a testWidgets test in order to initialize the image
|
// We need to have a testWidgets test in order to initialize the image
|
||||||
// cache for the other tests, but they timeout if they too are testWidgets
|
// cache for the other tests, but they timeout if they too are testWidgets
|
||||||
// tests.
|
// tests.
|
||||||
@ -104,8 +104,10 @@ void main() async {
|
|||||||
final ImageProvider imageProvider = testImages['dominant'];
|
final ImageProvider imageProvider = testImages['dominant'];
|
||||||
Rect region = new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0);
|
Rect region = new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0);
|
||||||
const Size size = const Size(100.0, 100.0);
|
const Size size = const Size(100.0, 100.0);
|
||||||
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(imageProvider,
|
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
|
||||||
region: region, size: size);
|
imageProvider,
|
||||||
|
region: region,
|
||||||
|
size: size);
|
||||||
expect(palette.paletteColors.length, equals(3));
|
expect(palette.paletteColors.length, equals(3));
|
||||||
expect(palette.dominantColor.color,
|
expect(palette.dominantColor.color,
|
||||||
within<Color>(distance: 8, from: const Color(0xff0000ff)));
|
within<Color>(distance: 8, from: const Color(0xff0000ff)));
|
||||||
@ -167,14 +169,15 @@ void main() async {
|
|||||||
|
|
||||||
test('PaletteGenerator limits max colors', () async {
|
test('PaletteGenerator limits max colors', () async {
|
||||||
final ImageProvider imageProvider = testImages['landscape'];
|
final ImageProvider imageProvider = testImages['landscape'];
|
||||||
PaletteGenerator palette =
|
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
|
||||||
await PaletteGenerator.fromImageProvider(imageProvider, maximumColorCount: 32);
|
imageProvider,
|
||||||
|
maximumColorCount: 32);
|
||||||
expect(palette.paletteColors.length, equals(31));
|
expect(palette.paletteColors.length, equals(31));
|
||||||
palette =
|
palette = await PaletteGenerator.fromImageProvider(imageProvider,
|
||||||
await PaletteGenerator.fromImageProvider(imageProvider, maximumColorCount: 1);
|
maximumColorCount: 1);
|
||||||
expect(palette.paletteColors.length, equals(1));
|
expect(palette.paletteColors.length, equals(1));
|
||||||
palette =
|
palette = await PaletteGenerator.fromImageProvider(imageProvider,
|
||||||
await PaletteGenerator.fromImageProvider(imageProvider, maximumColorCount: 15);
|
maximumColorCount: 15);
|
||||||
expect(palette.paletteColors.length, equals(15));
|
expect(palette.paletteColors.length, equals(15));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -184,8 +187,9 @@ void main() async {
|
|||||||
List<PaletteFilter> filters = <PaletteFilter>[
|
List<PaletteFilter> filters = <PaletteFilter>[
|
||||||
avoidRedBlackWhitePaletteFilter
|
avoidRedBlackWhitePaletteFilter
|
||||||
];
|
];
|
||||||
PaletteGenerator palette =
|
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
|
||||||
await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
|
imageProvider,
|
||||||
|
filters: filters);
|
||||||
final List<PaletteColor> expectedSwatches = <PaletteColor>[
|
final List<PaletteColor> expectedSwatches = <PaletteColor>[
|
||||||
new PaletteColor(const Color(0xff3f630c), 10137),
|
new PaletteColor(const Color(0xff3f630c), 10137),
|
||||||
new PaletteColor(const Color(0xff3c4b2a), 4773),
|
new PaletteColor(const Color(0xff3c4b2a), 4773),
|
||||||
@ -213,7 +217,8 @@ void main() async {
|
|||||||
|
|
||||||
// A non-default filter works (and the default filter isn't applied too).
|
// A non-default filter works (and the default filter isn't applied too).
|
||||||
filters = <PaletteFilter>[onlyBluePaletteFilter];
|
filters = <PaletteFilter>[onlyBluePaletteFilter];
|
||||||
palette = await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
|
palette = await PaletteGenerator.fromImageProvider(imageProvider,
|
||||||
|
filters: filters);
|
||||||
final List<PaletteColor> blueSwatches = <PaletteColor>[
|
final List<PaletteColor> blueSwatches = <PaletteColor>[
|
||||||
new PaletteColor(const Color(0xff4c5c75), 1515),
|
new PaletteColor(const Color(0xff4c5c75), 1515),
|
||||||
new PaletteColor(const Color(0xff7483a1), 1505),
|
new PaletteColor(const Color(0xff7483a1), 1505),
|
||||||
@ -242,7 +247,8 @@ void main() async {
|
|||||||
|
|
||||||
// More than one filter is the intersection of the two filters.
|
// More than one filter is the intersection of the two filters.
|
||||||
filters = <PaletteFilter>[onlyBluePaletteFilter, onlyCyanPaletteFilter];
|
filters = <PaletteFilter>[onlyBluePaletteFilter, onlyCyanPaletteFilter];
|
||||||
palette = await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
|
palette = await PaletteGenerator.fromImageProvider(imageProvider,
|
||||||
|
filters: filters);
|
||||||
final List<PaletteColor> blueGreenSwatches = <PaletteColor>[
|
final List<PaletteColor> blueGreenSwatches = <PaletteColor>[
|
||||||
new PaletteColor(const Color(0xffc8e8f8), 87),
|
new PaletteColor(const Color(0xffc8e8f8), 87),
|
||||||
new PaletteColor(const Color(0xff5c6c74), 73),
|
new PaletteColor(const Color(0xff5c6c74), 73),
|
||||||
@ -271,7 +277,8 @@ void main() async {
|
|||||||
|
|
||||||
// Mutually exclusive filters return an empty palette.
|
// Mutually exclusive filters return an empty palette.
|
||||||
filters = <PaletteFilter>[onlyBluePaletteFilter, onlyGreenPaletteFilter];
|
filters = <PaletteFilter>[onlyBluePaletteFilter, onlyGreenPaletteFilter];
|
||||||
palette = await PaletteGenerator.fromImageProvider(imageProvider, filters: filters);
|
palette = await PaletteGenerator.fromImageProvider(imageProvider,
|
||||||
|
filters: filters);
|
||||||
expect(palette.paletteColors, isEmpty);
|
expect(palette.paletteColors, isEmpty);
|
||||||
expect(palette.dominantColor, isNull);
|
expect(palette.dominantColor, isNull);
|
||||||
expect(palette.colors, isEmpty);
|
expect(palette.colors, isEmpty);
|
||||||
@ -281,7 +288,8 @@ void main() async {
|
|||||||
final ImageProvider imageProvider = testImages['landscape'];
|
final ImageProvider imageProvider = testImages['landscape'];
|
||||||
// Passing an empty set of targets works the same as passing a null targets
|
// Passing an empty set of targets works the same as passing a null targets
|
||||||
// list.
|
// list.
|
||||||
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(imageProvider,
|
PaletteGenerator palette = await PaletteGenerator.fromImageProvider(
|
||||||
|
imageProvider,
|
||||||
targets: <PaletteTarget>[]);
|
targets: <PaletteTarget>[]);
|
||||||
expect(palette.selectedSwatches, isNotEmpty);
|
expect(palette.selectedSwatches, isNotEmpty);
|
||||||
expect(palette.vibrantColor, isNotNull);
|
expect(palette.vibrantColor, isNotNull);
|
||||||
|
39
script/check_publish.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# This script checks to make sure that each of the plugins *could* be published.
|
||||||
|
# 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")"
|
||||||
|
|
||||||
|
source "$SCRIPT_DIR/common.sh"
|
||||||
|
|
||||||
|
function check_publish() {
|
||||||
|
local failures=()
|
||||||
|
for package_name in "$@"; do
|
||||||
|
local dir="$REPO_DIR/packages/$package_name"
|
||||||
|
echo "Checking that $package_name can be published."
|
||||||
|
if (cd "$dir" && pub publish --dry-run > /dev/null); then
|
||||||
|
echo "Package $package_name is able to be published."
|
||||||
|
else
|
||||||
|
error "Unable to publish $package_name"
|
||||||
|
failures=("${failures[@]}" "$package_name")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ "${#failures[@]}" != 0 ]]; then
|
||||||
|
error "FAIL: The following ${#failures[@]} package(s) failed the publishing check:"
|
||||||
|
for failure in "${failures[@]}"; do
|
||||||
|
error "$failure"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
return "${#failures[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Sets CHANGED_PACKAGE_LIST
|
||||||
|
check_changed_packages
|
||||||
|
|
||||||
|
if [[ "${#CHANGED_PACKAGE_LIST[@]}" != 0 ]]; then
|
||||||
|
check_publish "${CHANGED_PACKAGE_LIST[@]}"
|
||||||
|
fi
|
42
script/common.sh
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function error() {
|
||||||
|
echo "$@" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_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.
|
||||||
|
local packages
|
||||||
|
local branch_base_sha="$(git merge-base --fork-point FETCH_HEAD HEAD || git merge-base FETCH_HEAD HEAD)"
|
||||||
|
if [[ "$?" == 0 ]]; then
|
||||||
|
echo "Checking for changed packages from $branch_base_sha"
|
||||||
|
IFS=$'\n' packages=( $(git diff --name-only "$branch_base_sha" HEAD | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq) )
|
||||||
|
else
|
||||||
|
error "Cannot find a merge base for the current branch to run an incremental build..."
|
||||||
|
error "Please rebase your branch onto the latest master!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Filter out any packages that don't have a pubspec.yaml: they have probably
|
||||||
|
# been deleted in this PR.
|
||||||
|
CHANGED_PACKAGES=""
|
||||||
|
CHANGED_PACKAGE_LIST=()
|
||||||
|
for package in "${packages[@]}"; do
|
||||||
|
if [[ -f "$REPO_DIR/packages/$package/pubspec.yaml" ]]; then
|
||||||
|
CHANGED_PACKAGES="${CHANGED_PACKAGES},$package"
|
||||||
|
CHANGED_PACKAGE_LIST=("${CHANGED_PACKAGE_LIST[@]}" "$package")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${#CHANGED_PACKAGE_LIST[@]}" == 0 ]]; then
|
||||||
|
echo "No changes detected in packages."
|
||||||
|
else
|
||||||
|
echo "Detected changes in the following ${#CHANGED_PACKAGE_LIST[@]} package(s):"
|
||||||
|
for package in "${CHANGED_PACKAGE_LIST[@]}"; do
|
||||||
|
echo "$package"
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
@ -1,35 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
set -ev
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
REPO_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
|
||||||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
source "$SCRIPT_DIR/common.sh"
|
||||||
|
|
||||||
if [ "${BRANCH_NAME}" = "master" ]; then
|
# Set some default actions if run without arguments.
|
||||||
|
ACTIONS=("$@")
|
||||||
|
if [[ "${#ACTIONS[@]}" == 0 ]]; then
|
||||||
|
ACTIONS=("test" "analyze" "java-test")
|
||||||
|
fi
|
||||||
|
|
||||||
|
BRANCH_NAME="${BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"}"
|
||||||
|
if [[ "${BRANCH_NAME}" == "master" ]]; then
|
||||||
echo "Running for all packages"
|
echo "Running for all packages"
|
||||||
pub global run flutter_plugin_tools "$@"
|
(cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $BUILD_SHARDING)
|
||||||
else
|
else
|
||||||
# Make sure there is up-to-date master.
|
# Sets CHANGED_PACKAGES
|
||||||
git fetch origin master
|
check_changed_packages
|
||||||
|
|
||||||
FLUTTER_CHANGED_GLOBAL=0
|
if [[ "$CHANGED_PACKAGES" == "" ]]; then
|
||||||
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"
|
echo "Running for all packages"
|
||||||
pub global run flutter_plugin_tools "$@"
|
(cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $BUILD_SHARDING)
|
||||||
else
|
else
|
||||||
echo "Running only for $FLUTTER_CHANGED_PACKAGES"
|
(cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $BUILD_SHARDING)
|
||||||
pub global run flutter_plugin_tools "$@" --plugins=$FLUTTER_CHANGED_PACKAGES
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
#!/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
|
|