Skip to content

Commit

Permalink
Remove usage of 'flutter format'
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough committed Sep 29, 2023
1 parent 5088bdb commit 4af42c5
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dart.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions mono_repo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 6.6.1

- Remove usage of removed `flutter format` command in
the generated `tool/ci.sh` file.

## 6.6.0

- Added the `dart` command to run arbitrary dart commands across all packages.
Expand Down
17 changes: 14 additions & 3 deletions mono_repo/lib/src/ci_test_script.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ import 'package_config.dart';
import 'shell_utils.dart';
import 'user_exception.dart';

String _commandContent(String commandName) => '''
String _commandContent(String commandName, {bool dartOnly = false}) {
if (dartOnly) {
return '''
function $commandName() {
command dart $commandName "\$@"
}''';
}

return '''
# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# then "flutter $commandName" is called instead of "dart $commandName".
# This assumes that the Flutter SDK has been installed in a previous step.
function $commandName() {
if grep -Fq "sdk: flutter" "\${PWD}/pubspec.yaml"; then
Expand All @@ -18,14 +28,15 @@ function $commandName() {
command dart $commandName "\$@"
fi
}''';
}

final bashScriptHeader = '''
#!/bin/bash
$createdWith
# Support built in commands on windows out of the box.
${_commandContent('pub')}
${_commandContent('format')}
${_commandContent('format', dartOnly: true)}
${_commandContent('analyze')}''';

String generateTestScript(
Expand Down
2 changes: 1 addition & 1 deletion mono_repo/lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mono_repo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: mono_repo
description: >-
CLI tools to make it easier to manage a single source repository containing
multiple Dart packages.
version: 6.6.0
version: 6.6.1
repository: https://github.com/google/mono_repo.dart

topics:
Expand Down
18 changes: 7 additions & 11 deletions mono_repo/test/script_integration_outputs/readme_ci.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash
# Created with package:mono_repo v1.2.3
# Created with package:mono_repo v6.6.1

# Support built in commands on windows out of the box.

# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# then "flutter pub" is called instead of "dart pub".
# This assumes that the Flutter SDK has been installed in a previous step.
function pub() {
if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then
Expand All @@ -12,18 +13,13 @@ function pub() {
command dart pub "$@"
fi
}
# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# This assumes that the Flutter SDK has been installed in a previous step.

function format() {
if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then
command flutter format "$@"
else
command dart format "$@"
fi
command dart format "$@"
}

# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter")
# then "flutter" is called instead of "pub".
# then "flutter analyze" is called instead of "dart analyze".
# This assumes that the Flutter SDK has been installed in a previous step.
function analyze() {
if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then
Expand Down
18 changes: 7 additions & 11 deletions tool/ci.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4af42c5

Please sign in to comment.