Pass a parameter for Flutter `firehose` support (#158)
* Actually pass a parameter for Flutter firehose support
* Switch to dash use for args
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 8b39fea..efe7b3b 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -27,7 +27,7 @@
# with:
# sdk: beta
-# When using this package to publish Flutter packages, the `use_flutter`
+# When using this package to publish Flutter packages, the `use-flutter`
# parameter should be set. The `sdk` parameter is then used to specify
# the Flutter SDK.
#
@@ -35,7 +35,7 @@
# publish:
# uses: dart-lang/ecosystem/.github/workflows/publish.yml@main
# with:
-# use_flutter: true
+# use-flutter: true
on:
workflow_call:
@@ -56,7 +56,7 @@
default: "stable"
required: false
type: string
- use_flutter:
+ use-flutter:
description: >-
Whether to setup Flutter in this workflow.
default: false
@@ -105,12 +105,12 @@
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
- if: ${{ inputs.use_flutter }}
+ if: ${{ inputs.use-flutter }}
with:
channel: ${{ inputs.sdk }}
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
- if: ${{ !inputs.use_flutter }}
+ if: ${{ !inputs.use-flutter }}
with:
sdk: ${{ inputs.sdk }}
@@ -118,4 +118,4 @@
run: dart pub global activate firehose
- name: Publish packages
- run: dart pub global run firehose --publish
+ run: dart pub global run firehose --publish --use-flutter ${{ inputs.use-flutter }}
diff --git a/pkgs/firehose/bin/firehose.dart b/pkgs/firehose/bin/firehose.dart
index e561bd9..645c8b6 100644
--- a/pkgs/firehose/bin/firehose.dart
+++ b/pkgs/firehose/bin/firehose.dart
@@ -8,6 +8,10 @@
import 'package:firehose/firehose.dart';
import 'package:firehose/src/github.dart';
+const validateOption = 'validate';
+const publishOption = 'publish';
+const useFlutterOption = 'use-flutter';
+
void main(List<String> arguments) async {
var argParser = _createArgs();
try {
@@ -18,8 +22,9 @@
exit(0);
}
- var validate = argResults['validate'] == true;
- var publish = argResults['publish'] == true;
+ var validate = argResults[validateOption] == true;
+ var publish = argResults[publishOption] == true;
+ var useFlutter = argResults[useFlutterOption] == true;
if (!validate && !publish) {
_usage(argParser,
@@ -35,7 +40,7 @@
exit(1);
}
- var firehose = Firehose(Directory.current);
+ var firehose = Firehose(Directory.current, useFlutter);
if (validate) {
await firehose.validate();
@@ -68,14 +73,19 @@
help: 'Print tool help.',
)
..addFlag(
- 'validate',
+ validateOption,
negatable: false,
help: 'Validate packages and indicate whether --publish would publish '
'anything.',
)
..addFlag(
- 'publish',
+ publishOption,
negatable: false,
help: 'Publish any changed packages.',
+ )
+ ..addFlag(
+ useFlutterOption,
+ negatable: true,
+ help: 'Whether this is a Flutter project.',
);
}
diff --git a/pkgs/firehose/lib/firehose.dart b/pkgs/firehose/lib/firehose.dart
index 611d618..05c09f3 100644
--- a/pkgs/firehose/lib/firehose.dart
+++ b/pkgs/firehose/lib/firehose.dart
@@ -23,8 +23,9 @@
class Firehose {
final Directory directory;
+ final bool useFlutter;
- Firehose(this.directory);
+ Firehose(this.directory, this.useFlutter);
/// Validate the packages in the repository.
///
@@ -279,7 +280,7 @@
required bool force,
}) async {
String command;
- if (package.pubspec.dependencies.containsKey('flutter')) {
+ if (useFlutter) {
command = 'flutter';
} else {
command = 'dart';
diff --git a/pkgs/firehose/lib/src/health/health.dart b/pkgs/firehose/lib/src/health/health.dart
index e507a1b..031ebe8 100644
--- a/pkgs/firehose/lib/src/health/health.dart
+++ b/pkgs/firehose/lib/src/health/health.dart
@@ -73,7 +73,8 @@
}
Future<HealthCheckResult> validateCheck(Github github) async {
- var results = await Firehose(directory).verify(github);
+ //TODO: Add Flutter support for PR health checks
+ var results = await Firehose(directory, false).verify(github);
var markdownTable = '''
| Package | Version | Status |