From 2cf24bb33846ecf0f3cc79e6bf15881643a76532 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 11:11:44 -0800 Subject: [PATCH 001/110] Initial commit. --- pkgs/cli_util/.gitignore | 9 +++++ pkgs/cli_util/.status | 3 ++ pkgs/cli_util/AUTHORS | 6 ++++ pkgs/cli_util/CHANGELOG.md | 5 +++ pkgs/cli_util/CONTRIBUTING.md | 33 +++++++++++++++++ pkgs/cli_util/LICENSE | 26 ++++++++++++++ pkgs/cli_util/README.md | 9 +++++ pkgs/cli_util/codereview.settings | 3 ++ pkgs/cli_util/lib/cli_util.dart | 59 +++++++++++++++++++++++++++++++ pkgs/cli_util/pubspec.yaml | 9 +++++ 10 files changed, 162 insertions(+) create mode 100644 pkgs/cli_util/.gitignore create mode 100644 pkgs/cli_util/.status create mode 100644 pkgs/cli_util/AUTHORS create mode 100644 pkgs/cli_util/CHANGELOG.md create mode 100644 pkgs/cli_util/CONTRIBUTING.md create mode 100644 pkgs/cli_util/LICENSE create mode 100644 pkgs/cli_util/README.md create mode 100644 pkgs/cli_util/codereview.settings create mode 100644 pkgs/cli_util/lib/cli_util.dart create mode 100644 pkgs/cli_util/pubspec.yaml diff --git a/pkgs/cli_util/.gitignore b/pkgs/cli_util/.gitignore new file mode 100644 index 000000000..cc69f5b8a --- /dev/null +++ b/pkgs/cli_util/.gitignore @@ -0,0 +1,9 @@ +.buildlog +.DS_Store +.idea +.pub/ +.project +.settings +build/ +packages +pubspec.lock \ No newline at end of file diff --git a/pkgs/cli_util/.status b/pkgs/cli_util/.status new file mode 100644 index 000000000..59f35730c --- /dev/null +++ b/pkgs/cli_util/.status @@ -0,0 +1,3 @@ +# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. diff --git a/pkgs/cli_util/AUTHORS b/pkgs/cli_util/AUTHORS new file mode 100644 index 000000000..7a6d1d960 --- /dev/null +++ b/pkgs/cli_util/AUTHORS @@ -0,0 +1,6 @@ +# Below is a list of people and organizations that have contributed +# to the cli_util project. Names should be added to the list like so: +# +# Name/Organization + +Google Inc. diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md new file mode 100644 index 000000000..2a2d63cf8 --- /dev/null +++ b/pkgs/cli_util/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 0.0.1 + +- Initial version diff --git a/pkgs/cli_util/CONTRIBUTING.md b/pkgs/cli_util/CONTRIBUTING.md new file mode 100644 index 000000000..6f5e0ea67 --- /dev/null +++ b/pkgs/cli_util/CONTRIBUTING.md @@ -0,0 +1,33 @@ +Want to contribute? Great! First, read this page (including the small print at +the end). + +### Before you contribute +Before we can use your code, you must sign the +[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual) +(CLA), which you can do online. The CLA is necessary mainly because you own the +copyright to your changes, even after your contribution becomes part of our +codebase, so we need your permission to use and distribute your code. We also +need to be sure of various other things—for instance that you'll tell us if you +know that your code infringes on other people's patents. You don't have to sign +the CLA until after you've submitted your code for review and a member has +approved it, but you must do it before we can put your code into our codebase. + +Before you start working on a larger contribution, you should get in touch with +us first through the issue tracker with your idea so that we can help out and +possibly guide you. Coordinating up front makes it much easier to avoid +frustration later on. + +### Code reviews +All submissions, including submissions by project members, require review. + +### File headers +All files in the project must start with the following header. + + // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file + // for details. All rights reserved. Use of this source code is governed by a + // BSD-style license that can be found in the LICENSE file. + +### The small print +Contributions made by corporations are covered by a different agreement than the +one above, the +[Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate). diff --git a/pkgs/cli_util/LICENSE b/pkgs/cli_util/LICENSE new file mode 100644 index 000000000..de31e1a0a --- /dev/null +++ b/pkgs/cli_util/LICENSE @@ -0,0 +1,26 @@ +Copyright 2015, the Dart project 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: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +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. diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md new file mode 100644 index 000000000..bcee2fda5 --- /dev/null +++ b/pkgs/cli_util/README.md @@ -0,0 +1,9 @@ +# cli_util + +A micro framework for building commandline apps. + +## Features and bugs + +Please file feature requests and bugs at the [issue tracker][tracker]. + +[tracker]: https://github.com/dart-lang/cli_util/issues diff --git a/pkgs/cli_util/codereview.settings b/pkgs/cli_util/codereview.settings new file mode 100644 index 000000000..2b2da2deb --- /dev/null +++ b/pkgs/cli_util/codereview.settings @@ -0,0 +1,3 @@ +CODE_REVIEW_SERVER: https://chromiumcodereview.appspot.com/ +VIEW_VC: https://github.com/dart-lang/cli_util/commit/ +CC_LIST: reviews@dartlang.org diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart new file mode 100644 index 000000000..a997c4300 --- /dev/null +++ b/pkgs/cli_util/lib/cli_util.dart @@ -0,0 +1,59 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library cli_util; + +import 'dart:io'; + +import 'package:which/which.dart'; + +/// Return the path to the current Dart SDK. This will return `null` if we are +/// unable to locate the Dart SDK. +Directory getSdkDir([List cliArgs]) { + // Look for --dart-sdk on the command line. + if (cliArgs != null) { + int index = cliArgs.indexOf('--dart-sdk'); + + if (index != -1 && (index + 1 < cliArgs.length)) { + return new Directory(cliArgs[index + 1]); + } + + for (String arg in cliArgs) { + if (arg.startsWith('--dart-sdk=')) { + return new Directory(arg.substring('--dart-sdk='.length)); + } + } + } + + // Look in env['DART_SDK'] + if (Platform.environment['DART_SDK'] != null) { + return new Directory(Platform.environment['DART_SDK']); + } + + // Look relative to the dart executable. + Directory sdkDirectory = new File(Platform.executable).parent.parent; + if (_isSdkDir(sdkDirectory)) return sdkDirectory; + + // Try and locate the VM using 'which'. + String executable = whichSync('dart', orElse: () => null); + + // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links. + Link link = new Link(executable); + if (link.existsSync()) { + executable = link.resolveSymbolicLinksSync(); + } + + File dartVm = new File(executable); + Directory dir = dartVm.parent.parent; + if (_isSdkDir(dir)) return dir; + + return null; +} + +bool _isSdkDir(Directory dir) => _joinFile(dir, ['version']).existsSync(); + +File _joinFile(Directory dir, List files) { + String pathFragment = files.join(Platform.pathSeparator); + return new File("${dir.path}${Platform.pathSeparator}${pathFragment}"); +} diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml new file mode 100644 index 000000000..99c3b0dbb --- /dev/null +++ b/pkgs/cli_util/pubspec.yaml @@ -0,0 +1,9 @@ +name: cli_util +version: 0.0.1 +author: Dart Team +description: A micro framework for building commandline apps. +homepage: https://github.com/dart-lang/cli_util +environment: + sdk: '>=1.0.0 <2.0.0' +dependencies: + which: '>=0.1.2 <0.2.0' From dec7d290290cd4be65d370dff0b9a1a7d9890100 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Tue, 3 Feb 2015 11:47:26 -0800 Subject: [PATCH 002/110] Update README.md --- pkgs/cli_util/README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index bcee2fda5..e28239294 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -1,6 +1,33 @@ # cli_util -A micro framework for building commandline apps. +Utilities to help in building Dart command-line apps. + +In particular, ``cli_util`` provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the [analyzer](https://pub.dartlang.org/packages/analyzer)). + +## Install + +```shell +pub global activate cli_util +``` + +## Usage + +```dart +import 'dart:io'; + +import 'package:cli_util/cli_util.dart'; +import 'package:path/path.dart' as path; + +main(args) { + + // Get sdk dir from cli_util + Directory sdkDir = getSdkDir(args); + + // Do stuff... For example, print version string + File versionFile = new File(path.join(sdkDir.path, 'version')); + print(versionFile.readAsStringSync()); +} +``` ## Features and bugs From e4c554bbe717e47994a7be6b38a183cae8ab5ae8 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 3 Feb 2015 12:00:04 -0800 Subject: [PATCH 003/110] readme tweaks --- pkgs/cli_util/README.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index e28239294..5eb257b71 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -1,14 +1,10 @@ # cli_util -Utilities to help in building Dart command-line apps. +A utility to help in building Dart command-line apps. -In particular, ``cli_util`` provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the [analyzer](https://pub.dartlang.org/packages/analyzer)). - -## Install - -```shell -pub global activate cli_util -``` +In particular, ``cli_util`` provides a simple, standardized way to get the +current SDK directory. Useful, especially, when building client applications +that interact with the Dart SDK (such as the [analyzer][analyzer]). ## Usage @@ -19,10 +15,9 @@ import 'package:cli_util/cli_util.dart'; import 'package:path/path.dart' as path; main(args) { - // Get sdk dir from cli_util Directory sdkDir = getSdkDir(args); - + // Do stuff... For example, print version string File versionFile = new File(path.join(sdkDir.path, 'version')); print(versionFile.readAsStringSync()); @@ -33,4 +28,5 @@ main(args) { Please file feature requests and bugs at the [issue tracker][tracker]. +[analyzer]: https://pub.dartlang.org/packages/analyzer [tracker]: https://github.com/dart-lang/cli_util/issues From 10a0953b4b36c8ea65fbca7e3c3cd336b82fa72f Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 3 Feb 2015 12:01:47 -0800 Subject: [PATCH 004/110] ws --- pkgs/cli_util/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index 5eb257b71..d1549adcb 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -17,7 +17,7 @@ import 'package:path/path.dart' as path; main(args) { // Get sdk dir from cli_util Directory sdkDir = getSdkDir(args); - + // Do stuff... For example, print version string File versionFile = new File(path.join(sdkDir.path, 'version')); print(versionFile.readAsStringSync()); From d6448b02c1ab04c24cc777508927b8b5d96bd1ae Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 3 Feb 2015 12:03:58 -0800 Subject: [PATCH 005/110] de-dup backticks --- pkgs/cli_util/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index d1549adcb..06bad90d0 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -2,9 +2,9 @@ A utility to help in building Dart command-line apps. -In particular, ``cli_util`` provides a simple, standardized way to get the -current SDK directory. Useful, especially, when building client applications -that interact with the Dart SDK (such as the [analyzer][analyzer]). +In particular, `cli_util` provides a simple, standardized way to get the current +SDK directory. Useful, especially, when building client applications that +interact with the Dart SDK (such as the [analyzer][analyzer]). ## Usage From 75bdfa38d2982a2312595178296e16110da2791d Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 3 Feb 2015 12:53:01 -0800 Subject: [PATCH 006/110] Update README.md --- pkgs/cli_util/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index 06bad90d0..74172b61d 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -1,6 +1,6 @@ # cli_util -A utility to help in building Dart command-line apps. +A library to help in building Dart command-line apps. In particular, `cli_util` provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that From 6acc6df3607ee7af1dedbe9abc7bc29410bca1a5 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Tue, 3 Feb 2015 12:55:15 -0800 Subject: [PATCH 007/110] Update pubspec.yaml Fixed description. --- pkgs/cli_util/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 99c3b0dbb..70ede948b 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,7 +1,7 @@ name: cli_util version: 0.0.1 author: Dart Team -description: A micro framework for building commandline apps. +description: A utility to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: sdk: '>=1.0.0 <2.0.0' From a100c383a6a013678b7b8a31ced0d134e9696ad9 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Tue, 3 Feb 2015 13:34:17 -0800 Subject: [PATCH 008/110] Update pubspec.yaml Description fix. --- pkgs/cli_util/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 70ede948b..9952d7aa4 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,7 +1,7 @@ name: cli_util version: 0.0.1 author: Dart Team -description: A utility to help in building Dart command-line apps. +description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: sdk: '>=1.0.0 <2.0.0' From 6f88596078372c6c0ccba5f6d1558d6106741ce1 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 15:44:03 -0800 Subject: [PATCH 009/110] Initial commit. --- pkgs/cli_util/tool/travis.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pkgs/cli_util/tool/travis.sh diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh new file mode 100644 index 000000000..d9bb4b73b --- /dev/null +++ b/pkgs/cli_util/tool/travis.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +# Fast fail the script on failures. +set -e + +# Verify that the libraries are error free. +dartanalyzer --fatal-warnings \ + lib/cli_util.dart + +# Run the tests. +# dart test/all.dart + +# Install dart_coveralls; gather and send coverage data. +if [ "$COVERALLS_TOKEN" ]; then + pub global activate dart_coveralls + pub global run dart_coveralls report \ + --token $COVERALLS_TOKEN \ + --retry 2 \ + --exclude-test-files \ + test/all.dart +fi \ No newline at end of file From db0be59cc64baafb1298f75896928520fce0c030 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 15:46:44 -0800 Subject: [PATCH 010/110] Travis scaffolding. --- pkgs/cli_util/tool/travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh index d9bb4b73b..b21d42120 100644 --- a/pkgs/cli_util/tool/travis.sh +++ b/pkgs/cli_util/tool/travis.sh @@ -12,7 +12,7 @@ dartanalyzer --fatal-warnings \ lib/cli_util.dart # Run the tests. -# dart test/all.dart +#dart test/all.dart # Install dart_coveralls; gather and send coverage data. if [ "$COVERALLS_TOKEN" ]; then From 35dd38eb11ee178cdba56b71cfb4a1abbd1ccfd2 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 16:11:28 -0800 Subject: [PATCH 011/110] Travis scaffolding for cli_util. BUG= R=devoncarew@google.com Review URL: https://chromiumcodereview.appspot.com//878023004 --- pkgs/cli_util/tool/travis.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pkgs/cli_util/tool/travis.sh diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh new file mode 100644 index 000000000..b21d42120 --- /dev/null +++ b/pkgs/cli_util/tool/travis.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +# Fast fail the script on failures. +set -e + +# Verify that the libraries are error free. +dartanalyzer --fatal-warnings \ + lib/cli_util.dart + +# Run the tests. +#dart test/all.dart + +# Install dart_coveralls; gather and send coverage data. +if [ "$COVERALLS_TOKEN" ]; then + pub global activate dart_coveralls + pub global run dart_coveralls report \ + --token $COVERALLS_TOKEN \ + --retry 2 \ + --exclude-test-files \ + test/all.dart +fi \ No newline at end of file From 2e4a975978f31bde525cd2d84b842e1330b38c04 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 16:17:18 -0800 Subject: [PATCH 012/110] Initial commit of travis.yml. --- pkgs/cli_util/.travis.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pkgs/cli_util/.travis.yml diff --git a/pkgs/cli_util/.travis.yml b/pkgs/cli_util/.travis.yml new file mode 100644 index 000000000..82c72d259 --- /dev/null +++ b/pkgs/cli_util/.travis.yml @@ -0,0 +1,3 @@ +language: dart +script: ./tool/travis.sh + From 041b345bcfa1e67dcddc1144df0592f988a69213 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 16:23:41 -0800 Subject: [PATCH 013/110] Initial commit of travis.yml. BUG= Review URL: https://chromiumcodereview.appspot.com//867533004 --- pkgs/cli_util/.travis.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pkgs/cli_util/.travis.yml diff --git a/pkgs/cli_util/.travis.yml b/pkgs/cli_util/.travis.yml new file mode 100644 index 000000000..82c72d259 --- /dev/null +++ b/pkgs/cli_util/.travis.yml @@ -0,0 +1,3 @@ +language: dart +script: ./tool/travis.sh + From e088e84f77f8a31f0d8be0ebd67674ee66477e52 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 16:26:08 -0800 Subject: [PATCH 014/110] Fixed exec bit. --- pkgs/cli_util/tool/travis.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 pkgs/cli_util/tool/travis.sh diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh old mode 100644 new mode 100755 From bc87756c229cefacdd3f48c00e8df0ea6bab9eb2 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Tue, 3 Feb 2015 16:44:45 -0800 Subject: [PATCH 015/110] Update README.md Added travis badge. --- pkgs/cli_util/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index 74172b61d..bcff2f3ce 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -6,6 +6,8 @@ In particular, `cli_util` provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the [analyzer][analyzer]). +[![Build Status](https://travis-ci.org/dart-lang/cli_util.svg)](https://travis-ci.org/dart-lang/cli_util) + ## Usage ```dart From 844f39705d44db304dd4e38651e26a2fe20048c0 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 3 Feb 2015 21:27:52 -0800 Subject: [PATCH 016/110] Arg parsing tests BUG= R=devoncarew@google.com Review URL: https://chromiumcodereview.appspot.com//893973005 --- pkgs/cli_util/pubspec.yaml | 2 ++ pkgs/cli_util/test/cli_util_test.dart | 21 +++++++++++++++++++++ pkgs/cli_util/tool/travis.sh | 7 ++++--- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 pkgs/cli_util/test/cli_util_test.dart diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 9952d7aa4..0beb6cc7a 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -7,3 +7,5 @@ environment: sdk: '>=1.0.0 <2.0.0' dependencies: which: '>=0.1.2 <0.2.0' +dev_dependencies: + unittest: '>=0.11.0 <0.12.0' diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart new file mode 100644 index 000000000..b7b78228a --- /dev/null +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -0,0 +1,21 @@ +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:cli_util/cli_util.dart'; +import 'package:unittest/unittest.dart'; + +void defineTests() { + group('getSdkDir', () { + test('arg parsing', () { + expect(getSdkDir(['--dart-sdk', '/dart/sdk']).path, equals('/dart/sdk')); + expect(getSdkDir(['--dart-sdk=/dart/sdk']).path, equals('/dart/sdk')); + }); + }); +} + +main() { + groupSep = ' | '; + + defineTests(); +} diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh index b21d42120..e8e10b795 100755 --- a/pkgs/cli_util/tool/travis.sh +++ b/pkgs/cli_util/tool/travis.sh @@ -9,10 +9,11 @@ set -e # Verify that the libraries are error free. dartanalyzer --fatal-warnings \ - lib/cli_util.dart + lib/cli_util.dart \ + test/cli_util_test.dart # Run the tests. -#dart test/all.dart +dart test/cli_util_test.dart # Install dart_coveralls; gather and send coverage data. if [ "$COVERALLS_TOKEN" ]; then @@ -21,5 +22,5 @@ if [ "$COVERALLS_TOKEN" ]; then --token $COVERALLS_TOKEN \ --retry 2 \ --exclude-test-files \ - test/all.dart + test/cli_util_test.dart fi \ No newline at end of file From 195df79cf899af01dcd9431a0eb74cbe30dd7719 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 10 Feb 2015 10:21:55 -0800 Subject: [PATCH 017/110] Check for null return from which(). --- pkgs/cli_util/lib/cli_util.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index a997c4300..ac767b2ee 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -37,6 +37,7 @@ Directory getSdkDir([List cliArgs]) { // Try and locate the VM using 'which'. String executable = whichSync('dart', orElse: () => null); + if (executable == null) return null; // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links. Link link = new Link(executable); From 1431a26b62f31bf972923f3052ba1367236b66c9 Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 10 Feb 2015 10:31:40 -0800 Subject: [PATCH 018/110] Version rev. --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 2a2d63cf8..ec557a84c 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.0.1+1 + +- Fix for when the dart executable can't be found by ``which``. + ## 0.0.1 - Initial version diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 0beb6cc7a..80f21e12d 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.0.1 +version: 0.0.1+1 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From f6cb74fd1d3d66889ddaae5d74c87f57c6add23c Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 10 Feb 2015 10:38:30 -0800 Subject: [PATCH 019/110] Fixed MD. --- pkgs/cli_util/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index ec557a84c..72714321b 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -2,7 +2,7 @@ ## 0.0.1+1 -- Fix for when the dart executable can't be found by ``which``. +- Fix for when the dart executable can't be found by `which`. ## 0.0.1 From 74cfeca0b75d0d27634c0743f469f714c4a328cc Mon Sep 17 00:00:00 2001 From: pquitslund Date: Tue, 10 Feb 2015 10:42:35 -0800 Subject: [PATCH 020/110] If-block rethink. --- pkgs/cli_util/lib/cli_util.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index ac767b2ee..683bef7e2 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -37,17 +37,18 @@ Directory getSdkDir([List cliArgs]) { // Try and locate the VM using 'which'. String executable = whichSync('dart', orElse: () => null); - if (executable == null) return null; - // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links. - Link link = new Link(executable); - if (link.existsSync()) { - executable = link.resolveSymbolicLinksSync(); - } + if (executable != null) { + // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links. + Link link = new Link(executable); + if (link.existsSync()) { + executable = link.resolveSymbolicLinksSync(); + } - File dartVm = new File(executable); - Directory dir = dartVm.parent.parent; - if (_isSdkDir(dir)) return dir; + File dartVm = new File(executable); + Directory dir = dartVm.parent.parent; + if (_isSdkDir(dir)) return dir; + } return null; } From 6a5a1f9abfc5f409cc2fc8597819e66019b12e03 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 16 Apr 2015 10:20:42 -0700 Subject: [PATCH 021/110] Update .travis.yml sudo => false --- pkgs/cli_util/.travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/.travis.yml b/pkgs/cli_util/.travis.yml index 82c72d259..b1279b7e4 100644 --- a/pkgs/cli_util/.travis.yml +++ b/pkgs/cli_util/.travis.yml @@ -1,3 +1,3 @@ language: dart script: ./tool/travis.sh - +sudo: false From 93ebaa63417b692ed20d3ce78fa776361dac40ac Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 19 May 2015 16:38:43 -0700 Subject: [PATCH 022/110] Support an executable in a symlinked directory. R=pquitslund@google.com Review URL: https://chromiumcodereview.appspot.com//1132913003 --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/lib/cli_util.dart | 7 +++++++ pkgs/cli_util/pubspec.yaml | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 72714321b..85af3d80c 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.0.1+2 + +- Support an executable in a symlinked directory. + ## 0.0.1+1 - Fix for when the dart executable can't be found by `which`. diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 683bef7e2..aff2c6799 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -6,6 +6,7 @@ library cli_util; import 'dart:io'; +import 'package:path/path.dart' as p; import 'package:which/which.dart'; /// Return the path to the current Dart SDK. This will return `null` if we are @@ -45,6 +46,12 @@ Directory getSdkDir([List cliArgs]) { executable = link.resolveSymbolicLinksSync(); } + Link parentLink = new Link(p.dirname(executable)); + if (parentLink.existsSync()) { + executable = p.join( + parentLink.resolveSymbolicLinksSync(), p.basename(executable)); + } + File dartVm = new File(executable); Directory dir = dartVm.parent.parent; if (_isSdkDir(dir)) return dir; diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 80f21e12d..c27866d3b 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,11 +1,12 @@ name: cli_util -version: 0.0.1+1 +version: 0.0.1+2 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: sdk: '>=1.0.0 <2.0.0' dependencies: + path: '>=1.0.0 <2.0.0' which: '>=0.1.2 <0.2.0' dev_dependencies: unittest: '>=0.11.0 <0.12.0' From ae41b3269d4d1c2874c5e523e0165f02a9fd4ade Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Thu, 21 May 2015 18:11:17 +0100 Subject: [PATCH 023/110] Test that getSdkDir() finds the SDK without CLI args. --- pkgs/cli_util/test/cli_util_test.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index b7b78228a..bf092e7f8 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -11,6 +11,9 @@ void defineTests() { expect(getSdkDir(['--dart-sdk', '/dart/sdk']).path, equals('/dart/sdk')); expect(getSdkDir(['--dart-sdk=/dart/sdk']).path, equals('/dart/sdk')); }); + test('finds the SDK without cli args', () { + expect(getSdkDir(), isNotNull); + }); }); } From 23610c365d9f7dbec6ff05522484c3ab004c6cbc Mon Sep 17 00:00:00 2001 From: pq Date: Tue, 10 May 2016 09:07:57 -0700 Subject: [PATCH 024/110] Flip the strong-mode bit for `cli_utl`. BUG= R=brianwilkerson@google.com Review URL: https://chromiumcodereview.appspot.com//1958283006 . --- pkgs/cli_util/.analysis_options | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 pkgs/cli_util/.analysis_options diff --git a/pkgs/cli_util/.analysis_options b/pkgs/cli_util/.analysis_options new file mode 100644 index 000000000..a10d4c5a0 --- /dev/null +++ b/pkgs/cli_util/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true From ff3126f549f4964431ca88e32c4d0342ac28deeb Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 26 Sep 2016 11:26:48 -0700 Subject: [PATCH 025/110] Update cli_util.dart --- pkgs/cli_util/lib/cli_util.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index aff2c6799..6533e9f1e 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -33,7 +33,14 @@ Directory getSdkDir([List cliArgs]) { } // Look relative to the dart executable. - Directory sdkDirectory = new File(Platform.executable).parent.parent; + File platformExecutable = new File(Platform.executable); + Directory sdkDirectory = platformExecutable.parent.parent; + if (_isSdkDir(sdkDirectory)) return sdkDirectory; + + // Handle the case where Platform.executable is a sibling of the SDK directory + // (this happens during internal testing). + sdkDirectory = + new Directory(p.join(platformExecutable.parent.path, 'dart-sdk')); if (_isSdkDir(sdkDirectory)) return sdkDirectory; // Try and locate the VM using 'which'. From d83bd4402584ebd84d4ff87db7843a3825d0ce7d Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 26 Sep 2016 11:27:55 -0700 Subject: [PATCH 026/110] Update CHANGELOG.md --- pkgs/cli_util/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 85af3d80c..a0047f2fa 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.0.1+3 + +- Find SDK properly when invoked from inside SDK tests. + ## 0.0.1+2 - Support an executable in a symlinked directory. From de2528f168982e42e68d67e8e871050c03c7334c Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 26 Sep 2016 11:28:17 -0700 Subject: [PATCH 027/110] Update pubspec.yaml --- pkgs/cli_util/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index c27866d3b..560d42877 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.0.1+2 +version: 0.0.1+3 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From 0ac395354d5ebf5bbdc60e7ade16a05782d1fc85 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Sun, 14 May 2017 20:20:29 -0700 Subject: [PATCH 028/110] introduce a getSdkPath() API --- pkgs/cli_util/.gitignore | 4 +- pkgs/cli_util/CHANGELOG.md | 4 ++ pkgs/cli_util/CONTRIBUTING.md | 2 +- pkgs/cli_util/README.md | 6 +-- ...analysis_options => analysis_options.yaml} | 0 pkgs/cli_util/lib/cli_util.dart | 50 +++++++------------ pkgs/cli_util/pubspec.yaml | 10 ++-- pkgs/cli_util/test/cli_util_test.dart | 15 +++--- pkgs/cli_util/tool/travis.sh | 2 +- 9 files changed, 44 insertions(+), 49 deletions(-) rename pkgs/cli_util/{.analysis_options => analysis_options.yaml} (100%) diff --git a/pkgs/cli_util/.gitignore b/pkgs/cli_util/.gitignore index cc69f5b8a..76b960ec8 100644 --- a/pkgs/cli_util/.gitignore +++ b/pkgs/cli_util/.gitignore @@ -5,5 +5,7 @@ .project .settings build/ +doc/api/ packages -pubspec.lock \ No newline at end of file +pubspec.lock +.packages diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index a0047f2fa..e4cd8cd50 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## unreleased + +- Use the new `Platform.resolvedExecutable` API to locate the SDK + ## 0.0.1+3 - Find SDK properly when invoked from inside SDK tests. diff --git a/pkgs/cli_util/CONTRIBUTING.md b/pkgs/cli_util/CONTRIBUTING.md index 6f5e0ea67..286d61c8b 100644 --- a/pkgs/cli_util/CONTRIBUTING.md +++ b/pkgs/cli_util/CONTRIBUTING.md @@ -23,7 +23,7 @@ All submissions, including submissions by project members, require review. ### File headers All files in the project must start with the following header. - // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file + // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index bcff2f3ce..bf2dcf9ce 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -17,11 +17,11 @@ import 'package:cli_util/cli_util.dart'; import 'package:path/path.dart' as path; main(args) { - // Get sdk dir from cli_util - Directory sdkDir = getSdkDir(args); + // Get sdk dir from cli_util. + String sdkPath = getSdkPath(); // Do stuff... For example, print version string - File versionFile = new File(path.join(sdkDir.path, 'version')); + File versionFile = new File(path.join(sdkPath, 'version')); print(versionFile.readAsStringSync()); } ``` diff --git a/pkgs/cli_util/.analysis_options b/pkgs/cli_util/analysis_options.yaml similarity index 100% rename from pkgs/cli_util/.analysis_options rename to pkgs/cli_util/analysis_options.yaml diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 6533e9f1e..62191ec78 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -6,11 +6,16 @@ library cli_util; import 'dart:io'; -import 'package:path/path.dart' as p; -import 'package:which/which.dart'; - -/// Return the path to the current Dart SDK. This will return `null` if we are -/// unable to locate the Dart SDK. +import 'package:path/path.dart' as path; + +/// Return the path to the current Dart SDK. +/// +/// This first checks for an explicit SDK listed on the command-line +/// (`--dart-sdk`). It then looks in any `DART_SDK` environment variable. Next, +/// it looks relative to the Dart VM executable. Last, it uses the +/// [Platform.resolvedExecutable] API. +/// +/// Callers should generally prefer using the [getSdkPath] function. Directory getSdkDir([List cliArgs]) { // Look for --dart-sdk on the command line. if (cliArgs != null) { @@ -40,36 +45,15 @@ Directory getSdkDir([List cliArgs]) { // Handle the case where Platform.executable is a sibling of the SDK directory // (this happens during internal testing). sdkDirectory = - new Directory(p.join(platformExecutable.parent.path, 'dart-sdk')); + new Directory(path.join(platformExecutable.parent.path, 'dart-sdk')); if (_isSdkDir(sdkDirectory)) return sdkDirectory; - // Try and locate the VM using 'which'. - String executable = whichSync('dart', orElse: () => null); - - if (executable != null) { - // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links. - Link link = new Link(executable); - if (link.existsSync()) { - executable = link.resolveSymbolicLinksSync(); - } - - Link parentLink = new Link(p.dirname(executable)); - if (parentLink.existsSync()) { - executable = p.join( - parentLink.resolveSymbolicLinksSync(), p.basename(executable)); - } - - File dartVm = new File(executable); - Directory dir = dartVm.parent.parent; - if (_isSdkDir(dir)) return dir; - } - - return null; + // Use `Platform.resolvedExecutable`. + return new Directory(getSdkPath()); } -bool _isSdkDir(Directory dir) => _joinFile(dir, ['version']).existsSync(); +/// Return the path to the current Dart SDK. +String getSdkPath() => path.dirname(path.dirname(Platform.resolvedExecutable)); -File _joinFile(Directory dir, List files) { - String pathFragment = files.join(Platform.pathSeparator); - return new File("${dir.path}${Platform.pathSeparator}${pathFragment}"); -} +bool _isSdkDir(Directory dir) => + FileSystemEntity.isDirectorySync(path.join(dir.path, 'version')); diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 560d42877..1afebf3e3 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,12 +1,14 @@ name: cli_util -version: 0.0.1+3 +version: 0.1.0-dev.1 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util + environment: - sdk: '>=1.0.0 <2.0.0' + sdk: '>=1.11.0 <2.0.0' + dependencies: path: '>=1.0.0 <2.0.0' - which: '>=0.1.2 <0.2.0' + dev_dependencies: - unittest: '>=0.11.0 <0.12.0' + test: ^0.12.0 diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index bf092e7f8..7cbdcf91b 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -3,7 +3,9 @@ // BSD-style license that can be found in the LICENSE file. import 'package:cli_util/cli_util.dart'; -import 'package:unittest/unittest.dart'; +import 'package:test/test.dart'; + +main() => defineTests(); void defineTests() { group('getSdkDir', () { @@ -11,14 +13,15 @@ void defineTests() { expect(getSdkDir(['--dart-sdk', '/dart/sdk']).path, equals('/dart/sdk')); expect(getSdkDir(['--dart-sdk=/dart/sdk']).path, equals('/dart/sdk')); }); + test('finds the SDK without cli args', () { expect(getSdkDir(), isNotNull); }); }); -} -main() { - groupSep = ' | '; - - defineTests(); + group('getSdkPath', () { + test('sdkPath', () { + expect(getSdkPath(), isNotNull); + }); + }); } diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh index e8e10b795..0b0aef98d 100755 --- a/pkgs/cli_util/tool/travis.sh +++ b/pkgs/cli_util/tool/travis.sh @@ -23,4 +23,4 @@ if [ "$COVERALLS_TOKEN" ]; then --retry 2 \ --exclude-test-files \ test/cli_util_test.dart -fi \ No newline at end of file +fi From 17debc25d09f0f102f9b4d09c292cdd03d491461 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 16 May 2017 22:58:45 -0700 Subject: [PATCH 029/110] add cli_logging.dart --- pkgs/cli_util/CHANGELOG.md | 2 + pkgs/cli_util/example/main.dart | 25 +++ pkgs/cli_util/lib/cli_logging.dart | 266 +++++++++++++++++++++++++++++ pkgs/cli_util/lib/cli_util.dart | 2 +- 4 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 pkgs/cli_util/example/main.dart create mode 100644 pkgs/cli_util/lib/cli_logging.dart diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index e4cd8cd50..7d05c6163 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -3,6 +3,8 @@ ## unreleased - Use the new `Platform.resolvedExecutable` API to locate the SDK +- add the `cli_logging.dart` library - some utilities to help cli tools + display output ## 0.0.1+3 diff --git a/pkgs/cli_util/example/main.dart b/pkgs/cli_util/example/main.dart new file mode 100644 index 000000000..0cc6846dc --- /dev/null +++ b/pkgs/cli_util/example/main.dart @@ -0,0 +1,25 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:cli_util/cli_logging.dart'; + +main(List args) async { + bool verbose = args.contains('-v'); + Logger logger = verbose ? new Logger.verbose() : new Logger.standard(); + + logger.stdout('Hello world!'); + logger.trace('message 1'); + await new Future.delayed(new Duration(milliseconds: 200)); + logger.trace('message 2'); + logger.trace('message 3'); + + Progress progress = logger.progress('doing some work'); + await new Future.delayed(new Duration(seconds: 2)); + progress.finish(showTiming: true); + + logger.stdout('All ${logger.ansi.emphasized('done')}.'); + logger.flush(); +} diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart new file mode 100644 index 000000000..72ec89a8b --- /dev/null +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -0,0 +1,266 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// This library contains functionality to help command-line utilities to easily +/// create aesthetic output. + +import 'dart:async'; +import 'dart:io' as io; + +/// create aesthetic output. + +/// A small utility class to make it easier to work with common ANSI escape +/// sequences. +class Ansi { + /// Return whether the current stdout terminal supports ANSI escape sequences. + static bool get terminalSupportsAnsi { + return io.stdout.supportsAnsiEscapes && + io.stdioType(io.stdout) == io.StdioType.TERMINAL; + } + + final bool useAnsi; + + Ansi(this.useAnsi); + + String get cyan => _code('\u001b[36m'); + String get green => _code('\u001b[32m'); + String get magenta => _code('\u001b[35m'); + String get red => _code('\u001b[31m'); + String get yellow => _code('\u001b[33m'); + String get blue => _code('\u001b[34m'); + String get gray => _code('\u001b[1;30m'); + String get noColor => _code('\u001b[39m'); + + String get none => _code('\u001b[0m'); + + String get bold => _code('\u001b[1m'); + + String get backspace => '\b'; + + String get bullet => io.stdout.supportsAnsiEscapes ? '•' : '-'; + + /// Display [message] in an emphasized format. + String emphasized(String message) => '$bold$message$none'; + + /// Display [message] in an subtle (gray) format. + String subtle(String message) => '$gray$message$none'; + + /// Display [message] in an error (red) format. + String error(String message) => '$red$message$none'; + + String _code(String ansiCode) => useAnsi ? ansiCode : ''; +} + +/// An abstract representation of a [Logger] - used to pretty print errors, +/// standard status messages, trace level output, and indeterminate progress. +abstract class Logger { + /// Create a normal [Logger]; this logger will not display trace level output. + factory Logger.standard({Ansi ansi}) => new _StandardLogger(ansi: ansi); + + /// Create a [Logger] that will display trace level output. + factory Logger.verbose({Ansi ansi}) => new _VerboseLogger(ansi: ansi); + + Ansi get ansi; + + /// Print an error message. + void stderr(String message); + + /// Print a standard status message. + void stdout(String message); + + /// Print trace output. + void trace(String message); + + /// Start an indeterminate progress display. + Progress progress(String message); + void _progressFinished(Progress progress); + + /// Flush any un-written output. + void flush(); +} + +/// A handle to an indeterminate progress display. +abstract class Progress { + final String message; + final Stopwatch _stopwatch; + + Progress._(this.message) : _stopwatch = new Stopwatch()..start(); + + Duration get elapsed => _stopwatch.elapsed; + + /// Finish the indeterminate progress display. + void finish({String message, bool showTiming}); + + /// Cancel the indeterminate progress display. + void cancel(); +} + +class _StandardLogger implements Logger { + Ansi ansi; + + _StandardLogger({this.ansi}) { + ansi ??= new Ansi(Ansi.terminalSupportsAnsi); + } + + Progress _currentProgress; + + void stderr(String message) { + io.stderr.writeln(message); + _currentProgress?.cancel(); + _currentProgress = null; + } + + void stdout(String message) { + print(message); + _currentProgress?.cancel(); + _currentProgress = null; + } + + void trace(String message) {} + + Progress progress(String message) { + _currentProgress?.cancel(); + _currentProgress = null; + + Progress progress = ansi.useAnsi + ? new _AnsiProgress(this, ansi, message) + : new _SimpleProgress(this, message); + _currentProgress = progress; + return progress; + } + + void _progressFinished(Progress progress) { + if (_currentProgress == progress) { + _currentProgress = null; + } + } + + void flush() {} +} + +class _SimpleProgress extends Progress { + final Logger logger; + + _SimpleProgress(this.logger, String message) : super._(message) { + logger.stdout('$message...'); + } + + @override + void cancel() { + logger._progressFinished(this); + } + + @override + void finish({String message, bool showTiming}) { + logger._progressFinished(this); + } +} + +class _AnsiProgress extends Progress { + static const List kAnimationItems = const ['/', '-', '\\', '|']; + + final Logger logger; + final Ansi ansi; + + int _index = 0; + Timer _timer; + + _AnsiProgress(this.logger, this.ansi, String message) : super._(message) { + io.stdout.write('${message}... '.padRight(40)); + + _timer = new Timer.periodic(new Duration(milliseconds: 80), (t) { + _index++; + _updateDisplay(); + }); + + _updateDisplay(); + } + + @override + void cancel() { + if (_timer.isActive) { + _timer.cancel(); + _updateDisplay(cancelled: true); + logger._progressFinished(this); + } + } + + @override + void finish({String message, bool showTiming: false}) { + if (_timer.isActive) { + _timer.cancel(); + _updateDisplay(isFinal: true, message: message, showTiming: showTiming); + logger._progressFinished(this); + } + } + + void _updateDisplay( + {bool isFinal: false, + bool cancelled: false, + String message, + bool showTiming: false}) { + String char = kAnimationItems[_index % kAnimationItems.length]; + if (isFinal || cancelled) { + char = ' '; + } + io.stdout.write('${ansi.backspace}${char}'); + if (isFinal || cancelled) { + if (message != null) { + io.stdout.write(message); + } else if (showTiming) { + String time = (elapsed.inMilliseconds / 1000.0).toStringAsFixed(1); + io.stdout.write('${time}s'); + } + io.stdout.writeln(); + } + } +} + +class _VerboseLogger implements Logger { + Ansi ansi; + Stopwatch _timer; + + String _previousErr; + String _previousMsg; + + _VerboseLogger({this.ansi}) { + ansi ??= new Ansi(Ansi.terminalSupportsAnsi); + _timer = new Stopwatch()..start(); + } + + void stderr(String message) { + flush(); + _previousErr = '${ansi.red}$message${ansi.none}'; + } + + void stdout(String message) { + flush(); + _previousMsg = message; + } + + void trace(String message) { + flush(); + _previousMsg = '${ansi.gray}$message${ansi.none}'; + } + + Progress progress(String message) => new _SimpleProgress(this, message); + + void _progressFinished(Progress progress) {} + + void flush() { + if (_previousErr != null) { + io.stderr.writeln('${_createTag()} $_previousErr'); + _previousErr = null; + } else if (_previousMsg != null) { + io.stdout.writeln('${_createTag()} $_previousMsg'); + _previousMsg = null; + } + } + + String _createTag() { + int millis = _timer.elapsedMilliseconds; + _timer.reset(); + return '[${millis.toString().padLeft(4)} ms]'; + } +} diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 62191ec78..2c8faa2d8 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library cli_util; +/// Utilities to return the Dart SDK location. import 'dart:io'; From efef03fd34172ae6f973e7d07a8703e28995bb2a Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 17 May 2017 09:28:27 -0700 Subject: [PATCH 030/110] update the readme --- pkgs/cli_util/README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index bf2dcf9ce..e27d663b7 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -8,7 +8,7 @@ interact with the Dart SDK (such as the [analyzer][analyzer]). [![Build Status](https://travis-ci.org/dart-lang/cli_util.svg)](https://travis-ci.org/dart-lang/cli_util) -## Usage +## Locating the Dart SDK ```dart import 'dart:io'; @@ -26,6 +26,38 @@ main(args) { } ``` +## Displaying output and progress + +`package:cli_util` can also be used to help CLI tools display output and progress. +It has a logging mechanism which can help differentiate between regular tool +output and error messages, and can facilitate having a more verbose (`-v`) mode for +output. + +In addition, it can display an indeterminate progress spinner for longer running +tasks, and optionally display the elapsed time when finished: + +```dart +import 'package:cli_util/cli_logging.dart'; + +main(List args) async { + bool verbose = args.contains('-v'); + Logger logger = verbose ? new Logger.verbose() : new Logger.standard(); + + logger.stdout('Hello world!'); + logger.trace('message 1'); + await new Future.delayed(new Duration(milliseconds: 200)); + logger.trace('message 2'); + logger.trace('message 3'); + + Progress progress = logger.progress('doing some work'); + await new Future.delayed(new Duration(seconds: 2)); + progress.finish(showTiming: true); + + logger.stdout('All ${logger.ansi.emphasized('done')}.'); + logger.flush(); +} +``` + ## Features and bugs Please file feature requests and bugs at the [issue tracker][tracker]. From 9b300258ab8db4f11a9991ba7b674d89f5713f9f Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 17 May 2017 09:59:43 -0700 Subject: [PATCH 031/110] rev to 0.1.0 --- pkgs/cli_util/CHANGELOG.md | 5 ++--- pkgs/cli_util/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 7d05c6163..eaeffde6a 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,10 +1,9 @@ # Changelog -## unreleased +## 0.1.0 - Use the new `Platform.resolvedExecutable` API to locate the SDK -- add the `cli_logging.dart` library - some utilities to help cli tools - display output +- Add the `cli_logging.dart` library - utilities to display output and progress ## 0.0.1+3 diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 1afebf3e3..ccd17b527 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.1.0-dev.1 +version: 0.1.0 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From fa9b08991603a481bf9bb27b66fb3a863acf0e67 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Wed, 17 May 2017 10:26:14 -0700 Subject: [PATCH 032/110] Add pub package badge. --- pkgs/cli_util/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index e27d663b7..0256472ae 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -7,6 +7,7 @@ SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the [analyzer][analyzer]). [![Build Status](https://travis-ci.org/dart-lang/cli_util.svg)](https://travis-ci.org/dart-lang/cli_util) +[![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dartlang.org/packages/cli_util) ## Locating the Dart SDK From a2f3ed26241c5bded85b768cbb4e34aba261cbc5 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 17 May 2017 17:33:09 -0700 Subject: [PATCH 033/110] fix and add library docs --- pkgs/cli_util/lib/cli_logging.dart | 3 +-- pkgs/cli_util/lib/cli_util.dart | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 72ec89a8b..a5fa6d637 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -4,12 +4,11 @@ /// This library contains functionality to help command-line utilities to easily /// create aesthetic output. +library cli_logging; import 'dart:async'; import 'dart:io' as io; -/// create aesthetic output. - /// A small utility class to make it easier to work with common ANSI escape /// sequences. class Ansi { diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 2c8faa2d8..5d32e781b 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. /// Utilities to return the Dart SDK location. +library cli_util; import 'dart:io'; From e7c8915a39f35b644ad96e8bc764616c0c5984aa Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 19 May 2017 15:21:33 -0700 Subject: [PATCH 034/110] sme updates to the output for the progess display --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/lib/cli_logging.dart | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index eaeffde6a..f9b6c00b9 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## unreleased + +- Updated to the output for indeterminate progress + ## 0.1.0 - Use the new `Platform.resolvedExecutable` API to locate the SDK diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 72ec89a8b..600ccc1f5 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -202,15 +202,17 @@ class _AnsiProgress extends Progress { bool showTiming: false}) { String char = kAnimationItems[_index % kAnimationItems.length]; if (isFinal || cancelled) { - char = ' '; + char = ''; } io.stdout.write('${ansi.backspace}${char}'); if (isFinal || cancelled) { if (message != null) { - io.stdout.write(message); + io.stdout.write(message.isEmpty ? ' ' : message); } else if (showTiming) { String time = (elapsed.inMilliseconds / 1000.0).toStringAsFixed(1); io.stdout.write('${time}s'); + } else { + io.stdout.write(' '); } io.stdout.writeln(); } From f0ff8b9ea5d4ef14037fd0db0fd53dc1c263dda7 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 26 May 2017 10:25:31 -0700 Subject: [PATCH 035/110] add Logger.isVerbose; rev version --- pkgs/cli_util/CHANGELOG.md | 3 ++- pkgs/cli_util/lib/cli_logging.dart | 6 ++++++ pkgs/cli_util/pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index f9b6c00b9..c5d12d6d0 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,8 +1,9 @@ # Changelog -## unreleased +## 0.1.1 - Updated to the output for indeterminate progress +- Exposed a `Logger.isVerbose` getter ## 0.1.0 diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 66e51aaad..2da62ca72 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -62,6 +62,8 @@ abstract class Logger { Ansi get ansi; + bool get isVerbose; + /// Print an error message. void stderr(String message); @@ -102,6 +104,8 @@ class _StandardLogger implements Logger { ansi ??= new Ansi(Ansi.terminalSupportsAnsi); } + bool get isVerbose => false; + Progress _currentProgress; void stderr(String message) { @@ -230,6 +234,8 @@ class _VerboseLogger implements Logger { _timer = new Stopwatch()..start(); } + bool get isVerbose => true; + void stderr(String message) { flush(); _previousErr = '${ansi.red}$message${ansi.none}'; diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index ccd17b527..baead10dc 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.1.0 +version: 0.1.1 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From 8c9e54861814a739ca052a7838d3e41fb4733ec0 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 13 Jul 2017 11:33:42 -0700 Subject: [PATCH 036/110] fix an issue with getSdkDir --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/lib/cli_util.dart | 10 +++++----- pkgs/cli_util/lib/src/utils.dart | 10 ++++++++++ pkgs/cli_util/pubspec.yaml | 2 +- pkgs/cli_util/test/cli_util_test.dart | 12 ++++++++++++ 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 pkgs/cli_util/lib/src/utils.dart diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index c5d12d6d0..7a7bfa4d6 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.2 + +- Fix a bug in `getSdkDir` (#21) + ## 0.1.1 - Updated to the output for indeterminate progress diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 5d32e781b..d58be7a72 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -9,6 +9,8 @@ import 'dart:io'; import 'package:path/path.dart' as path; +import 'src/utils.dart'; + /// Return the path to the current Dart SDK. /// /// This first checks for an explicit SDK listed on the command-line @@ -17,6 +19,7 @@ import 'package:path/path.dart' as path; /// [Platform.resolvedExecutable] API. /// /// Callers should generally prefer using the [getSdkPath] function. +@Deprecated('Clients should generally prefer getSdkPath()') Directory getSdkDir([List cliArgs]) { // Look for --dart-sdk on the command line. if (cliArgs != null) { @@ -41,13 +44,13 @@ Directory getSdkDir([List cliArgs]) { // Look relative to the dart executable. File platformExecutable = new File(Platform.executable); Directory sdkDirectory = platformExecutable.parent.parent; - if (_isSdkDir(sdkDirectory)) return sdkDirectory; + if (isSdkDir(sdkDirectory)) return sdkDirectory; // Handle the case where Platform.executable is a sibling of the SDK directory // (this happens during internal testing). sdkDirectory = new Directory(path.join(platformExecutable.parent.path, 'dart-sdk')); - if (_isSdkDir(sdkDirectory)) return sdkDirectory; + if (isSdkDir(sdkDirectory)) return sdkDirectory; // Use `Platform.resolvedExecutable`. return new Directory(getSdkPath()); @@ -55,6 +58,3 @@ Directory getSdkDir([List cliArgs]) { /// Return the path to the current Dart SDK. String getSdkPath() => path.dirname(path.dirname(Platform.resolvedExecutable)); - -bool _isSdkDir(Directory dir) => - FileSystemEntity.isDirectorySync(path.join(dir.path, 'version')); diff --git a/pkgs/cli_util/lib/src/utils.dart b/pkgs/cli_util/lib/src/utils.dart new file mode 100644 index 000000000..66bab2f99 --- /dev/null +++ b/pkgs/cli_util/lib/src/utils.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:path/path.dart' as path; + +bool isSdkDir(Directory dir) => + FileSystemEntity.isFileSync(path.join(dir.path, 'version')); diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index baead10dc..af9075d48 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.1.1 +version: 0.1.2 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index 7cbdcf91b..82fb83c54 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -2,7 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:io'; + import 'package:cli_util/cli_util.dart'; +import 'package:cli_util/src/utils.dart'; import 'package:test/test.dart'; main() => defineTests(); @@ -10,11 +13,14 @@ main() => defineTests(); void defineTests() { group('getSdkDir', () { test('arg parsing', () { + // ignore: deprecated_member_use expect(getSdkDir(['--dart-sdk', '/dart/sdk']).path, equals('/dart/sdk')); + // ignore: deprecated_member_use expect(getSdkDir(['--dart-sdk=/dart/sdk']).path, equals('/dart/sdk')); }); test('finds the SDK without cli args', () { + // ignore: deprecated_member_use expect(getSdkDir(), isNotNull); }); }); @@ -24,4 +30,10 @@ void defineTests() { expect(getSdkPath(), isNotNull); }); }); + + group('utils', () { + test('isSdkDir', () { + expect(isSdkDir(new Directory(getSdkPath())), true); + }); + }); } From f9fb8d17858f7a6520ce322e9aa3497ae3b21a0b Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 13 Jul 2017 12:51:05 -0700 Subject: [PATCH 037/110] Update SDK constraint to be 2.0.0 dev friendly. --- pkgs/cli_util/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index af9075d48..05ccd97af 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -5,7 +5,7 @@ description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: - sdk: '>=1.11.0 <2.0.0' + sdk: '>=1.11.0 <2.0.0-dev.infinity' dependencies: path: '>=1.0.0 <2.0.0' From e82b7524e79a5476c6327e332e034014388f642e Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 19 Jul 2017 08:37:05 -0700 Subject: [PATCH 038/110] Update CHANGELOG.md update the changelog --- pkgs/cli_util/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 7a7bfa4d6..7b28b6c8e 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -11,7 +11,9 @@ ## 0.1.0 -- Use the new `Platform.resolvedExecutable` API to locate the SDK +- Added a new `getSdkPath()` method to get the location of the SDK (this uses the new + `Platform.resolvedExecutable` API to locate the SDK) +- Deprecated `getSdkDir()` in favor of `getSdkPath()` - Add the `cli_logging.dart` library - utilities to display output and progress ## 0.0.1+3 From 369579070c9401e3515491cc2fe1d2e9d51c2fea Mon Sep 17 00:00:00 2001 From: pq Date: Thu, 3 Aug 2017 15:52:12 -0700 Subject: [PATCH 039/110] Make trusty default distro explicit. --- pkgs/cli_util/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/cli_util/.travis.yml b/pkgs/cli_util/.travis.yml index b1279b7e4..7fe752ef2 100644 --- a/pkgs/cli_util/.travis.yml +++ b/pkgs/cli_util/.travis.yml @@ -1,3 +1,4 @@ language: dart script: ./tool/travis.sh +dist: trusty sudo: false From 66175adb2f1606f8ed17b729c367d92524823268 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 18 Sep 2017 21:26:36 -0700 Subject: [PATCH 040/110] Fix SDK constraint (dart-lang/cli_util#27) --- pkgs/cli_util/CHANGELOG.md | 4 +++- pkgs/cli_util/pubspec.yaml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 7b28b6c8e..372cdddad 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,4 +1,6 @@ -# Changelog +## 0.1.2+1 + +- Remove unneeded change to Dart SDK constraint. ## 0.1.2 diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 05ccd97af..d7ee512e4 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,11 +1,11 @@ name: cli_util -version: 0.1.2 +version: 0.1.2+1 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: - sdk: '>=1.11.0 <2.0.0-dev.infinity' + sdk: '>=1.11.0 <2.0.0' dependencies: path: '>=1.0.0 <2.0.0' From 3694a44b0a8249bb6b11ab18cdec98efacafa38d Mon Sep 17 00:00:00 2001 From: Mike Fairhurst Date: Mon, 19 Feb 2018 11:47:00 -0800 Subject: [PATCH 041/110] Changes for landing https://github.com/dart-lang/sdk/issues/32161 Add void declarations to methods with implicit dynamic returning void values, which may be illegal in dart 2, but in either case, expresses the current intent better. --- pkgs/cli_util/test/cli_util_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index 82fb83c54..eb27978fc 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -8,7 +8,7 @@ import 'package:cli_util/cli_util.dart'; import 'package:cli_util/src/utils.dart'; import 'package:test/test.dart'; -main() => defineTests(); +void main() => defineTests(); void defineTests() { group('getSdkDir', () { From a2278dbcaedb424c582a7223ecd2a8331d751815 Mon Sep 17 00:00:00 2001 From: pq Date: Sat, 10 Mar 2018 14:40:57 -0800 Subject: [PATCH 042/110] Update .gitignore to new `dart_tool` pub cache See: https://github.com/dart-lang/sdk/issues/32030 --- pkgs/cli_util/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/.gitignore b/pkgs/cli_util/.gitignore index 76b960ec8..330986893 100644 --- a/pkgs/cli_util/.gitignore +++ b/pkgs/cli_util/.gitignore @@ -1,7 +1,7 @@ .buildlog .DS_Store .idea -.pub/ +.dart_tool .project .settings build/ From c257d4abdb313efc51208337bc89d29459513366 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Sat, 10 Mar 2018 17:28:28 -0800 Subject: [PATCH 043/110] Update .gitignore --- pkgs/cli_util/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/.gitignore b/pkgs/cli_util/.gitignore index 330986893..3cc62a7ce 100644 --- a/pkgs/cli_util/.gitignore +++ b/pkgs/cli_util/.gitignore @@ -1,7 +1,7 @@ .buildlog .DS_Store .idea -.dart_tool +.dart_tool/ .project .settings build/ From ff72416e54bdf1b79e5a7c2265099a91c7b17c89 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 14 May 2018 16:17:58 -0700 Subject: [PATCH 044/110] change the verbose logging output --- pkgs/cli_util/.travis.yml | 6 ++ pkgs/cli_util/CHANGELOG.md | 6 ++ pkgs/cli_util/example/main.dart | 1 + pkgs/cli_util/lib/cli_logging.dart | 135 ++++++++++++++++------------- pkgs/cli_util/pubspec.yaml | 2 +- pkgs/cli_util/tool/travis.sh | 3 + 6 files changed, 93 insertions(+), 60 deletions(-) diff --git a/pkgs/cli_util/.travis.yml b/pkgs/cli_util/.travis.yml index 7fe752ef2..3c087ca7e 100644 --- a/pkgs/cli_util/.travis.yml +++ b/pkgs/cli_util/.travis.yml @@ -1,4 +1,10 @@ language: dart +dart: + - dev script: ./tool/travis.sh dist: trusty sudo: false + +branches: + only: + - master diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 372cdddad..338c92c04 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.1.3 +- In verbose mode, instead of printing the diff from the last log message, + print the total time since the tool started +- Change to not buffer the last log message sent in verbose logging mode +- Expose more classes from the logging library + ## 0.1.2+1 - Remove unneeded change to Dart SDK constraint. diff --git a/pkgs/cli_util/example/main.dart b/pkgs/cli_util/example/main.dart index 0cc6846dc..afafdc3ba 100644 --- a/pkgs/cli_util/example/main.dart +++ b/pkgs/cli_util/example/main.dart @@ -21,5 +21,6 @@ main(List args) async { progress.finish(showTiming: true); logger.stdout('All ${logger.ansi.emphasized('done')}.'); + // ignore: deprecated_member_use logger.flush(); } diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 2da62ca72..539248537 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -23,12 +23,19 @@ class Ansi { Ansi(this.useAnsi); String get cyan => _code('\u001b[36m'); + String get green => _code('\u001b[32m'); + String get magenta => _code('\u001b[35m'); + String get red => _code('\u001b[31m'); + String get yellow => _code('\u001b[33m'); + String get blue => _code('\u001b[34m'); + String get gray => _code('\u001b[1;30m'); + String get noColor => _code('\u001b[39m'); String get none => _code('\u001b[0m'); @@ -55,10 +62,14 @@ class Ansi { /// standard status messages, trace level output, and indeterminate progress. abstract class Logger { /// Create a normal [Logger]; this logger will not display trace level output. - factory Logger.standard({Ansi ansi}) => new _StandardLogger(ansi: ansi); + factory Logger.standard({Ansi ansi}) => new StandardLogger(ansi: ansi); /// Create a [Logger] that will display trace level output. - factory Logger.verbose({Ansi ansi}) => new _VerboseLogger(ansi: ansi); + /// + /// If [logTime] is `true`, this logger will display the time of the message. + factory Logger.verbose({Ansi ansi, bool logTime: true}) { + return new VerboseLogger(ansi: ansi, logTime: logTime); + } Ansi get ansi; @@ -75,9 +86,9 @@ abstract class Logger { /// Start an indeterminate progress display. Progress progress(String message); - void _progressFinished(Progress progress); /// Flush any un-written output. + @Deprecated('This method will be removed in the future') void flush(); } @@ -86,7 +97,7 @@ abstract class Progress { final String message; final Stopwatch _stopwatch; - Progress._(this.message) : _stopwatch = new Stopwatch()..start(); + Progress(this.message) : _stopwatch = new Stopwatch()..start(); Duration get elapsed => _stopwatch.elapsed; @@ -97,10 +108,10 @@ abstract class Progress { void cancel(); } -class _StandardLogger implements Logger { +class StandardLogger implements Logger { Ansi ansi; - _StandardLogger({this.ansi}) { + StandardLogger({this.ansi}) { ansi ??= new Ansi(Ansi.terminalSupportsAnsi); } @@ -109,67 +120,68 @@ class _StandardLogger implements Logger { Progress _currentProgress; void stderr(String message) { + if (_currentProgress != null) { + Progress progress = _currentProgress; + _currentProgress = null; + progress.cancel(); + } + io.stderr.writeln(message); - _currentProgress?.cancel(); - _currentProgress = null; } void stdout(String message) { + if (_currentProgress != null) { + Progress progress = _currentProgress; + _currentProgress = null; + progress.cancel(); + } + print(message); - _currentProgress?.cancel(); - _currentProgress = null; } void trace(String message) {} Progress progress(String message) { - _currentProgress?.cancel(); - _currentProgress = null; + if (_currentProgress != null) { + Progress progress = _currentProgress; + _currentProgress = null; + progress.cancel(); + } Progress progress = ansi.useAnsi - ? new _AnsiProgress(this, ansi, message) - : new _SimpleProgress(this, message); + ? new AnsiProgress(ansi, message) + : new SimpleProgress(this, message); _currentProgress = progress; return progress; } - void _progressFinished(Progress progress) { - if (_currentProgress == progress) { - _currentProgress = null; - } - } - + @Deprecated('This method will be removed in the future') void flush() {} } -class _SimpleProgress extends Progress { +class SimpleProgress extends Progress { final Logger logger; - _SimpleProgress(this.logger, String message) : super._(message) { + SimpleProgress(this.logger, String message) : super(message) { logger.stdout('$message...'); } @override - void cancel() { - logger._progressFinished(this); - } + void cancel() {} @override - void finish({String message, bool showTiming}) { - logger._progressFinished(this); - } + void finish({String message, bool showTiming}) {} } -class _AnsiProgress extends Progress { +class AnsiProgress extends Progress { static const List kAnimationItems = const ['/', '-', '\\', '|']; - final Logger logger; final Ansi ansi; int _index = 0; Timer _timer; - _AnsiProgress(this.logger, this.ansi, String message) : super._(message) { + AnsiProgress(this.ansi, String message) : super(message) { io.stdout.write('${message}... '.padRight(40)); _timer = new Timer.periodic(new Duration(milliseconds: 80), (t) { @@ -185,7 +197,6 @@ class _AnsiProgress extends Progress { if (_timer.isActive) { _timer.cancel(); _updateDisplay(cancelled: true); - logger._progressFinished(this); } } @@ -194,7 +205,6 @@ class _AnsiProgress extends Progress { if (_timer.isActive) { _timer.cancel(); _updateDisplay(isFinal: true, message: message, showTiming: showTiming); - logger._progressFinished(this); } } @@ -222,52 +232,59 @@ class _AnsiProgress extends Progress { } } -class _VerboseLogger implements Logger { +class VerboseLogger implements Logger { Ansi ansi; + bool logTime; Stopwatch _timer; - String _previousErr; - String _previousMsg; - - _VerboseLogger({this.ansi}) { + VerboseLogger({this.ansi, this.logTime}) { ansi ??= new Ansi(Ansi.terminalSupportsAnsi); + logTime ??= false; + _timer = new Stopwatch()..start(); } bool get isVerbose => true; - void stderr(String message) { - flush(); - _previousErr = '${ansi.red}$message${ansi.none}'; + void stdout(String message) { + io.stdout.writeln('${_createPrefix()}$message'); } - void stdout(String message) { - flush(); - _previousMsg = message; + void stderr(String message) { + io.stderr.writeln('${_createPrefix()}${ansi.red}$message${ansi.none}'); } void trace(String message) { - flush(); - _previousMsg = '${ansi.gray}$message${ansi.none}'; + io.stdout.writeln('${_createPrefix()}${ansi.gray}$message${ansi.none}'); } - Progress progress(String message) => new _SimpleProgress(this, message); + Progress progress(String message) => new SimpleProgress(this, message); - void _progressFinished(Progress progress) {} + @Deprecated('This method will be removed in the future') + void flush() {} - void flush() { - if (_previousErr != null) { - io.stderr.writeln('${_createTag()} $_previousErr'); - _previousErr = null; - } else if (_previousMsg != null) { - io.stdout.writeln('${_createTag()} $_previousMsg'); - _previousMsg = null; + String _createPrefix() { + if (!logTime) { + return ''; } - } - String _createTag() { int millis = _timer.elapsedMilliseconds; - _timer.reset(); - return '[${millis.toString().padLeft(4)} ms]'; + int seconds = millis ~/ 1000; + int minutes = seconds ~/ 60; + + millis = millis % 1000; + seconds = seconds % 60; + + StringBuffer buf = new StringBuffer(); + if (minutes > 0) { + buf.write(minutes); + buf.write(':'); + } + + buf.write(seconds.toString().padLeft(minutes > 0 ? 2 : 1, '0')); + buf.write('.'); + buf.write(millis.toString().padLeft(3, '0')); + + return '[${buf.toString().padLeft(9)}] '; } } diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index d7ee512e4..d274ae6fa 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.1.2+1 +version: 0.1.3 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh index 0b0aef98d..59a283c04 100755 --- a/pkgs/cli_util/tool/travis.sh +++ b/pkgs/cli_util/tool/travis.sh @@ -15,6 +15,9 @@ dartanalyzer --fatal-warnings \ # Run the tests. dart test/cli_util_test.dart +# Ensure we can run in Dart 2. +dart --preview-dart-2 example/main.dart + # Install dart_coveralls; gather and send coverage data. if [ "$COVERALLS_TOKEN" ]; then pub global activate dart_coveralls From 173b5fd1b6c74ccd5467417664a1b2260d5a9846 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 14 May 2018 16:38:53 -0700 Subject: [PATCH 045/110] update the timestamp message --- pkgs/cli_util/lib/cli_logging.dart | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 539248537..9646cd6dc 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -268,23 +268,19 @@ class VerboseLogger implements Logger { return ''; } - int millis = _timer.elapsedMilliseconds; - int seconds = millis ~/ 1000; + double seconds = _timer.elapsedMilliseconds / 1000.0; int minutes = seconds ~/ 60; - - millis = millis % 1000; - seconds = seconds % 60; + seconds -= minutes * 60.0; StringBuffer buf = new StringBuffer(); if (minutes > 0) { - buf.write(minutes); - buf.write(':'); + buf.write((minutes % 60)); + buf.write('m '); } - buf.write(seconds.toString().padLeft(minutes > 0 ? 2 : 1, '0')); - buf.write('.'); - buf.write(millis.toString().padLeft(3, '0')); + buf.write(seconds.toStringAsFixed(3).padLeft(minutes > 0 ? 6 : 1, '0')); + buf.write('s'); - return '[${buf.toString().padLeft(9)}] '; + return '[${buf.toString().padLeft(11)}] '; } } From 25509c47572d3f9701871b52bd6d0db14658df1b Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 16 May 2018 14:23:42 -0700 Subject: [PATCH 046/110] review comments --- pkgs/cli_util/example/main.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/cli_util/example/main.dart b/pkgs/cli_util/example/main.dart index afafdc3ba..71c015687 100644 --- a/pkgs/cli_util/example/main.dart +++ b/pkgs/cli_util/example/main.dart @@ -21,6 +21,4 @@ main(List args) async { progress.finish(showTiming: true); logger.stdout('All ${logger.ansi.emphasized('done')}.'); - // ignore: deprecated_member_use - logger.flush(); } From 3003994213bf9c58dc1a24e0bbf0bda1a4feb0c8 Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Wed, 30 May 2018 15:32:40 +0200 Subject: [PATCH 047/110] Fix dart:io constants. (dart-lang/cli_util#32) * Stop using deprecated upper-case constant name. --- pkgs/cli_util/CHANGELOG.md | 3 +++ pkgs/cli_util/lib/cli_logging.dart | 2 +- pkgs/cli_util/pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 338c92c04..6536daf18 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.3+1 +- Update Dart SDK to 2.0.0-dev. + ## 0.1.3 - In verbose mode, instead of printing the diff from the last log message, print the total time since the tool started diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 9646cd6dc..6254aaf94 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -15,7 +15,7 @@ class Ansi { /// Return whether the current stdout terminal supports ANSI escape sequences. static bool get terminalSupportsAnsi { return io.stdout.supportsAnsiEscapes && - io.stdioType(io.stdout) == io.StdioType.TERMINAL; + io.stdioType(io.stdout) == io.StdioType.terminal; } final bool useAnsi; diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index d274ae6fa..2fb901506 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -5,7 +5,7 @@ description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: - sdk: '>=1.11.0 <2.0.0' + sdk: '>=2.0.0-dev.55.0 <3.0.0' dependencies: path: '>=1.0.0 <2.0.0' From 12f41e637eade83490cea22ebb035e76fe14da0c Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Thu, 21 Jun 2018 13:18:32 -0700 Subject: [PATCH 048/110] remove preview-dart2 flag --- pkgs/cli_util/tool/travis.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh index 59a283c04..9ae335f6e 100755 --- a/pkgs/cli_util/tool/travis.sh +++ b/pkgs/cli_util/tool/travis.sh @@ -15,8 +15,8 @@ dartanalyzer --fatal-warnings \ # Run the tests. dart test/cli_util_test.dart -# Ensure we can run in Dart 2. -dart --preview-dart-2 example/main.dart +# Ensure we can run. +dart example/main.dart # Install dart_coveralls; gather and send coverage data. if [ "$COVERALLS_TOKEN" ]; then From a9046a079667a161e1e657e303b4123a252e1732 Mon Sep 17 00:00:00 2001 From: pq Date: Mon, 2 Jul 2018 16:34:41 -0700 Subject: [PATCH 049/110] goodbye `strong` --- pkgs/cli_util/analysis_options.yaml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 pkgs/cli_util/analysis_options.yaml diff --git a/pkgs/cli_util/analysis_options.yaml b/pkgs/cli_util/analysis_options.yaml deleted file mode 100644 index a10d4c5a0..000000000 --- a/pkgs/cli_util/analysis_options.yaml +++ /dev/null @@ -1,2 +0,0 @@ -analyzer: - strong-mode: true From 6541f2552cf92aa85af950f62acedafdb6a80776 Mon Sep 17 00:00:00 2001 From: pq Date: Mon, 16 Jul 2018 14:19:53 -0700 Subject: [PATCH 050/110] 0.1.3+2 --- pkgs/cli_util/CHANGELOG.md | 3 +++ pkgs/cli_util/pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 6536daf18..49ecbbc42 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.3+2 +- Update Dart SDK constraint to < 3.0.0. + ## 0.1.3+1 - Update Dart SDK to 2.0.0-dev. diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 2fb901506..627cfaefe 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.1.3 +version: 0.1.3+2 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From d2f6fa934e86f24c7aeba5f6b9d2bd3f3bc63dcc Mon Sep 17 00:00:00 2001 From: pq Date: Mon, 16 Jul 2018 14:32:14 -0700 Subject: [PATCH 051/110] bumped test dep --- pkgs/cli_util/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 627cfaefe..db6573a57 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -11,4 +11,4 @@ dependencies: path: '>=1.0.0 <2.0.0' dev_dependencies: - test: ^0.12.0 + test: ^1.0.0 From 17f714a7727e373d3aa6d62a19c482322b38c835 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 29 Apr 2019 11:25:58 -0700 Subject: [PATCH 052/110] Test on oldest supported SDK (dart-lang/cli_util#37) --- pkgs/cli_util/.gitignore | 10 +--------- pkgs/cli_util/.travis.yml | 4 ++-- pkgs/cli_util/codereview.settings | 3 --- pkgs/cli_util/pubspec.yaml | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) delete mode 100644 pkgs/cli_util/codereview.settings diff --git a/pkgs/cli_util/.gitignore b/pkgs/cli_util/.gitignore index 3cc62a7ce..49ce72d76 100644 --- a/pkgs/cli_util/.gitignore +++ b/pkgs/cli_util/.gitignore @@ -1,11 +1,3 @@ -.buildlog -.DS_Store -.idea .dart_tool/ -.project -.settings -build/ -doc/api/ -packages -pubspec.lock .packages +pubspec.lock diff --git a/pkgs/cli_util/.travis.yml b/pkgs/cli_util/.travis.yml index 3c087ca7e..b46f900a8 100644 --- a/pkgs/cli_util/.travis.yml +++ b/pkgs/cli_util/.travis.yml @@ -1,9 +1,9 @@ language: dart dart: + - 2.0.0 - dev + script: ./tool/travis.sh -dist: trusty -sudo: false branches: only: diff --git a/pkgs/cli_util/codereview.settings b/pkgs/cli_util/codereview.settings deleted file mode 100644 index 2b2da2deb..000000000 --- a/pkgs/cli_util/codereview.settings +++ /dev/null @@ -1,3 +0,0 @@ -CODE_REVIEW_SERVER: https://chromiumcodereview.appspot.com/ -VIEW_VC: https://github.com/dart-lang/cli_util/commit/ -CC_LIST: reviews@dartlang.org diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index db6573a57..5e06af165 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -5,7 +5,7 @@ description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: - sdk: '>=2.0.0-dev.55.0 <3.0.0' + sdk: '>=2.0.0 <3.0.0' dependencies: path: '>=1.0.0 <2.0.0' From 72f87c2355a0b03b1414a1cffa023fc7350b31be Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 4 May 2020 15:57:46 -0700 Subject: [PATCH 053/110] Add Ansi.reversed getter, and prepare to publish version 0.1.4. (dart-lang/cli_util#39) --- pkgs/cli_util/CHANGELOG.md | 3 +++ pkgs/cli_util/lib/cli_logging.dart | 2 ++ pkgs/cli_util/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 49ecbbc42..941b33f2e 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.4 +- Add `Ansi.reversed` getter. + ## 0.1.3+2 - Update Dart SDK constraint to < 3.0.0. diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 6254aaf94..8b57bf0bc 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -42,6 +42,8 @@ class Ansi { String get bold => _code('\u001b[1m'); + String get reversed => _code('\u001b[7m'); + String get backspace => '\b'; String get bullet => io.stdout.supportsAnsiEscapes ? '•' : '-'; diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 5e06af165..29b3e5f4a 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.1.3+2 +version: 0.1.4 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From a3175b05c0e134b3e864c8f118f9986064375b5d Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Wed, 3 Jun 2020 14:04:40 -0700 Subject: [PATCH 054/110] Add write() and writeCharCode() to Logger (dart-lang/cli_util#42) Add write() and writeCharCode() methods to Logger --- pkgs/cli_util/CHANGELOG.md | 9 ++++++ pkgs/cli_util/lib/cli_logging.dart | 44 ++++++++++++++++++++++++------ pkgs/cli_util/pubspec.yaml | 2 +- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 941b33f2e..398fd73cc 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,13 +1,22 @@ +## 0.2.0 + +- Add `Logger.write` and `Logger.writeCharCode` methods which write without + printing a trailing newline. + ## 0.1.4 + - Add `Ansi.reversed` getter. ## 0.1.3+2 + - Update Dart SDK constraint to < 3.0.0. ## 0.1.3+1 + - Update Dart SDK to 2.0.0-dev. ## 0.1.3 + - In verbose mode, instead of printing the diff from the last log message, print the total time since the tool started - Change to not buffer the last log message sent in verbose logging mode diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 8b57bf0bc..562971bd4 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -86,6 +86,12 @@ abstract class Logger { /// Print trace output. void trace(String message); + /// Print text to stdout, without a trailing newline. + void write(String message); + + /// Print a character code to stdout, without a trailing newline. + void writeCharCode(int charCode); + /// Start an indeterminate progress display. Progress progress(String message); @@ -122,27 +128,39 @@ class StandardLogger implements Logger { Progress _currentProgress; void stderr(String message) { - if (_currentProgress != null) { - Progress progress = _currentProgress; - _currentProgress = null; - progress.cancel(); - } + _cancelProgress(); io.stderr.writeln(message); } void stdout(String message) { + _cancelProgress(); + + print(message); + } + + void trace(String message) {} + + void write(String message) { + _cancelProgress(); + + io.stdout.write(message); + } + + void writeCharCode(int charCode) { + _cancelProgress(); + + io.stdout.writeCharCode(charCode); + } + + void _cancelProgress() { if (_currentProgress != null) { Progress progress = _currentProgress; _currentProgress = null; progress.cancel(); } - - print(message); } - void trace(String message) {} - Progress progress(String message) { if (_currentProgress != null) { Progress progress = _currentProgress; @@ -260,6 +278,14 @@ class VerboseLogger implements Logger { io.stdout.writeln('${_createPrefix()}${ansi.gray}$message${ansi.none}'); } + void write(String message) { + io.stdout.write(message); + } + + void writeCharCode(int charCode) { + io.stdout.writeCharCode(charCode); + } + Progress progress(String message) => new SimpleProgress(this, message); @Deprecated('This method will be removed in the future') diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 29b3e5f4a..e127a9b00 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.1.4 +version: 0.2.0 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From 03fa1d57525214e8f1573fed3e13d25ac7e574db Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 19 Aug 2020 13:52:06 -0700 Subject: [PATCH 055/110] Fix outdated URIs, remove gratuitous title in readme (dart-lang/cli_util#46) --- pkgs/cli_util/CHANGELOG.md | 2 ++ pkgs/cli_util/README.md | 8 +++----- pkgs/cli_util/pubspec.yaml | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 398fd73cc..7bbb72db6 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,5 @@ +## 0.2.1 + ## 0.2.0 - Add `Logger.write` and `Logger.writeCharCode` methods which write without diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index 0256472ae..b13d3fd2c 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -1,13 +1,11 @@ -# cli_util - -A library to help in building Dart command-line apps. +A package to help in building Dart command-line apps. In particular, `cli_util` provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the [analyzer][analyzer]). [![Build Status](https://travis-ci.org/dart-lang/cli_util.svg)](https://travis-ci.org/dart-lang/cli_util) -[![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dartlang.org/packages/cli_util) +[![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) ## Locating the Dart SDK @@ -63,5 +61,5 @@ main(List args) async { Please file feature requests and bugs at the [issue tracker][tracker]. -[analyzer]: https://pub.dartlang.org/packages/analyzer +[analyzer]: https://pub.dev/packages/analyzer [tracker]: https://github.com/dart-lang/cli_util/issues diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index e127a9b00..c4e2e601e 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,6 +1,5 @@ name: cli_util -version: 0.2.0 -author: Dart Team +version: 0.2.1-dev description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util From d84c05fb7e60fc0440c62a785a86d3344a7c6046 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 19 Aug 2020 13:52:53 -0700 Subject: [PATCH 056/110] Enable and fix default pedantic lints (dart-lang/cli_util#47) --- pkgs/cli_util/analysis_options.yaml | 5 ++ pkgs/cli_util/example/main.dart | 12 ++--- pkgs/cli_util/lib/cli_logging.dart | 66 +++++++++++++++++---------- pkgs/cli_util/lib/cli_util.dart | 18 ++++---- pkgs/cli_util/pubspec.yaml | 1 + pkgs/cli_util/test/cli_util_test.dart | 8 ++-- 6 files changed, 67 insertions(+), 43 deletions(-) create mode 100644 pkgs/cli_util/analysis_options.yaml diff --git a/pkgs/cli_util/analysis_options.yaml b/pkgs/cli_util/analysis_options.yaml new file mode 100644 index 000000000..b4ab8c9e2 --- /dev/null +++ b/pkgs/cli_util/analysis_options.yaml @@ -0,0 +1,5 @@ +include: package:pedantic/analysis_options.yaml + +analyzer: + strong-mode: + implicit-casts: false diff --git a/pkgs/cli_util/example/main.dart b/pkgs/cli_util/example/main.dart index 71c015687..c0ae0bb07 100644 --- a/pkgs/cli_util/example/main.dart +++ b/pkgs/cli_util/example/main.dart @@ -6,18 +6,18 @@ import 'dart:async'; import 'package:cli_util/cli_logging.dart'; -main(List args) async { - bool verbose = args.contains('-v'); - Logger logger = verbose ? new Logger.verbose() : new Logger.standard(); +Future main(List args) async { + var verbose = args.contains('-v'); + var logger = verbose ? Logger.verbose() : Logger.standard(); logger.stdout('Hello world!'); logger.trace('message 1'); - await new Future.delayed(new Duration(milliseconds: 200)); + await Future.delayed(Duration(milliseconds: 200)); logger.trace('message 2'); logger.trace('message 3'); - Progress progress = logger.progress('doing some work'); - await new Future.delayed(new Duration(seconds: 2)); + var progress = logger.progress('doing some work'); + await Future.delayed(Duration(seconds: 2)); progress.finish(showTiming: true); logger.stdout('All ${logger.ansi.emphasized('done')}.'); diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 562971bd4..44b8ca9d7 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -64,13 +64,13 @@ class Ansi { /// standard status messages, trace level output, and indeterminate progress. abstract class Logger { /// Create a normal [Logger]; this logger will not display trace level output. - factory Logger.standard({Ansi ansi}) => new StandardLogger(ansi: ansi); + factory Logger.standard({Ansi ansi}) => StandardLogger(ansi: ansi); /// Create a [Logger] that will display trace level output. /// /// If [logTime] is `true`, this logger will display the time of the message. - factory Logger.verbose({Ansi ansi, bool logTime: true}) { - return new VerboseLogger(ansi: ansi, logTime: logTime); + factory Logger.verbose({Ansi ansi, bool logTime = true}) { + return VerboseLogger(ansi: ansi, logTime: logTime); } Ansi get ansi; @@ -105,7 +105,7 @@ abstract class Progress { final String message; final Stopwatch _stopwatch; - Progress(this.message) : _stopwatch = new Stopwatch()..start(); + Progress(this.message) : _stopwatch = Stopwatch()..start(); Duration get elapsed => _stopwatch.elapsed; @@ -117,36 +117,43 @@ abstract class Progress { } class StandardLogger implements Logger { + @override Ansi ansi; StandardLogger({this.ansi}) { - ansi ??= new Ansi(Ansi.terminalSupportsAnsi); + ansi ??= Ansi(Ansi.terminalSupportsAnsi); } + @override bool get isVerbose => false; Progress _currentProgress; + @override void stderr(String message) { _cancelProgress(); io.stderr.writeln(message); } + @override void stdout(String message) { _cancelProgress(); print(message); } + @override void trace(String message) {} + @override void write(String message) { _cancelProgress(); io.stdout.write(message); } + @override void writeCharCode(int charCode) { _cancelProgress(); @@ -155,26 +162,28 @@ class StandardLogger implements Logger { void _cancelProgress() { if (_currentProgress != null) { - Progress progress = _currentProgress; + var progress = _currentProgress; _currentProgress = null; progress.cancel(); } } + @override Progress progress(String message) { if (_currentProgress != null) { - Progress progress = _currentProgress; + var progress = _currentProgress; _currentProgress = null; progress.cancel(); } - Progress progress = ansi.useAnsi - ? new AnsiProgress(ansi, message) - : new SimpleProgress(this, message); + var progress = ansi.useAnsi + ? AnsiProgress(ansi, message) + : SimpleProgress(this, message); _currentProgress = progress; return progress; } + @override @Deprecated('This method will be removed in the future') void flush() {} } @@ -194,7 +203,7 @@ class SimpleProgress extends Progress { } class AnsiProgress extends Progress { - static const List kAnimationItems = const ['/', '-', '\\', '|']; + static const List kAnimationItems = ['/', '-', '\\', '|']; final Ansi ansi; @@ -204,7 +213,7 @@ class AnsiProgress extends Progress { AnsiProgress(this.ansi, String message) : super(message) { io.stdout.write('${message}... '.padRight(40)); - _timer = new Timer.periodic(new Duration(milliseconds: 80), (t) { + _timer = Timer.periodic(Duration(milliseconds: 80), (t) { _index++; _updateDisplay(); }); @@ -221,7 +230,7 @@ class AnsiProgress extends Progress { } @override - void finish({String message, bool showTiming: false}) { + void finish({String message, bool showTiming = false}) { if (_timer.isActive) { _timer.cancel(); _updateDisplay(isFinal: true, message: message, showTiming: showTiming); @@ -229,11 +238,11 @@ class AnsiProgress extends Progress { } void _updateDisplay( - {bool isFinal: false, - bool cancelled: false, + {bool isFinal = false, + bool cancelled = false, String message, - bool showTiming: false}) { - String char = kAnimationItems[_index % kAnimationItems.length]; + bool showTiming = false}) { + var char = kAnimationItems[_index % kAnimationItems.length]; if (isFinal || cancelled) { char = ''; } @@ -242,7 +251,7 @@ class AnsiProgress extends Progress { if (message != null) { io.stdout.write(message.isEmpty ? ' ' : message); } else if (showTiming) { - String time = (elapsed.inMilliseconds / 1000.0).toStringAsFixed(1); + var time = (elapsed.inMilliseconds / 1000.0).toStringAsFixed(1); io.stdout.write('${time}s'); } else { io.stdout.write(' '); @@ -253,41 +262,50 @@ class AnsiProgress extends Progress { } class VerboseLogger implements Logger { + @override Ansi ansi; bool logTime; Stopwatch _timer; VerboseLogger({this.ansi, this.logTime}) { - ansi ??= new Ansi(Ansi.terminalSupportsAnsi); + ansi ??= Ansi(Ansi.terminalSupportsAnsi); logTime ??= false; - _timer = new Stopwatch()..start(); + _timer = Stopwatch()..start(); } + @override bool get isVerbose => true; + @override void stdout(String message) { io.stdout.writeln('${_createPrefix()}$message'); } + @override void stderr(String message) { io.stderr.writeln('${_createPrefix()}${ansi.red}$message${ansi.none}'); } + @override void trace(String message) { io.stdout.writeln('${_createPrefix()}${ansi.gray}$message${ansi.none}'); } + @override void write(String message) { io.stdout.write(message); } + @override void writeCharCode(int charCode) { io.stdout.writeCharCode(charCode); } - Progress progress(String message) => new SimpleProgress(this, message); + @override + Progress progress(String message) => SimpleProgress(this, message); + @override @Deprecated('This method will be removed in the future') void flush() {} @@ -296,11 +314,11 @@ class VerboseLogger implements Logger { return ''; } - double seconds = _timer.elapsedMilliseconds / 1000.0; - int minutes = seconds ~/ 60; + var seconds = _timer.elapsedMilliseconds / 1000.0; + var minutes = seconds ~/ 60; seconds -= minutes * 60.0; - StringBuffer buf = new StringBuffer(); + var buf = StringBuffer(); if (minutes > 0) { buf.write((minutes % 60)); buf.write('m '); diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index d58be7a72..45c97f240 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -23,37 +23,37 @@ import 'src/utils.dart'; Directory getSdkDir([List cliArgs]) { // Look for --dart-sdk on the command line. if (cliArgs != null) { - int index = cliArgs.indexOf('--dart-sdk'); + var index = cliArgs.indexOf('--dart-sdk'); if (index != -1 && (index + 1 < cliArgs.length)) { - return new Directory(cliArgs[index + 1]); + return Directory(cliArgs[index + 1]); } - for (String arg in cliArgs) { + for (var arg in cliArgs) { if (arg.startsWith('--dart-sdk=')) { - return new Directory(arg.substring('--dart-sdk='.length)); + return Directory(arg.substring('--dart-sdk='.length)); } } } // Look in env['DART_SDK'] if (Platform.environment['DART_SDK'] != null) { - return new Directory(Platform.environment['DART_SDK']); + return Directory(Platform.environment['DART_SDK']); } // Look relative to the dart executable. - File platformExecutable = new File(Platform.executable); - Directory sdkDirectory = platformExecutable.parent.parent; + var platformExecutable = File(Platform.executable); + var sdkDirectory = platformExecutable.parent.parent; if (isSdkDir(sdkDirectory)) return sdkDirectory; // Handle the case where Platform.executable is a sibling of the SDK directory // (this happens during internal testing). sdkDirectory = - new Directory(path.join(platformExecutable.parent.path, 'dart-sdk')); + Directory(path.join(platformExecutable.parent.path, 'dart-sdk')); if (isSdkDir(sdkDirectory)) return sdkDirectory; // Use `Platform.resolvedExecutable`. - return new Directory(getSdkPath()); + return Directory(getSdkPath()); } /// Return the path to the current Dart SDK. diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index c4e2e601e..e3ef70e57 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -10,4 +10,5 @@ dependencies: path: '>=1.0.0 <2.0.0' dev_dependencies: + pedantic: ^1.0.0 test: ^1.0.0 diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index eb27978fc..2c2c77096 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -13,14 +13,14 @@ void main() => defineTests(); void defineTests() { group('getSdkDir', () { test('arg parsing', () { - // ignore: deprecated_member_use + // ignore: deprecated_member_use, deprecated_member_use_from_same_package expect(getSdkDir(['--dart-sdk', '/dart/sdk']).path, equals('/dart/sdk')); - // ignore: deprecated_member_use + // ignore: deprecated_member_use, deprecated_member_use_from_same_package expect(getSdkDir(['--dart-sdk=/dart/sdk']).path, equals('/dart/sdk')); }); test('finds the SDK without cli args', () { - // ignore: deprecated_member_use + // ignore: deprecated_member_use, deprecated_member_use_from_same_package expect(getSdkDir(), isNotNull); }); }); @@ -33,7 +33,7 @@ void defineTests() { group('utils', () { test('isSdkDir', () { - expect(isSdkDir(new Directory(getSdkPath())), true); + expect(isSdkDir(Directory(getSdkPath())), true); }); }); } From 81179cf3177c54e53717f772d0ce28438e09dbb3 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 2 Nov 2020 09:20:09 -0800 Subject: [PATCH 057/110] add support for github actions (dart-lang/cli_util#49) add support for github actions --- pkgs/cli_util/.github/workflows/build.yaml | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkgs/cli_util/.github/workflows/build.yaml diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml new file mode 100644 index 000000000..01d9da75f --- /dev/null +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -0,0 +1,29 @@ +name: Dart + +on: + pull_request: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + container: + image: google/dart:beta + + steps: + - uses: actions/checkout@v2 + + - name: pub get + run: pub get + + - name: dart format + run: dart format --output=none --set-exit-if-changed . + + - name: dart analyze + run: dart analyze --fatal-infos + + - name: dart test + run: dart test From 87a692d5098022bc8f8fcb32241b087e4436c735 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 2 Nov 2020 12:05:47 -0800 Subject: [PATCH 058/110] remove travis support (dart-lang/cli_util#50) --- pkgs/cli_util/.status | 3 --- pkgs/cli_util/.travis.yml | 10 ---------- pkgs/cli_util/README.md | 2 +- pkgs/cli_util/tool/travis.sh | 29 ----------------------------- 4 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 pkgs/cli_util/.status delete mode 100644 pkgs/cli_util/.travis.yml delete mode 100755 pkgs/cli_util/tool/travis.sh diff --git a/pkgs/cli_util/.status b/pkgs/cli_util/.status deleted file mode 100644 index 59f35730c..000000000 --- a/pkgs/cli_util/.status +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. diff --git a/pkgs/cli_util/.travis.yml b/pkgs/cli_util/.travis.yml deleted file mode 100644 index b46f900a8..000000000 --- a/pkgs/cli_util/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: dart -dart: - - 2.0.0 - - dev - -script: ./tool/travis.sh - -branches: - only: - - master diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index b13d3fd2c..d14ce5230 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -4,7 +4,7 @@ In particular, `cli_util` provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the [analyzer][analyzer]). -[![Build Status](https://travis-ci.org/dart-lang/cli_util.svg)](https://travis-ci.org/dart-lang/cli_util) +[![Build Status](https://github.com/dart-lang/cli_util/workflows/Dart/badge.svg)](https://github.com/dart-lang/cli_util/actions) [![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) ## Locating the Dart SDK diff --git a/pkgs/cli_util/tool/travis.sh b/pkgs/cli_util/tool/travis.sh deleted file mode 100755 index 9ae335f6e..000000000 --- a/pkgs/cli_util/tool/travis.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -# Fast fail the script on failures. -set -e - -# Verify that the libraries are error free. -dartanalyzer --fatal-warnings \ - lib/cli_util.dart \ - test/cli_util_test.dart - -# Run the tests. -dart test/cli_util_test.dart - -# Ensure we can run. -dart example/main.dart - -# Install dart_coveralls; gather and send coverage data. -if [ "$COVERALLS_TOKEN" ]; then - pub global activate dart_coveralls - pub global run dart_coveralls report \ - --token $COVERALLS_TOKEN \ - --retry 2 \ - --exclude-test-files \ - test/cli_util_test.dart -fi From ac71c4e4c9bd792c054a18a615a1c730ebd46394 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 2 Nov 2020 13:05:32 -0800 Subject: [PATCH 059/110] Add cron task (dart-lang/cli_util#51) --- pkgs/cli_util/.github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 01d9da75f..43245b091 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -1,6 +1,9 @@ name: Dart on: + schedule: + # “At 00:00 (UTC) on Sunday.” + - cron: '0 0 * * 0' pull_request: push: branches: From abfe6222a6d4161e7137bd63b04c95edcd660032 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Mon, 9 Nov 2020 10:55:27 -0800 Subject: [PATCH 060/110] nnbd migration (dart-lang/cli_util#52) * nnbd migration * bump to dev container * updated version * + notes --- pkgs/cli_util/.github/workflows/build.yaml | 2 +- pkgs/cli_util/CHANGELOG.md | 3 ++ pkgs/cli_util/lib/cli_logging.dart | 45 +++++++++------------- pkgs/cli_util/lib/cli_util.dart | 7 ++-- pkgs/cli_util/pubspec.yaml | 11 +++--- 5 files changed, 32 insertions(+), 36 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 43245b091..0ed5c5acf 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest container: - image: google/dart:beta + image: google/dart:dev steps: - uses: actions/checkout@v2 diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 7bbb72db6..546b78e6b 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.3.0-nullsafety +- Updated to support 2.12.0 and null safety. + ## 0.2.1 ## 0.2.0 diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 44b8ca9d7..106d51e52 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -13,10 +13,9 @@ import 'dart:io' as io; /// sequences. class Ansi { /// Return whether the current stdout terminal supports ANSI escape sequences. - static bool get terminalSupportsAnsi { - return io.stdout.supportsAnsiEscapes && - io.stdioType(io.stdout) == io.StdioType.terminal; - } + static bool get terminalSupportsAnsi => + io.stdout.supportsAnsiEscapes && + io.stdioType(io.stdout) == io.StdioType.terminal; final bool useAnsi; @@ -64,12 +63,12 @@ class Ansi { /// standard status messages, trace level output, and indeterminate progress. abstract class Logger { /// Create a normal [Logger]; this logger will not display trace level output. - factory Logger.standard({Ansi ansi}) => StandardLogger(ansi: ansi); + factory Logger.standard({Ansi? ansi}) => StandardLogger(ansi: ansi); /// Create a [Logger] that will display trace level output. /// /// If [logTime] is `true`, this logger will display the time of the message. - factory Logger.verbose({Ansi ansi, bool logTime = true}) { + factory Logger.verbose({Ansi? ansi, bool logTime = true}) { return VerboseLogger(ansi: ansi, logTime: logTime); } @@ -110,7 +109,7 @@ abstract class Progress { Duration get elapsed => _stopwatch.elapsed; /// Finish the indeterminate progress display. - void finish({String message, bool showTiming}); + void finish({String? message, bool showTiming = false}); /// Cancel the indeterminate progress display. void cancel(); @@ -120,14 +119,12 @@ class StandardLogger implements Logger { @override Ansi ansi; - StandardLogger({this.ansi}) { - ansi ??= Ansi(Ansi.terminalSupportsAnsi); - } + StandardLogger({Ansi? ansi}) : ansi = ansi ?? Ansi(Ansi.terminalSupportsAnsi); @override bool get isVerbose => false; - Progress _currentProgress; + Progress? _currentProgress; @override void stderr(String message) { @@ -161,8 +158,8 @@ class StandardLogger implements Logger { } void _cancelProgress() { - if (_currentProgress != null) { - var progress = _currentProgress; + var progress = _currentProgress; + if (progress != null) { _currentProgress = null; progress.cancel(); } @@ -170,11 +167,7 @@ class StandardLogger implements Logger { @override Progress progress(String message) { - if (_currentProgress != null) { - var progress = _currentProgress; - _currentProgress = null; - progress.cancel(); - } + _cancelProgress(); var progress = ansi.useAnsi ? AnsiProgress(ansi, message) @@ -199,7 +192,7 @@ class SimpleProgress extends Progress { void cancel() {} @override - void finish({String message, bool showTiming}) {} + void finish({String? message, bool showTiming = false}) {} } class AnsiProgress extends Progress { @@ -208,7 +201,7 @@ class AnsiProgress extends Progress { final Ansi ansi; int _index = 0; - Timer _timer; + late Timer _timer; AnsiProgress(this.ansi, String message) : super(message) { io.stdout.write('${message}... '.padRight(40)); @@ -230,7 +223,7 @@ class AnsiProgress extends Progress { } @override - void finish({String message, bool showTiming = false}) { + void finish({String? message, bool showTiming = false}) { if (_timer.isActive) { _timer.cancel(); _updateDisplay(isFinal: true, message: message, showTiming: showTiming); @@ -240,7 +233,7 @@ class AnsiProgress extends Progress { void _updateDisplay( {bool isFinal = false, bool cancelled = false, - String message, + String? message, bool showTiming = false}) { var char = kAnimationItems[_index % kAnimationItems.length]; if (isFinal || cancelled) { @@ -265,12 +258,10 @@ class VerboseLogger implements Logger { @override Ansi ansi; bool logTime; - Stopwatch _timer; - - VerboseLogger({this.ansi, this.logTime}) { - ansi ??= Ansi(Ansi.terminalSupportsAnsi); - logTime ??= false; + late Stopwatch _timer; + VerboseLogger({Ansi? ansi, this.logTime = false}) + : ansi = ansi ?? Ansi(Ansi.terminalSupportsAnsi) { _timer = Stopwatch()..start(); } diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 45c97f240..0cc408d93 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -20,7 +20,7 @@ import 'src/utils.dart'; /// /// Callers should generally prefer using the [getSdkPath] function. @Deprecated('Clients should generally prefer getSdkPath()') -Directory getSdkDir([List cliArgs]) { +Directory getSdkDir([List? cliArgs]) { // Look for --dart-sdk on the command line. if (cliArgs != null) { var index = cliArgs.indexOf('--dart-sdk'); @@ -37,8 +37,9 @@ Directory getSdkDir([List cliArgs]) { } // Look in env['DART_SDK'] - if (Platform.environment['DART_SDK'] != null) { - return Directory(Platform.environment['DART_SDK']); + var sdkLocation = Platform.environment['DART_SDK']; + if (sdkLocation != null) { + return Directory(sdkLocation); } // Look relative to the dart executable. diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index e3ef70e57..fbf30186a 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,14 +1,15 @@ name: cli_util -version: 0.2.1-dev +version: 0.3.0-nullsafety.0 description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util environment: - sdk: '>=2.0.0 <3.0.0' + sdk: '>=2.12.0-0 <3.0.0' dependencies: - path: '>=1.0.0 <2.0.0' + meta: ^1.3.0-nullsafety + path: ^1.8.0-nullsafety dev_dependencies: - pedantic: ^1.0.0 - test: ^1.0.0 + pedantic: ^1.10.0-nullsafety + test: ^1.16.0-nullsafety From 3568689d85878209fd61491636f624b5900f1409 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Mon, 9 Nov 2020 15:51:27 -0800 Subject: [PATCH 061/110] Use late final for _timer fields (dart-lang/cli_util#53) The field in `AnsiProgress`had been non-final so that it could be initialized in the constructor, the initialization expression needs access to `this`. With null safety this pattern can be expressed with a `late final` field. The field in `VerboseLogger` could have been `final` before the migration. --- pkgs/cli_util/CHANGELOG.md | 3 ++- pkgs/cli_util/lib/cli_logging.dart | 17 ++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 546b78e6b..4b6d8ce65 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,4 +1,5 @@ -## 0.3.0-nullsafety +## 0.3.0-nullsafety.0 + - Updated to support 2.12.0 and null safety. ## 0.2.1 diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 106d51e52..ae03fa1bc 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -201,16 +201,13 @@ class AnsiProgress extends Progress { final Ansi ansi; int _index = 0; - late Timer _timer; + late final _timer = Timer.periodic(Duration(milliseconds: 80), (t) { + _index++; + _updateDisplay(); + }); AnsiProgress(this.ansi, String message) : super(message) { io.stdout.write('${message}... '.padRight(40)); - - _timer = Timer.periodic(Duration(milliseconds: 80), (t) { - _index++; - _updateDisplay(); - }); - _updateDisplay(); } @@ -258,12 +255,10 @@ class VerboseLogger implements Logger { @override Ansi ansi; bool logTime; - late Stopwatch _timer; + final _timer = Stopwatch()..start(); VerboseLogger({Ansi? ansi, this.logTime = false}) - : ansi = ansi ?? Ansi(Ansi.terminalSupportsAnsi) { - _timer = Stopwatch()..start(); - } + : ansi = ansi ?? Ansi(Ansi.terminalSupportsAnsi); @override bool get isVerbose => true; From bc99ef9fa50df419abfd4e2dc3ccf8000dd193da Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 12 Nov 2020 14:27:36 -0800 Subject: [PATCH 062/110] Print dart version in CI job (dart-lang/cli_util#54) --- pkgs/cli_util/.github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 0ed5c5acf..36eb91362 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -19,6 +19,9 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Print Dart version + run: dart --version + - name: pub get run: pub get From 3d25ebd817ea890fef5ee399783f4bb96774a629 Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Fri, 5 Feb 2021 17:14:25 -0800 Subject: [PATCH 063/110] stable null safety release (dart-lang/cli_util#56) --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/pubspec.yaml | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 4b6d8ce65..92a3b2801 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0 + +- Stable null safety release. + ## 0.3.0-nullsafety.0 - Updated to support 2.12.0 and null safety. diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index fbf30186a..9386c55a0 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.3.0-nullsafety.0 +version: 0.3.0 description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util @@ -7,9 +7,9 @@ environment: sdk: '>=2.12.0-0 <3.0.0' dependencies: - meta: ^1.3.0-nullsafety - path: ^1.8.0-nullsafety + meta: ^1.3.0 + path: ^1.8.0 dev_dependencies: - pedantic: ^1.10.0-nullsafety - test: ^1.16.0-nullsafety + pedantic: ^1.10.0 + test: ^1.16.0 From 930a2af4dbb8d1eba204ca53f2f19834c96d7f6f Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Fri, 5 Feb 2021 18:01:43 -0800 Subject: [PATCH 064/110] remove optional `new`s (dart-lang/cli_util#57) --- pkgs/cli_util/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index d14ce5230..54d9d28e7 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -20,7 +20,7 @@ main(args) { String sdkPath = getSdkPath(); // Do stuff... For example, print version string - File versionFile = new File(path.join(sdkPath, 'version')); + File versionFile = File(path.join(sdkPath, 'version')); print(versionFile.readAsStringSync()); } ``` @@ -38,18 +38,18 @@ tasks, and optionally display the elapsed time when finished: ```dart import 'package:cli_util/cli_logging.dart'; -main(List args) async { +void main(List args) async { bool verbose = args.contains('-v'); - Logger logger = verbose ? new Logger.verbose() : new Logger.standard(); + Logger logger = verbose ? Logger.verbose() : Logger.standard(); logger.stdout('Hello world!'); logger.trace('message 1'); - await new Future.delayed(new Duration(milliseconds: 200)); + await Future.delayed(Duration(milliseconds: 200)); logger.trace('message 2'); logger.trace('message 3'); Progress progress = logger.progress('doing some work'); - await new Future.delayed(new Duration(seconds: 2)); + await Future.delayed(Duration(seconds: 2)); progress.finish(showTiming: true); logger.stdout('All ${logger.ansi.emphasized('done')}.'); From 5f748c1ed819ba0c9a75c184c3bb6cd626ef8be4 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 11 Mar 2021 11:05:06 -0800 Subject: [PATCH 065/110] Fix latest lints (dart-lang/cli_util#58) --- pkgs/cli_util/lib/cli_logging.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index ae03fa1bc..cd3a72e31 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -207,7 +207,7 @@ class AnsiProgress extends Progress { }); AnsiProgress(this.ansi, String message) : super(message) { - io.stdout.write('${message}... '.padRight(40)); + io.stdout.write('$message... '.padRight(40)); _updateDisplay(); } @@ -236,7 +236,7 @@ class AnsiProgress extends Progress { if (isFinal || cancelled) { char = ''; } - io.stdout.write('${ansi.backspace}${char}'); + io.stdout.write('${ansi.backspace}$char'); if (isFinal || cancelled) { if (message != null) { io.stdout.write(message.isEmpty ? ' ' : message); From 27ba5b35fed12d8f569d77e1fe500f1201f2f9aa Mon Sep 17 00:00:00 2001 From: Franklin Yow <58489007+franklinyow@users.noreply.github.com> Date: Thu, 1 Apr 2021 16:51:41 -0700 Subject: [PATCH 066/110] Update LICENSE (dart-lang/cli_util#59) Changes to comply with internal review --- pkgs/cli_util/LICENSE | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/LICENSE b/pkgs/cli_util/LICENSE index de31e1a0a..dbd2843a0 100644 --- a/pkgs/cli_util/LICENSE +++ b/pkgs/cli_util/LICENSE @@ -1,4 +1,5 @@ -Copyright 2015, the Dart project authors. All rights reserved. +Copyright 2015, the Dart project authors. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -9,7 +10,7 @@ met: copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. From 3ee2a44509581ea52fddb180cad980190b531384 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 5 May 2021 13:18:25 -0700 Subject: [PATCH 067/110] Fix frozen spinner (dart-lang/cli_util#61) Fixes dart-lang/cli_util#60 The `late final` field isn't instantiated until it is read, so without forcing instantiation in the constructor there is no timer updating the display. Move initialization back into the constructor. Other cleanup: - Remove the `_index` fields since it is otherwise identical to `_timer.ticks`. - Use a Github Action config that more closely matches our other packages. - Replace `homepage` with `repository` in the pubspec. There are no existing tests for the spinner, and adding one would be a large task - this code was not written with testability in mind. For now leave this untested. --- pkgs/cli_util/.github/workflows/build.yaml | 68 ++++++++++++++-------- pkgs/cli_util/CHANGELOG.md | 4 ++ pkgs/cli_util/lib/cli_logging.dart | 11 ++-- pkgs/cli_util/pubspec.yaml | 6 +- 4 files changed, 56 insertions(+), 33 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 36eb91362..34a090ab3 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -1,35 +1,55 @@ -name: Dart +name: Dart CI on: schedule: # “At 00:00 (UTC) on Sunday.” - cron: '0 0 * * 0' pull_request: + branches: [ master ] push: - branches: - - master + branches: [ master ] + +env: + PUB_ENVIRONMENT: bot.github jobs: - build: + analyze: runs-on: ubuntu-latest - - container: - image: google/dart:dev - + strategy: + fail-fast: false + matrix: + sdk: [dev] steps: - - uses: actions/checkout@v2 - - - name: Print Dart version - run: dart --version - - - name: pub get - run: pub get - - - name: dart format - run: dart format --output=none --set-exit-if-changed . - - - name: dart analyze - run: dart analyze --fatal-infos - - - name: dart test - run: dart test + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: dart pub get + - name: Check formatting + run: dart format --output=none --set-exit-if-changed . + if: always() && steps.install.outcome == 'success' + - name: Analyze code + run: dart analyze --fatal-infos + if: always() && steps.install.outcome == 'success' + + test: + needs: analyze + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + sdk: [2.12.0, dev] + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: dart pub get + - name: Run tests + run: dart test --test-randomize-ordering-seed=random + if: always() && steps.install.outcome == 'success' diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 92a3b2801..2cfde582b 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.1 + +- Fix a bug in `AnsiProgress` where the spinning character doesn't every update. + ## 0.3.0 - Stable null safety release. diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index cd3a72e31..193c4d029 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -200,13 +200,12 @@ class AnsiProgress extends Progress { final Ansi ansi; - int _index = 0; - late final _timer = Timer.periodic(Duration(milliseconds: 80), (t) { - _index++; - _updateDisplay(); - }); + late final Timer _timer; AnsiProgress(this.ansi, String message) : super(message) { + _timer = Timer.periodic(Duration(milliseconds: 80), (t) { + _updateDisplay(); + }); io.stdout.write('$message... '.padRight(40)); _updateDisplay(); } @@ -232,7 +231,7 @@ class AnsiProgress extends Progress { bool cancelled = false, String? message, bool showTiming = false}) { - var char = kAnimationItems[_index % kAnimationItems.length]; + var char = kAnimationItems[_timer.tick % kAnimationItems.length]; if (isFinal || cancelled) { char = ''; } diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 9386c55a0..ce17496e0 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,10 +1,10 @@ name: cli_util -version: 0.3.0 +version: 0.3.1 description: A library to help in building Dart command-line apps. -homepage: https://github.com/dart-lang/cli_util +repository: https://github.com/dart-lang/cli_util environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: meta: ^1.3.0 From 909e4f26ad982399315638c97feafc6a11e22cf7 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 7 May 2021 10:27:09 -0700 Subject: [PATCH 068/110] Standardize CI action (dart-lang/cli_util#62) --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 34a090ab3..ced2b7d30 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v1 + - uses: dart-lang/setup-dart@v1.0 with: sdk: ${{ matrix.sdk }} - id: install @@ -44,7 +44,7 @@ jobs: sdk: [2.12.0, dev] steps: - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v1 + - uses: dart-lang/setup-dart@v1.0 with: sdk: ${{ matrix.sdk }} - id: install From aafe7a430d8a19b1b617e54b4b06abeadf54d195 Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Fri, 14 May 2021 16:17:35 -0700 Subject: [PATCH 069/110] enable recommended lints (dart-lang/cli_util#63) --- pkgs/cli_util/analysis_options.yaml | 2 +- pkgs/cli_util/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/analysis_options.yaml b/pkgs/cli_util/analysis_options.yaml index b4ab8c9e2..4fa4b8d13 100644 --- a/pkgs/cli_util/analysis_options.yaml +++ b/pkgs/cli_util/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:pedantic/analysis_options.yaml +include: package:lints/recommended.yaml analyzer: strong-mode: diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index ce17496e0..afb0d67fb 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -11,5 +11,5 @@ dependencies: path: ^1.8.0 dev_dependencies: - pedantic: ^1.10.0 + lints: ^1.0.0 test: ^1.16.0 From cbebf751e12c1c7c7f25a5a21e14b0a2695bc071 Mon Sep 17 00:00:00 2001 From: Konstantin Scheglov Date: Sat, 3 Jul 2021 19:19:11 -0700 Subject: [PATCH 070/110] Update constraint to '>=1.3.0 <3.0.0'. (dart-lang/cli_util#64) --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 2cfde582b..3750523a0 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.2 + +- Update `meta` constraint to `>=1.3.0 <3.0.0`. + ## 0.3.1 - Fix a bug in `AnsiProgress` where the spinning character doesn't every update. diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index afb0d67fb..18e3c5866 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.3.1 +version: 0.3.2 description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util @@ -7,7 +7,7 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - meta: ^1.3.0 + meta: '>=1.3.0 <3.0.0' path: ^1.8.0 dev_dependencies: From 5763bbe8c5af9aa0cbceb3535cef389767599917 Mon Sep 17 00:00:00 2001 From: Konstantin Scheglov Date: Wed, 7 Jul 2021 11:14:39 -0700 Subject: [PATCH 071/110] Revert to 'meta: ^1.3.0'. (dart-lang/cli_util#65) --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 3750523a0..c546fd4a4 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.3 + +- Reverted `meta` constraint to `^1.3.0`. + ## 0.3.2 - Update `meta` constraint to `>=1.3.0 <3.0.0`. diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 18e3c5866..a5ab87807 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.3.2 +version: 0.3.3 description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util @@ -7,7 +7,7 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - meta: '>=1.3.0 <3.0.0' + meta: ^1.3.0 path: ^1.8.0 dev_dependencies: From d56c2a9c3d16a2f63647d4d1fcbd7e929820baff Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Fri, 17 Sep 2021 11:08:06 +0200 Subject: [PATCH 072/110] Introduce applicationConfigHome (dart-lang/cli_util#66) * Introduce applicationConfigHome --- pkgs/cli_util/CHANGELOG.md | 5 +++ pkgs/cli_util/lib/cli_util.dart | 63 +++++++++++++++++++++++++++ pkgs/cli_util/pubspec.yaml | 2 +- pkgs/cli_util/test/cli_util_test.dart | 6 +++ 4 files changed, 75 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index c546fd4a4..871b0103a 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.4 + +- Introduce `applicationConfigHome` for making it easy to consistently find the + user-specific application configuration folder. + ## 0.3.3 - Reverted `meta` constraint to `^1.3.0`. diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 0cc408d93..0fdd2110f 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -59,3 +59,66 @@ Directory getSdkDir([List? cliArgs]) { /// Return the path to the current Dart SDK. String getSdkPath() => path.dirname(path.dirname(Platform.resolvedExecutable)); + +/// Get the user-specific application configuration folder for the current +/// platform. +/// +/// This is a location appropriate for storing application specific +/// configuration for the current user. The [productName] should be unique to +/// avoid clashes with other applications on the same machine. This method won't +/// actually create the folder, merely return the recommended location for +/// storing user-specific application configuration. +/// +/// The folder location depends on the platform: +/// * `%APPDATA%\` on **Windows**, +/// * `$HOME/Library/Application Support/` on **Mac OS**, +/// * `$XDG_CONFIG_HOME/` on **Linux** +/// (if `$XDG_CONFIG_HOME` is defined), and, +/// * `$HOME/.config/` otherwise. +/// +/// This aims follows best practices for each platform, honoring the +/// [XDG Base Directory Specification][1] on Linux and [File System Basics][2] +/// on Mac OS. +/// +/// Throws if `%APPDATA%` or `$HOME` is undefined. +/// +/// [1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +/// [2]: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW1 +String applicationConfigHome(String productName) => + path.join(_configHome, productName); + +String get _configHome { + if (Platform.isWindows) { + final appdata = Platform.environment['APPDATA']; + if (appdata == null) { + throw StateError('Environment variable %APPDATA% is not defined!'); + } + return appdata; + } + + if (Platform.isMacOS) { + return path.join(_home, 'Library', 'Application Support'); + } + + if (Platform.isLinux) { + final xdgConfigHome = Platform.environment['XDG_CONFIG_HOME']; + if (xdgConfigHome != null) { + return xdgConfigHome; + } + // XDG Base Directory Specification says to use $HOME/.config/ when + // $XDG_CONFIG_HOME isn't defined. + return path.join(_home, '.config'); + } + + // We have no guidelines, perhaps we should just do: $HOME/.config/ + // same as XDG specification would specify as fallback. + return path.join(_home, '.config'); +} + +String get _home { + final home = Platform.environment['HOME']; + if (home == null) { + throw StateError('Environment variable \$HOME is not defined!'); + } + return home; +} diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index a5ab87807..7efbd1364 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.3.3 +version: 0.3.4 description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index 2c2c77096..95ba0fb19 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -36,4 +36,10 @@ void defineTests() { expect(isSdkDir(Directory(getSdkPath())), true); }); }); + + group('applicationConfigHome', () { + test('returns a string', () { + expect(applicationConfigHome('dart'), isA()); + }); + }); } From a261cbe1efa2f8db990066a49233577b88379029 Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Fri, 17 Sep 2021 12:25:26 +0200 Subject: [PATCH 073/110] Improve tests for applicationConfigHome (dart-lang/cli_util#67) --- pkgs/cli_util/test/cli_util_test.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index 95ba0fb19..32dcdfc4a 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -7,6 +7,7 @@ import 'dart:io'; import 'package:cli_util/cli_util.dart'; import 'package:cli_util/src/utils.dart'; import 'package:test/test.dart'; +import 'package:path/path.dart' as p; void main() => defineTests(); @@ -38,8 +39,15 @@ void defineTests() { }); group('applicationConfigHome', () { - test('returns a string', () { - expect(applicationConfigHome('dart'), isA()); + test('returns a non-empty string', () { + expect(applicationConfigHome('dart'), isNotEmpty); + }); + + test('has an ancestor folder that exists', () { + final path = p.split(applicationConfigHome('dart')); + // We expect that first two segments of the path exists.. This is really + // just a dummy check that some part of the path exists. + expect(Directory(p.joinAll(path.take(2))).existsSync(), isTrue); }); }); } From 7844468e80fee7abee9f510122ec36b17dda9c24 Mon Sep 17 00:00:00 2001 From: Sigurd Meldgaard Date: Mon, 11 Oct 2021 03:37:58 -0700 Subject: [PATCH 074/110] Make applicationConfigHome failures catchable (dart-lang/cli_util#68) It is not always possible to resolve any environment variables - but we still might want to query for the directory if it exists. --- pkgs/cli_util/lib/cli_util.dart | 18 +++++++++++++++--- pkgs/cli_util/test/cli_util_test.dart | 16 ++++++++++++++++ pkgs/cli_util/test/print_config_home.dart | 9 +++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 pkgs/cli_util/test/print_config_home.dart diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 0fdd2110f..430c294fe 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -80,7 +80,8 @@ String getSdkPath() => path.dirname(path.dirname(Platform.resolvedExecutable)); /// [XDG Base Directory Specification][1] on Linux and [File System Basics][2] /// on Mac OS. /// -/// Throws if `%APPDATA%` or `$HOME` is undefined. +/// Throws an [EnvironmentNotFoundException] if `%APPDATA%` or `$HOME` is needed +/// but undefined. /// /// [1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html /// [2]: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW1 @@ -91,7 +92,8 @@ String get _configHome { if (Platform.isWindows) { final appdata = Platform.environment['APPDATA']; if (appdata == null) { - throw StateError('Environment variable %APPDATA% is not defined!'); + throw EnvironmentNotFoundException( + 'Environment variable %APPDATA% is not defined!'); } return appdata; } @@ -118,7 +120,17 @@ String get _configHome { String get _home { final home = Platform.environment['HOME']; if (home == null) { - throw StateError('Environment variable \$HOME is not defined!'); + throw EnvironmentNotFoundException( + 'Environment variable \$HOME is not defined!'); } return home; } + +class EnvironmentNotFoundException implements Exception { + final String message; + EnvironmentNotFoundException(this.message); + @override + String toString() { + return message; + } +} diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index 32dcdfc4a..510e12d84 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -49,5 +49,21 @@ void defineTests() { // just a dummy check that some part of the path exists. expect(Directory(p.joinAll(path.take(2))).existsSync(), isTrue); }); + + test('Throws IOException when run with empty environment', () { + final scriptPath = p.join('test', 'print_config_home.dart'); + final result = Process.runSync( + Platform.resolvedExecutable, + [scriptPath], + environment: {}, + includeParentEnvironment: false, + ); + final varName = Platform.isWindows ? '%APPDATA%' : r'$HOME'; + expect( + (result.stdout as String).trim(), + 'Caught: Environment variable $varName is not defined!', + ); + expect(result.exitCode, 0); + }); }); } diff --git a/pkgs/cli_util/test/print_config_home.dart b/pkgs/cli_util/test/print_config_home.dart new file mode 100644 index 000000000..7667ff7b5 --- /dev/null +++ b/pkgs/cli_util/test/print_config_home.dart @@ -0,0 +1,9 @@ +import 'package:cli_util/cli_util.dart'; + +void main() { + try { + print(applicationConfigHome('dart')); + } on EnvironmentNotFoundException catch (e) { + print('Caught: $e'); + } +} From 86a5c92870d1aa6a9403bf9b29887ac7c2d78e93 Mon Sep 17 00:00:00 2001 From: Sigurd Meldgaard Date: Tue, 12 Oct 2021 00:25:10 -0700 Subject: [PATCH 075/110] Prepare publish of v0.3.5 (dart-lang/cli_util#69) --- pkgs/cli_util/CHANGELOG.md | 4 ++++ pkgs/cli_util/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 871b0103a..ac9ebd491 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.5 +- Make `applicationConfigHome` throw an `Exception` when it fails to find a + configuration folder. + ## 0.3.4 - Introduce `applicationConfigHome` for making it easy to consistently find the diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 7efbd1364..1d06b53c1 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.3.4 +version: 0.3.5 description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util From e0cff73b47d1065d299a0a4f004ee613f3187809 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 15 Nov 2022 07:54:16 -0800 Subject: [PATCH 076/110] blast_repo fixes (dart-lang/cli_util#71) Dependabot GitHub Action No Response --- pkgs/cli_util/.github/dependabot.yml | 9 +++++ pkgs/cli_util/.github/workflows/build.yaml | 8 ++--- .../.github/workflows/no-response.yml | 34 +++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 pkgs/cli_util/.github/dependabot.yml create mode 100644 pkgs/cli_util/.github/workflows/no-response.yml diff --git a/pkgs/cli_util/.github/dependabot.yml b/pkgs/cli_util/.github/dependabot.yml new file mode 100644 index 000000000..1603cdd9e --- /dev/null +++ b/pkgs/cli_util/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Dependabot configuration file. +# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates +version: 2 + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index ced2b7d30..82901c95a 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,8 +20,8 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v1.0 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} - id: install @@ -43,8 +43,8 @@ jobs: os: [ubuntu-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v1.0 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} - id: install diff --git a/pkgs/cli_util/.github/workflows/no-response.yml b/pkgs/cli_util/.github/workflows/no-response.yml new file mode 100644 index 000000000..fdc1c6aa1 --- /dev/null +++ b/pkgs/cli_util/.github/workflows/no-response.yml @@ -0,0 +1,34 @@ +# A workflow to close issues where the author hasn't responded to a request for +# more information; see https://github.com/godofredoc/no-response for docs. + +name: No Response + +# Both `issue_comment` and `scheduled` event types are required. +on: + issue_comment: + types: [created] + schedule: + # Schedule for five minutes after the hour, every hour + - cron: '5 * * * *' + +# All permissions not specified are set to 'none'. +permissions: + issues: write + +jobs: + noResponse: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'dart-lang' }} + steps: + - uses: godofredoc/no-response@0ce2dc0e63e1c7d2b87752ceed091f6d32c9df09 + with: + responseRequiredLabel: "needs-info" + responseRequiredColor: 4774bc + daysUntilClose: 14 + # Comment to post when closing an Issue for lack of response. + closeComment: > + Without additional information we're not able to resolve this + issue, so it will be closed at this time. You're still free to add + more info and respond to any questions above, though. We'll reopen + the case if you do. Thanks for your contribution! + token: ${{ github.token }} From 86a7d62207294912337e32d1a2fd1916b305af5e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Jan 2023 13:15:03 -0800 Subject: [PATCH 077/110] Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/cli_util#72) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8...755da8c3cf115ac066823e79a1e1788f8940201b) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 82901c95a..980b72155 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} From 677d9fc0d244e0ad7fffb7e1651b76ea95e5faa6 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 9 Jan 2023 15:07:56 -0800 Subject: [PATCH 078/110] Migrate from no-implicit-casts to strict-casts (dart-lang/cli_util#73) --- pkgs/cli_util/analysis_options.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/analysis_options.yaml b/pkgs/cli_util/analysis_options.yaml index 4fa4b8d13..055ac1087 100644 --- a/pkgs/cli_util/analysis_options.yaml +++ b/pkgs/cli_util/analysis_options.yaml @@ -1,5 +1,5 @@ include: package:lints/recommended.yaml analyzer: - strong-mode: - implicit-casts: false + language: + strict-casts: true From 5ad9d097aac341f2f5191485f8e18224d7721727 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Jan 2023 21:50:45 -0800 Subject: [PATCH 079/110] Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/cli_util#75) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.3 to 1.4. - [Release notes](https://github.com/dart-lang/setup-dart/releases) - [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/setup-dart/compare/6a218f2413a3e78e9087f638a238f6b40893203d...a57a6c04cf7d4840e88432aad6281d1e125f0d46) --- updated-dependencies: - dependency-name: dart-lang/setup-dart dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 980b72155..fdec97190 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} - id: install @@ -44,7 +44,7 @@ jobs: sdk: [2.12.0, dev] steps: - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} - id: install From adc3a2b6166a3ac4c440f7f2a3adf0be9aad8354 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Jan 2023 21:56:27 -0800 Subject: [PATCH 080/110] Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/cli_util#74) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/755da8c3cf115ac066823e79a1e1788f8940201b...ac593985615ec2ede58e132d2e21d2b1cbd6127c) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index fdec97190..b8000053e 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} From 00ce67b46045668693ce65665b07289b88901f2d Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 24 Feb 2023 15:11:57 -0800 Subject: [PATCH 081/110] blast_repo fixes (dart-lang/cli_util#76) auto-publish no-response --- pkgs/cli_util/.github/workflows/no-response.yml | 12 ++++++------ pkgs/cli_util/.github/workflows/publish.yaml | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 pkgs/cli_util/.github/workflows/publish.yaml diff --git a/pkgs/cli_util/.github/workflows/no-response.yml b/pkgs/cli_util/.github/workflows/no-response.yml index fdc1c6aa1..ac3e456ec 100644 --- a/pkgs/cli_util/.github/workflows/no-response.yml +++ b/pkgs/cli_util/.github/workflows/no-response.yml @@ -8,8 +8,8 @@ on: issue_comment: types: [created] schedule: - # Schedule for five minutes after the hour, every hour - - cron: '5 * * * *' + # Every day at 8am + - cron: '0 8 * * *' # All permissions not specified are set to 'none'. permissions: @@ -27,8 +27,8 @@ jobs: daysUntilClose: 14 # Comment to post when closing an Issue for lack of response. closeComment: > - Without additional information we're not able to resolve this - issue, so it will be closed at this time. You're still free to add - more info and respond to any questions above, though. We'll reopen - the case if you do. Thanks for your contribution! + Without additional information we're not able to resolve this issue, + so it will be closed at this time. You're still free to add more + info and respond to any questions above, though. We'll reopen the + issue if you do. Thanks for your contribution! token: ${{ github.token }} diff --git a/pkgs/cli_util/.github/workflows/publish.yaml b/pkgs/cli_util/.github/workflows/publish.yaml new file mode 100644 index 000000000..2239b63d3 --- /dev/null +++ b/pkgs/cli_util/.github/workflows/publish.yaml @@ -0,0 +1,14 @@ +# A CI configuration to auto-publish pub packages. + +name: Publish + +on: + pull_request: + branches: [ master ] + push: + tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] + +jobs: + publish: + if: ${{ github.repository_owner == 'dart-lang' }} + uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main From 1b2b8b175005696d98f0dbfc9d84c0d2fee5d6dd Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 24 Feb 2023 15:35:14 -0800 Subject: [PATCH 082/110] Move to dart_flutter_team_lints, require Dart 2.19 (dart-lang/cli_util#77) * Move to dart_flutter_team_lints, require Dart 2.19 * ci sdk oops --- pkgs/cli_util/.github/workflows/build.yaml | 2 +- pkgs/cli_util/CHANGELOG.md | 4 +++ pkgs/cli_util/analysis_options.yaml | 36 +++++++++++++++++++++- pkgs/cli_util/example/main.dart | 10 +++--- pkgs/cli_util/lib/cli_logging.dart | 21 ++++++------- pkgs/cli_util/lib/cli_util.dart | 12 +++----- pkgs/cli_util/pubspec.yaml | 6 ++-- pkgs/cli_util/test/cli_util_test.dart | 2 +- 8 files changed, 64 insertions(+), 29 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index b8000053e..d85ca3166 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -41,7 +41,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - sdk: [2.12.0, dev] + sdk: [2.19.0, dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index ac9ebd491..f7851f115 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.6-dev + +- Require Dart 2.19 + ## 0.3.5 - Make `applicationConfigHome` throw an `Exception` when it fails to find a configuration folder. diff --git a/pkgs/cli_util/analysis_options.yaml b/pkgs/cli_util/analysis_options.yaml index 055ac1087..3f0a92363 100644 --- a/pkgs/cli_util/analysis_options.yaml +++ b/pkgs/cli_util/analysis_options.yaml @@ -1,5 +1,39 @@ -include: package:lints/recommended.yaml +# https://dart.dev/guides/language/analysis-options +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: strict-casts: true + strict-inference: true + strict-raw-types: true + +linter: + rules: + - avoid_bool_literals_in_conditional_expressions + - avoid_classes_with_only_static_members + - avoid_private_typedef_functions + - avoid_redundant_argument_values + - avoid_returning_null_for_future + - avoid_returning_this + - avoid_unused_constructor_parameters + - avoid_void_async + - cancel_subscriptions + - comment_references + - join_return_with_assignment + - literal_only_boolean_expressions + - missing_whitespace_between_adjacent_strings + - no_adjacent_strings_in_list + - no_runtimeType_toString + - package_api_docs + - prefer_const_constructors + - prefer_const_declarations + - prefer_expression_function_bodies + - prefer_final_locals + - prefer_relative_imports + - test_types_in_equals + - unnecessary_await_in_return + - unnecessary_raw_strings + - use_if_null_to_convert_nulls_to_bools + - use_raw_strings + - use_string_buffers + - use_super_parameters diff --git a/pkgs/cli_util/example/main.dart b/pkgs/cli_util/example/main.dart index c0ae0bb07..3bae82749 100644 --- a/pkgs/cli_util/example/main.dart +++ b/pkgs/cli_util/example/main.dart @@ -7,17 +7,17 @@ import 'dart:async'; import 'package:cli_util/cli_logging.dart'; Future main(List args) async { - var verbose = args.contains('-v'); - var logger = verbose ? Logger.verbose() : Logger.standard(); + final verbose = args.contains('-v'); + final logger = verbose ? Logger.verbose() : Logger.standard(); logger.stdout('Hello world!'); logger.trace('message 1'); - await Future.delayed(Duration(milliseconds: 200)); + await Future.delayed(const Duration(milliseconds: 200)); logger.trace('message 2'); logger.trace('message 3'); - var progress = logger.progress('doing some work'); - await Future.delayed(Duration(seconds: 2)); + final progress = logger.progress('doing some work'); + await Future.delayed(const Duration(seconds: 2)); progress.finish(showTiming: true); logger.stdout('All ${logger.ansi.emphasized('done')}.'); diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 193c4d029..6f206b2ee 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -68,9 +68,8 @@ abstract class Logger { /// Create a [Logger] that will display trace level output. /// /// If [logTime] is `true`, this logger will display the time of the message. - factory Logger.verbose({Ansi? ansi, bool logTime = true}) { - return VerboseLogger(ansi: ansi, logTime: logTime); - } + factory Logger.verbose({Ansi? ansi, bool logTime = true}) => + VerboseLogger(ansi: ansi, logTime: logTime); Ansi get ansi; @@ -158,7 +157,7 @@ class StandardLogger implements Logger { } void _cancelProgress() { - var progress = _currentProgress; + final progress = _currentProgress; if (progress != null) { _currentProgress = null; progress.cancel(); @@ -169,7 +168,7 @@ class StandardLogger implements Logger { Progress progress(String message) { _cancelProgress(); - var progress = ansi.useAnsi + final progress = ansi.useAnsi ? AnsiProgress(ansi, message) : SimpleProgress(this, message); _currentProgress = progress; @@ -196,14 +195,14 @@ class SimpleProgress extends Progress { } class AnsiProgress extends Progress { - static const List kAnimationItems = ['/', '-', '\\', '|']; + static const List kAnimationItems = ['/', '-', r'\', '|']; final Ansi ansi; late final Timer _timer; AnsiProgress(this.ansi, String message) : super(message) { - _timer = Timer.periodic(Duration(milliseconds: 80), (t) { + _timer = Timer.periodic(const Duration(milliseconds: 80), (t) { _updateDisplay(); }); io.stdout.write('$message... '.padRight(40)); @@ -240,7 +239,7 @@ class AnsiProgress extends Progress { if (message != null) { io.stdout.write(message.isEmpty ? ' ' : message); } else if (showTiming) { - var time = (elapsed.inMilliseconds / 1000.0).toStringAsFixed(1); + final time = (elapsed.inMilliseconds / 1000.0).toStringAsFixed(1); io.stdout.write('${time}s'); } else { io.stdout.write(' '); @@ -300,12 +299,12 @@ class VerboseLogger implements Logger { } var seconds = _timer.elapsedMilliseconds / 1000.0; - var minutes = seconds ~/ 60; + final minutes = seconds ~/ 60; seconds -= minutes * 60.0; - var buf = StringBuffer(); + final buf = StringBuffer(); if (minutes > 0) { - buf.write((minutes % 60)); + buf.write(minutes % 60); buf.write('m '); } diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 430c294fe..b0d35c1c6 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -23,7 +23,7 @@ import 'src/utils.dart'; Directory getSdkDir([List? cliArgs]) { // Look for --dart-sdk on the command line. if (cliArgs != null) { - var index = cliArgs.indexOf('--dart-sdk'); + final index = cliArgs.indexOf('--dart-sdk'); if (index != -1 && (index + 1 < cliArgs.length)) { return Directory(cliArgs[index + 1]); @@ -37,13 +37,13 @@ Directory getSdkDir([List? cliArgs]) { } // Look in env['DART_SDK'] - var sdkLocation = Platform.environment['DART_SDK']; + final sdkLocation = Platform.environment['DART_SDK']; if (sdkLocation != null) { return Directory(sdkLocation); } // Look relative to the dart executable. - var platformExecutable = File(Platform.executable); + final platformExecutable = File(Platform.executable); var sdkDirectory = platformExecutable.parent.parent; if (isSdkDir(sdkDirectory)) return sdkDirectory; @@ -121,7 +121,7 @@ String get _home { final home = Platform.environment['HOME']; if (home == null) { throw EnvironmentNotFoundException( - 'Environment variable \$HOME is not defined!'); + r'Environment variable $HOME is not defined!'); } return home; } @@ -130,7 +130,5 @@ class EnvironmentNotFoundException implements Exception { final String message; EnvironmentNotFoundException(this.message); @override - String toString() { - return message; - } + String toString() => message; } diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 1d06b53c1..424c969ea 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,15 +1,15 @@ name: cli_util -version: 0.3.5 +version: 0.3.6-dev description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: meta: ^1.3.0 path: ^1.8.0 dev_dependencies: - lints: ^1.0.0 + dart_flutter_team_lints: ^1.0.0 test: ^1.16.0 diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index 510e12d84..be4ce20c9 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -6,8 +6,8 @@ import 'dart:io'; import 'package:cli_util/cli_util.dart'; import 'package:cli_util/src/utils.dart'; -import 'package:test/test.dart'; import 'package:path/path.dart' as p; +import 'package:test/test.dart'; void main() => defineTests(); From ca5158077b55f88ba4d2dd0ae8bf1513c0f8e752 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 1 Mar 2023 16:25:02 -0800 Subject: [PATCH 083/110] remove getSdkDir; prep to publish 0.4.0 (dart-lang/cli_util#78) * remove getSdkDir() * refactor tests to avoid a process exec --- pkgs/cli_util/CHANGELOG.md | 3 +- pkgs/cli_util/lib/cli_util.dart | 60 ++++------------------- pkgs/cli_util/lib/src/utils.dart | 10 ---- pkgs/cli_util/pubspec.yaml | 2 +- pkgs/cli_util/test/cli_util_test.dart | 44 +++-------------- pkgs/cli_util/test/print_config_home.dart | 9 ---- 6 files changed, 20 insertions(+), 108 deletions(-) delete mode 100644 pkgs/cli_util/lib/src/utils.dart delete mode 100644 pkgs/cli_util/test/print_config_home.dart diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index f7851f115..513d9a564 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,5 +1,6 @@ -## 0.3.6-dev +## 0.4.0 +- Remove the deprecated method `getSdkDir()` (instead, use `getSdkPath()`). - Require Dart 2.19 ## 0.3.5 diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index b0d35c1c6..c7b867b5c 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -5,58 +5,11 @@ /// Utilities to return the Dart SDK location. library cli_util; +import 'dart:async'; import 'dart:io'; import 'package:path/path.dart' as path; -import 'src/utils.dart'; - -/// Return the path to the current Dart SDK. -/// -/// This first checks for an explicit SDK listed on the command-line -/// (`--dart-sdk`). It then looks in any `DART_SDK` environment variable. Next, -/// it looks relative to the Dart VM executable. Last, it uses the -/// [Platform.resolvedExecutable] API. -/// -/// Callers should generally prefer using the [getSdkPath] function. -@Deprecated('Clients should generally prefer getSdkPath()') -Directory getSdkDir([List? cliArgs]) { - // Look for --dart-sdk on the command line. - if (cliArgs != null) { - final index = cliArgs.indexOf('--dart-sdk'); - - if (index != -1 && (index + 1 < cliArgs.length)) { - return Directory(cliArgs[index + 1]); - } - - for (var arg in cliArgs) { - if (arg.startsWith('--dart-sdk=')) { - return Directory(arg.substring('--dart-sdk='.length)); - } - } - } - - // Look in env['DART_SDK'] - final sdkLocation = Platform.environment['DART_SDK']; - if (sdkLocation != null) { - return Directory(sdkLocation); - } - - // Look relative to the dart executable. - final platformExecutable = File(Platform.executable); - var sdkDirectory = platformExecutable.parent.parent; - if (isSdkDir(sdkDirectory)) return sdkDirectory; - - // Handle the case where Platform.executable is a sibling of the SDK directory - // (this happens during internal testing). - sdkDirectory = - Directory(path.join(platformExecutable.parent.path, 'dart-sdk')); - if (isSdkDir(sdkDirectory)) return sdkDirectory; - - // Use `Platform.resolvedExecutable`. - return Directory(getSdkPath()); -} - /// Return the path to the current Dart SDK. String getSdkPath() => path.dirname(path.dirname(Platform.resolvedExecutable)); @@ -90,7 +43,7 @@ String applicationConfigHome(String productName) => String get _configHome { if (Platform.isWindows) { - final appdata = Platform.environment['APPDATA']; + final appdata = _env['APPDATA']; if (appdata == null) { throw EnvironmentNotFoundException( 'Environment variable %APPDATA% is not defined!'); @@ -103,7 +56,7 @@ String get _configHome { } if (Platform.isLinux) { - final xdgConfigHome = Platform.environment['XDG_CONFIG_HOME']; + final xdgConfigHome = _env['XDG_CONFIG_HOME']; if (xdgConfigHome != null) { return xdgConfigHome; } @@ -118,7 +71,7 @@ String get _configHome { } String get _home { - final home = Platform.environment['HOME']; + final home = _env['HOME']; if (home == null) { throw EnvironmentNotFoundException( r'Environment variable $HOME is not defined!'); @@ -132,3 +85,8 @@ class EnvironmentNotFoundException implements Exception { @override String toString() => message; } + +// This zone override exists solely for testing (see lib/cli_util_test.dart). +Map get _env => + (Zone.current[#environmentOverrides] as Map?) ?? + Platform.environment; diff --git a/pkgs/cli_util/lib/src/utils.dart b/pkgs/cli_util/lib/src/utils.dart deleted file mode 100644 index 66bab2f99..000000000 --- a/pkgs/cli_util/lib/src/utils.dart +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:io'; - -import 'package:path/path.dart' as path; - -bool isSdkDir(Directory dir) => - FileSystemEntity.isFileSync(path.join(dir.path, 'version')); diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 424c969ea..ebdcd6611 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.3.6-dev +version: 0.4.0 description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index be4ce20c9..349b629f6 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -2,42 +2,22 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:cli_util/cli_util.dart'; -import 'package:cli_util/src/utils.dart'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; void main() => defineTests(); void defineTests() { - group('getSdkDir', () { - test('arg parsing', () { - // ignore: deprecated_member_use, deprecated_member_use_from_same_package - expect(getSdkDir(['--dart-sdk', '/dart/sdk']).path, equals('/dart/sdk')); - // ignore: deprecated_member_use, deprecated_member_use_from_same_package - expect(getSdkDir(['--dart-sdk=/dart/sdk']).path, equals('/dart/sdk')); - }); - - test('finds the SDK without cli args', () { - // ignore: deprecated_member_use, deprecated_member_use_from_same_package - expect(getSdkDir(), isNotNull); - }); - }); - group('getSdkPath', () { test('sdkPath', () { expect(getSdkPath(), isNotNull); }); }); - group('utils', () { - test('isSdkDir', () { - expect(isSdkDir(Directory(getSdkPath())), true); - }); - }); - group('applicationConfigHome', () { test('returns a non-empty string', () { expect(applicationConfigHome('dart'), isNotEmpty); @@ -45,25 +25,17 @@ void defineTests() { test('has an ancestor folder that exists', () { final path = p.split(applicationConfigHome('dart')); - // We expect that first two segments of the path exists.. This is really + // We expect that first two segments of the path exist. This is really // just a dummy check that some part of the path exists. expect(Directory(p.joinAll(path.take(2))).existsSync(), isTrue); }); - test('Throws IOException when run with empty environment', () { - final scriptPath = p.join('test', 'print_config_home.dart'); - final result = Process.runSync( - Platform.resolvedExecutable, - [scriptPath], - environment: {}, - includeParentEnvironment: false, - ); - final varName = Platform.isWindows ? '%APPDATA%' : r'$HOME'; - expect( - (result.stdout as String).trim(), - 'Caught: Environment variable $varName is not defined!', - ); - expect(result.exitCode, 0); + test('empty environment throws exception', () async { + expect(() { + runZoned(() => applicationConfigHome('dart'), zoneValues: { + #environmentOverrides: {}, + }); + }, throwsA(isA())); }); }); } diff --git a/pkgs/cli_util/test/print_config_home.dart b/pkgs/cli_util/test/print_config_home.dart deleted file mode 100644 index 7667ff7b5..000000000 --- a/pkgs/cli_util/test/print_config_home.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:cli_util/cli_util.dart'; - -void main() { - try { - print(applicationConfigHome('dart')); - } on EnvironmentNotFoundException catch (e) { - print('Caught: $e'); - } -} From 181b2530ef23be57dd2fb5c7a849a8d00f66f8f5 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Thu, 2 Mar 2023 09:30:12 -0800 Subject: [PATCH 084/110] Update README.md (dart-lang/cli_util#79) --- pkgs/cli_util/README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index 54d9d28e7..a233d8b13 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -1,11 +1,15 @@ +[![Build Status](https://github.com/dart-lang/cli_util/workflows/Dart/badge.svg)](https://github.com/dart-lang/cli_util/actions) +[![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) +[![package publisher](https://img.shields.io/pub/publisher/cli_util.svg)](https://pub.dev/packages/cli_util/publisher) + A package to help in building Dart command-line apps. -In particular, `cli_util` provides a simple, standardized way to get the current -SDK directory. Useful, especially, when building client applications that -interact with the Dart SDK (such as the [analyzer][analyzer]). +## What's this? -[![Build Status](https://github.com/dart-lang/cli_util/workflows/Dart/badge.svg)](https://github.com/dart-lang/cli_util/actions) -[![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) +`package:cli_util` provides: +- utilities to find the Dart SDK directory (`getSdkPath()`) +- utilities to find the settings directory for a tool (`applicationConfigHome()`) +- utilities to aid in showing rich CLI output and progress information (`cli_logging.dart`) ## Locating the Dart SDK @@ -17,10 +21,10 @@ import 'package:path/path.dart' as path; main(args) { // Get sdk dir from cli_util. - String sdkPath = getSdkPath(); + var sdkPath = getSdkPath(); // Do stuff... For example, print version string - File versionFile = File(path.join(sdkPath, 'version')); + var versionFile = File(path.join(sdkPath, 'version')); print(versionFile.readAsStringSync()); } ``` @@ -39,8 +43,8 @@ tasks, and optionally display the elapsed time when finished: import 'package:cli_util/cli_logging.dart'; void main(List args) async { - bool verbose = args.contains('-v'); - Logger logger = verbose ? Logger.verbose() : Logger.standard(); + var verbose = args.contains('-v'); + var logger = verbose ? Logger.verbose() : Logger.standard(); logger.stdout('Hello world!'); logger.trace('message 1'); @@ -48,7 +52,7 @@ void main(List args) async { logger.trace('message 2'); logger.trace('message 3'); - Progress progress = logger.progress('doing some work'); + var progress = logger.progress('doing some work'); await Future.delayed(Duration(seconds: 2)); progress.finish(showTiming: true); @@ -61,5 +65,4 @@ void main(List args) async { Please file feature requests and bugs at the [issue tracker][tracker]. -[analyzer]: https://pub.dev/packages/analyzer [tracker]: https://github.com/dart-lang/cli_util/issues From 569b5321aa9e1cbe78b61655e837187a671d23c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Apr 2023 21:16:19 -0700 Subject: [PATCH 085/110] Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/cli_util#80) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/ac593985615ec2ede58e132d2e21d2b1cbd6127c...8f4b7f84864484a7bf31766abe9204da3cbe65b3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index d85ca3166..6dc4a02e2 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} From 71239783d19832285abc61034aa7fe633e099f06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Apr 2023 21:18:50 -0700 Subject: [PATCH 086/110] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/cli_util#81) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/dart-lang/setup-dart/releases) - [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/setup-dart/compare/a57a6c04cf7d4840e88432aad6281d1e125f0d46...d6a63dab3335f427404425de0fbfed4686d93c4f) --- updated-dependencies: - dependency-name: dart-lang/setup-dart dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 6dc4a02e2..3e18b2408 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} - id: install @@ -44,7 +44,7 @@ jobs: sdk: [2.19.0, dev] steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} - id: install From 6eb2c3beea136fc6dcd265cd0cc13bbc1e56ed71 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 10:22:15 -0700 Subject: [PATCH 087/110] Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/cli_util#82) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.0 to 3.5.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/8f4b7f84864484a7bf31766abe9204da3cbe65b3...8e5e7e5ab8b370d6c329ec480221332ada57f0ab) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 3e18b2408..21627dbd5 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From 15f5bc8d3a122d9f043b7564e00061f138246366 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 15 May 2023 09:41:24 -0700 Subject: [PATCH 088/110] blast_repo fixes (dart-lang/cli_util#83) dependabot --- pkgs/cli_util/.github/dependabot.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/cli_util/.github/dependabot.yml b/pkgs/cli_util/.github/dependabot.yml index 1603cdd9e..725f03af2 100644 --- a/pkgs/cli_util/.github/dependabot.yml +++ b/pkgs/cli_util/.github/dependabot.yml @@ -3,7 +3,9 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "monthly" + interval: monthly + labels: + - autosubmit From ec9d7a0dcbe2515bfe086dec716651cb08a40bfc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 05:06:11 +0000 Subject: [PATCH 089/110] Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/cli_util#84) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
Release notes

Sourced from actions/checkout's releases.

v3.5.3

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v3...v3.5.3

Changelog

Sourced from actions/checkout's changelog.

Changelog

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

v3.1.0

v3.0.2

v3.0.1

v3.0.0

v2.3.1

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.5.2&new-version=3.5.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 21627dbd5..79d974e07 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From 572e4b3aca0327a8f697d440d7bbffb0d627836d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Sep 2023 05:27:58 +0000 Subject: [PATCH 090/110] Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/cli_util#88) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0.
Release notes

Sourced from actions/checkout's releases.

v3.6.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v3.5.3...v3.6.0

Changelog

Sourced from actions/checkout's changelog.

Changelog

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

v3.1.0

v3.0.2

v3.0.1

v3.0.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.5.3&new-version=3.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 79d974e07..802c596ec 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From d4a03cea58d42544be3db80a9ef4a345891f190f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 05:07:22 +0000 Subject: [PATCH 091/110] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/cli_util#90) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.5.0 to 1.5.1.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available in an environment variable, DART_HOME (dart-lang/cli_util#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/cli_util#35).

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

  • Added a flavor option setup.sh to allow downloading unpublished builds.

v1.0.0

  • Promoted to 1.0 stable.

v0.5

  • Fixed a Windows pub global activate path issue.

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.5.0&new-version=1.5.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 802c596ec..2d9e4323b 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} - id: install @@ -44,7 +44,7 @@ jobs: sdk: [2.19.0, dev] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} - id: install From 55e86c85a354337c8ea406104d1ca48014cfaab9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:14:51 -0700 Subject: [PATCH 092/110] Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/cli_util#89) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.6.0 to 4.1.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/f43a0e5ff2bd294095638e18286ca9a3d1956744...8ade135a41bc03ea155e62e844d188df1ea18608) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 2d9e4323b..f1a52795c 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} From 1c3f7eb78773389c3879cb55db48698d5573fdac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 05:18:37 +0000 Subject: [PATCH 093/110] Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/cli_util#92) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.5.1 to 1.6.0.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available in an environment variable, DART_HOME (dart-lang/cli_util#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/cli_util#35).

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

  • Added a flavor option setup.sh to allow downloading unpublished builds.

v1.0.0

  • Promoted to 1.0 stable.

v0.5

  • Fixed a Windows pub global activate path issue.

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.5.1&new-version=1.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index f1a52795c..01785693a 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} - id: install @@ -44,7 +44,7 @@ jobs: sdk: [2.19.0, dev] steps: - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} - id: install From 04e64085ba1670ef7b7285218ae8991ec38eea93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:51:38 +0000 Subject: [PATCH 094/110] Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/cli_util#91) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
Release notes

Sourced from actions/checkout's releases.

v4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.0...v4.1.1

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.0&new-version=4.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 01785693a..f2d884f84 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: [2.19.0, dev] steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} From 194ebfbb6651b4d4b913c325f2dc26df812d3e92 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 15 Dec 2023 10:15:05 -0800 Subject: [PATCH 095/110] require dart 3.0; rev to 0.4.1 in prep for publishing (dart-lang/cli_util#93) require dart 3.0; rev to 0.4.1 in prep for publishing --- pkgs/cli_util/.github/workflows/build.yaml | 2 +- pkgs/cli_util/CHANGELOG.md | 7 ++++++- pkgs/cli_util/README.md | 2 +- pkgs/cli_util/analysis_options.yaml | 6 ------ pkgs/cli_util/pubspec.yaml | 6 +++--- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index f2d884f84..bf7f30148 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -41,7 +41,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - sdk: [2.19.0, dev] + sdk: ['3.0', dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index 513d9a564..c3cca2206 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,7 +1,12 @@ +## 0.4.1 + +- Fix a broken link in the readme. +- Require Dart 3.0. + ## 0.4.0 - Remove the deprecated method `getSdkDir()` (instead, use `getSdkPath()`). -- Require Dart 2.19 +- Require Dart 2.19. ## 0.3.5 - Make `applicationConfigHome` throw an `Exception` when it fails to find a diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index a233d8b13..c5a1b8ba9 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://github.com/dart-lang/cli_util/workflows/Dart/badge.svg)](https://github.com/dart-lang/cli_util/actions) +[![Dart CI](https://github.com/dart-lang/cli_util/actions/workflows/build.yaml/badge.svg)](https://github.com/dart-lang/cli_util/actions/workflows/build.yaml) [![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) [![package publisher](https://img.shields.io/pub/publisher/cli_util.svg)](https://pub.dev/packages/cli_util/publisher) diff --git a/pkgs/cli_util/analysis_options.yaml b/pkgs/cli_util/analysis_options.yaml index 3f0a92363..dbd96afa0 100644 --- a/pkgs/cli_util/analysis_options.yaml +++ b/pkgs/cli_util/analysis_options.yaml @@ -13,27 +13,21 @@ linter: - avoid_classes_with_only_static_members - avoid_private_typedef_functions - avoid_redundant_argument_values - - avoid_returning_null_for_future - avoid_returning_this - avoid_unused_constructor_parameters - avoid_void_async - cancel_subscriptions - - comment_references - join_return_with_assignment - literal_only_boolean_expressions - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_runtimeType_toString - package_api_docs - - prefer_const_constructors - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals - - prefer_relative_imports - - test_types_in_equals - unnecessary_await_in_return - unnecessary_raw_strings - use_if_null_to_convert_nulls_to_bools - use_raw_strings - use_string_buffers - - use_super_parameters diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index ebdcd6611..b3e05edda 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,15 +1,15 @@ name: cli_util -version: 0.4.0 +version: 0.4.1 description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util environment: - sdk: '>=2.19.0 <3.0.0' + sdk: ^3.0.0 dependencies: meta: ^1.3.0 path: ^1.8.0 dev_dependencies: - dart_flutter_team_lints: ^1.0.0 + dart_flutter_team_lints: ^2.0.0 test: ^1.16.0 From 79a6729afaa0a89dcb7bda752327f39796f6c0d5 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 20 Dec 2023 09:57:32 -0800 Subject: [PATCH 096/110] blast_repo fixes (dart-lang/cli_util#95) no-response --- .../.github/workflows/no-response.yml | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/no-response.yml b/pkgs/cli_util/.github/workflows/no-response.yml index ac3e456ec..8e5ed57cd 100644 --- a/pkgs/cli_util/.github/workflows/no-response.yml +++ b/pkgs/cli_util/.github/workflows/no-response.yml @@ -1,12 +1,10 @@ # A workflow to close issues where the author hasn't responded to a request for -# more information; see https://github.com/godofredoc/no-response for docs. +# more information; see https://github.com/actions/stale. name: No Response -# Both `issue_comment` and `scheduled` event types are required. +# Run as a daily cron. on: - issue_comment: - types: [created] schedule: # Every day at 8am - cron: '0 8 * * *' @@ -14,21 +12,26 @@ on: # All permissions not specified are set to 'none'. permissions: issues: write + pull-requests: write jobs: - noResponse: + no-response: runs-on: ubuntu-latest if: ${{ github.repository_owner == 'dart-lang' }} steps: - - uses: godofredoc/no-response@0ce2dc0e63e1c7d2b87752ceed091f6d32c9df09 + - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 with: - responseRequiredLabel: "needs-info" - responseRequiredColor: 4774bc - daysUntilClose: 14 - # Comment to post when closing an Issue for lack of response. - closeComment: > - Without additional information we're not able to resolve this issue, - so it will be closed at this time. You're still free to add more - info and respond to any questions above, though. We'll reopen the - issue if you do. Thanks for your contribution! - token: ${{ github.token }} + # Don't automatically mark inactive issues+PRs as stale. + days-before-stale: -1 + # Close needs-info issues and PRs after 14 days of inactivity. + days-before-close: 14 + stale-issue-label: "needs-info" + close-issue-message: > + Without additional information we're not able to resolve this issue. + Feel free to add more info or respond to any questions above and we + can reopen the case. Thanks for your contribution! + stale-pr-label: "needs-info" + close-pr-message: > + Without additional information we're not able to resolve this PR. + Feel free to add more info or respond to any questions above. + Thanks for your contribution! From 3c5114a0efcea2cedf5dd8117afd919b35b6eefc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 05:23:44 +0000 Subject: [PATCH 097/110] Bump actions/stale from 8.0.0 to 9.0.0 (dart-lang/cli_util#96) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/stale](https://github.com/actions/stale) from 8.0.0 to 9.0.0.
Release notes

Sourced from actions/stale's releases.

v9.0.0

Breaking Changes

  1. Action is now stateful: If the action ends because of operations-per-run then the next run will start from the first unprocessed issue skipping the issues processed during the previous run(s). The state is reset when all the issues are processed. This should be considered for scheduling workflow runs.
  2. Version 9 of this action updated the runtime to Node.js 20. All scripts are now run with Node.js 20 instead of Node.js 16 and are affected by any breaking changes between Node.js 16 and 20.

What Else Changed

  1. Performance optimization that removes unnecessary API calls by @​dsame dart-lang/cli_util#1033 fixes dart-lang/cli_util#792
  2. Logs displaying current github API rate limit by @​dsame dart-lang/cli_util#1032 addresses dart-lang/cli_util#1029

For more information, please read the action documentation and its section about statefulness

New Contributors

Full Changelog: https://github.com/actions/stale/compare/v8...v9.0.0

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/stale&package-manager=github_actions&previous-version=8.0.0&new-version=9.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/no-response.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/cli_util/.github/workflows/no-response.yml b/pkgs/cli_util/.github/workflows/no-response.yml index 8e5ed57cd..ab1ac4984 100644 --- a/pkgs/cli_util/.github/workflows/no-response.yml +++ b/pkgs/cli_util/.github/workflows/no-response.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.repository_owner == 'dart-lang' }} steps: - - uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e with: # Don't automatically mark inactive issues+PRs as stale. days-before-stale: -1 From 1f404b71161bb9101c93222e941bfbe61339ab40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 05:23:58 +0000 Subject: [PATCH 098/110] Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/cli_util#97) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.0 to 1.6.2.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.
Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available in an environment variable, DART_HOME (dart-lang/cli_util#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/cli_util#35).

v1.2.0

  • Fixed a path issue impacting git dependencies on Windows.

v1.1.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.0&new-version=1.6.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index bf7f30148..6c7d1d26b 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} - id: install @@ -44,7 +44,7 @@ jobs: sdk: ['3.0', dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} - id: install From b8e2df3a716416e99b01f5ed894014456060a488 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 05:38:12 +0000 Subject: [PATCH 099/110] Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/cli_util#98) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
Release notes

Sourced from actions/checkout's releases.

v4.1.2

We are investigating the following issue with this release and have rolled-back the v4 tag to point to v4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.1...v4.1.2

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

v3.3.0

v3.2.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.1&new-version=4.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 6c7d1d26b..809dae025 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: ['3.0', dev] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} From 0629a6e121474babf25a0301d0e2a8789141baef Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Thu, 11 Apr 2024 08:54:18 +0200 Subject: [PATCH 100/110] Make `sdkPath` a getter (dart-lang/cli_util#100) Add `sdkPath` getter and deprecate `getSdkPath` function. Update tests to not use deprecated name. Clean up environment access, make all uses of exception pass only the environment entry name. Increment version to 0.4.2-wip --- pkgs/cli_util/CHANGELOG.md | 4 ++ pkgs/cli_util/README.md | 8 ++-- pkgs/cli_util/lib/cli_util.dart | 56 +++++++++++++-------------- pkgs/cli_util/pubspec.yaml | 2 +- pkgs/cli_util/test/cli_util_test.dart | 8 ++-- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index c3cca2206..bab56a9cd 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.2-wip + +- Add `sdkPath` getter, deprecate `getSdkPath` function. + ## 0.4.1 - Fix a broken link in the readme. diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index c5a1b8ba9..d1add7c04 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -7,7 +7,7 @@ A package to help in building Dart command-line apps. ## What's this? `package:cli_util` provides: -- utilities to find the Dart SDK directory (`getSdkPath()`) +- utilities to find the Dart SDK directory (`sdkPath`) - utilities to find the settings directory for a tool (`applicationConfigHome()`) - utilities to aid in showing rich CLI output and progress information (`cli_logging.dart`) @@ -20,11 +20,11 @@ import 'package:cli_util/cli_util.dart'; import 'package:path/path.dart' as path; main(args) { - // Get sdk dir from cli_util. - var sdkPath = getSdkPath(); + // Get SDK directory from cli_util. + var sdkDir = sdkPath; // Do stuff... For example, print version string - var versionFile = File(path.join(sdkPath, 'version')); + var versionFile = File(path.join(sdkDir, 'version')); print(versionFile.readAsStringSync()); } ``` diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index c7b867b5c..82ce9eac4 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -/// Utilities to return the Dart SDK location. +/// Utilities to locate the Dart SDK. library cli_util; import 'dart:async'; @@ -10,11 +10,14 @@ import 'dart:io'; import 'package:path/path.dart' as path; -/// Return the path to the current Dart SDK. -String getSdkPath() => path.dirname(path.dirname(Platform.resolvedExecutable)); +/// The path to the current Dart SDK. +String get sdkPath => path.dirname(path.dirname(Platform.resolvedExecutable)); -/// Get the user-specific application configuration folder for the current -/// platform. +/// Returns the path to the current Dart SDK. +@Deprecated("Use 'sdkPath' instead") +String getSdkPath() => sdkPath; + +/// The user-specific application configuration folder for the current platform. /// /// This is a location appropriate for storing application specific /// configuration for the current user. The [productName] should be unique to @@ -29,12 +32,12 @@ String getSdkPath() => path.dirname(path.dirname(Platform.resolvedExecutable)); /// (if `$XDG_CONFIG_HOME` is defined), and, /// * `$HOME/.config/` otherwise. /// -/// This aims follows best practices for each platform, honoring the -/// [XDG Base Directory Specification][1] on Linux and [File System Basics][2] -/// on Mac OS. +/// The chosen location aims to follow best practices for each platform, +/// honoring the [XDG Base Directory Specification][1] on Linux and +/// [File System Basics][2] on Mac OS. /// -/// Throws an [EnvironmentNotFoundException] if `%APPDATA%` or `$HOME` is needed -/// but undefined. +/// Throws an [EnvironmentNotFoundException] if an environment entry, +/// `%APPDATA%` or `$HOME`, is needed and not available. /// /// [1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html /// [2]: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW1 @@ -43,16 +46,11 @@ String applicationConfigHome(String productName) => String get _configHome { if (Platform.isWindows) { - final appdata = _env['APPDATA']; - if (appdata == null) { - throw EnvironmentNotFoundException( - 'Environment variable %APPDATA% is not defined!'); - } - return appdata; + return _requireEnv('APPDATA'); } if (Platform.isMacOS) { - return path.join(_home, 'Library', 'Application Support'); + return path.join(_requireEnv('HOME'), 'Library', 'Application Support'); } if (Platform.isLinux) { @@ -62,26 +60,26 @@ String get _configHome { } // XDG Base Directory Specification says to use $HOME/.config/ when // $XDG_CONFIG_HOME isn't defined. - return path.join(_home, '.config'); + return path.join(_requireEnv('HOME'), '.config'); } // We have no guidelines, perhaps we should just do: $HOME/.config/ // same as XDG specification would specify as fallback. - return path.join(_home, '.config'); + return path.join(_requireEnv('HOME'), '.config'); } -String get _home { - final home = _env['HOME']; - if (home == null) { - throw EnvironmentNotFoundException( - r'Environment variable $HOME is not defined!'); - } - return home; -} +String _requireEnv(String name) => + _env[name] ?? (throw EnvironmentNotFoundException(name)); +/// Exception thrown if a required environment entry does not exist. +/// +/// Thrown by [applicationConfigHome] if an expected and required +/// platform specific environment entry is not available. class EnvironmentNotFoundException implements Exception { - final String message; - EnvironmentNotFoundException(this.message); + /// Name of environment entry which was needed, but not found. + final String entryName; + String get message => 'Environment variable \'$entryName\' is not defined!'; + EnvironmentNotFoundException(this.entryName); @override String toString() => message; } diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index b3e05edda..a28627f95 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.4.1 +version: 0.4.2-wip description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util diff --git a/pkgs/cli_util/test/cli_util_test.dart b/pkgs/cli_util/test/cli_util_test.dart index 349b629f6..e16bc593f 100644 --- a/pkgs/cli_util/test/cli_util_test.dart +++ b/pkgs/cli_util/test/cli_util_test.dart @@ -9,12 +9,10 @@ import 'package:cli_util/cli_util.dart'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; -void main() => defineTests(); - -void defineTests() { - group('getSdkPath', () { +void main() { + group('sdkPath', () { test('sdkPath', () { - expect(getSdkPath(), isNotNull); + expect(sdkPath, isNotNull); }); }); From 2fde13914e11fcc488a3fa35accab8d45f5d79c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 05:13:04 +0000 Subject: [PATCH 101/110] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/cli_util#101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.6.2 to 1.6.4.
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.4

  • Rebuild JS code to include changes from v1.6.3

v1.6.3

Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

  • Automatically create OIDC token for pub.dev.
  • Add a reusable workflow for publishing.

v1.3.0

  • The install location of the Dart SDK is now available

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dart-lang/setup-dart&package-manager=github_actions&previous-version=1.6.2&new-version=1.6.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 809dae025..9cb4173d0 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} - id: install @@ -44,7 +44,7 @@ jobs: sdk: ['3.0', dev] steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} - id: install From 215e0f3279e13a885a7e31226ec61dbe5acd46a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 05:15:03 +0000 Subject: [PATCH 102/110] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/cli_util#102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⚠️ **Dependabot is rebasing this PR** ⚠️ Rebasing might not happen immediately, so don't worry if this takes some time. Note: if you make any changes to this PR yourself, they will take precedence over the rebase. --- Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.4.
Release notes

Sourced from actions/checkout's releases.

v4.1.4

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.3...v4.1.4

v4.1.3

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.2...v4.1.3

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.2&new-version=4.1.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 9cb4173d0..5841b3fe6 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: ['3.0', dev] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From 381745bd40799f14db6c772c1c7baedf1dd6e908 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Fri, 3 May 2024 15:07:45 -0700 Subject: [PATCH 103/110] blast_repo fixes (dart-lang/cli_util#103) dependabot --- pkgs/cli_util/.github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/cli_util/.github/dependabot.yml b/pkgs/cli_util/.github/dependabot.yml index 725f03af2..cde02ad6a 100644 --- a/pkgs/cli_util/.github/dependabot.yml +++ b/pkgs/cli_util/.github/dependabot.yml @@ -9,3 +9,7 @@ updates: interval: monthly labels: - autosubmit + groups: + github-actions: + patterns: + - "*" From 8fd519ab465a93227b4cd815f5d9d69862e59da6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jun 2024 05:36:52 +0000 Subject: [PATCH 104/110] Bump actions/checkout from 4.1.4 to 4.1.6 in the github-actions group (dart-lang/cli_util#104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.1.4 to 4.1.6
Release notes

Sourced from actions/checkout's releases.

v4.1.6

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.5...v4.1.6

v4.1.5

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.4...v4.1.5

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.4&new-version=4.1.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index 5841b3fe6..e61cfe945 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: ['3.0', dev] steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From ba5b1d2745a4593aee8f3dd5c64a0de73de9ab20 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 05:57:20 +0000 Subject: [PATCH 105/110] Bump the github-actions group with 2 updates (dart-lang/cli_util#105) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart). Updates `actions/checkout` from 4.1.6 to 4.1.7
Release notes

Sourced from actions/checkout's releases.

v4.1.7

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.6...v4.1.7

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

... (truncated)

Commits

Updates `dart-lang/setup-dart` from 1.6.4 to 1.6.5
Release notes

Sourced from dart-lang/setup-dart's releases.

v1.6.5

dart-lang/cli_util#118: dart-lang/setup-dartdart-lang/cli_util#118

Changelog

Sourced from dart-lang/setup-dart's changelog.

v1.6.5

dart-lang/cli_util#118: dart-lang/setup-dartdart-lang/cli_util#118

v1.6.4

  • Rebuild JS code.

v1.6.3

v1.6.2

v1.6.1

  • Updated the google storage url for main channel releases.

v1.6.0

  • Enable provisioning of the latest Dart SDK patch release by specifying just the major and minor version (e.g. 3.2).

v1.5.1

  • No longer test the setup-dart action on pre-2.12 SDKs.
  • Upgrade JS interop code to use extension types (the new name for inline classes).
  • The upcoming rename of the be channel to main is now supported with forward compatibility that switches when the rename happens.

v1.5.0

  • Re-wrote the implementation of the action into Dart.
  • Auto-detect the platform architecture (x64, ia32, arm, arm64).
  • Improved the caching and download resilience of the sdk.
  • Added a new action output: dart-version - the installed version of the sdk.

v1.4.0

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/cli_util/.github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index e61cfe945..a8424fc07 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,8 +20,8 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} - id: install @@ -43,8 +43,8 @@ jobs: os: [ubuntu-latest] sdk: ['3.0', dev] steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} - id: install From 138ada8138ad5df2207ed808164cd73a975d8ab0 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 8 Jul 2024 14:03:40 -0700 Subject: [PATCH 106/110] update lints (dart-lang/cli_util#106) --- pkgs/cli_util/.github/workflows/build.yaml | 2 +- pkgs/cli_util/lib/cli_logging.dart | 2 +- pkgs/cli_util/lib/cli_util.dart | 2 +- pkgs/cli_util/pubspec.yaml | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index a8424fc07..e6d970b28 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -41,7 +41,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - sdk: ['3.0', dev] + sdk: ['3.4', dev] steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 diff --git a/pkgs/cli_util/lib/cli_logging.dart b/pkgs/cli_util/lib/cli_logging.dart index 6f206b2ee..dda287bda 100644 --- a/pkgs/cli_util/lib/cli_logging.dart +++ b/pkgs/cli_util/lib/cli_logging.dart @@ -4,7 +4,7 @@ /// This library contains functionality to help command-line utilities to easily /// create aesthetic output. -library cli_logging; +library; import 'dart:async'; import 'dart:io' as io; diff --git a/pkgs/cli_util/lib/cli_util.dart b/pkgs/cli_util/lib/cli_util.dart index 82ce9eac4..e497d68b5 100644 --- a/pkgs/cli_util/lib/cli_util.dart +++ b/pkgs/cli_util/lib/cli_util.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. /// Utilities to locate the Dart SDK. -library cli_util; +library; import 'dart:async'; import 'dart:io'; diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index a28627f95..036815297 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -4,12 +4,12 @@ description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/cli_util environment: - sdk: ^3.0.0 + sdk: ^3.4.0 dependencies: - meta: ^1.3.0 + meta: ^1.7.0 path: ^1.8.0 dev_dependencies: - dart_flutter_team_lints: ^2.0.0 - test: ^1.16.0 + dart_flutter_team_lints: ^3.0.0 + test: ^1.20.0 From d844845bc7c9aa62c69d218fe5361a40f963709e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 05:55:05 +0000 Subject: [PATCH 107/110] Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group (dart-lang/cli_util#107) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.1.7 to 4.2.0
Release notes

Sourced from actions/checkout's releases.

v4.2.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.7...v4.2.0

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.2.0

v4.1.7

v4.1.6

v4.1.5

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=4.1.7&new-version=4.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
--- pkgs/cli_util/.github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/pkgs/cli_util/.github/workflows/build.yaml index e6d970b28..5dd4d39c4 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/pkgs/cli_util/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} @@ -43,7 +43,7 @@ jobs: os: [ubuntu-latest] sdk: ['3.4', dev] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} From e2216242d5b9349a7c08dd5cd0fc5114d412961c Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 25 Oct 2024 11:27:02 +0200 Subject: [PATCH 108/110] Add issue template and other fixes --- .github/ISSUE_TEMPLATE/cli_util.md | 5 +++++ pkgs/cli_util/CONTRIBUTING.md | 33 ------------------------------ pkgs/cli_util/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 34 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/cli_util.md delete mode 100644 pkgs/cli_util/CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE/cli_util.md b/.github/ISSUE_TEMPLATE/cli_util.md new file mode 100644 index 000000000..935fd4577 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/cli_util.md @@ -0,0 +1,5 @@ +--- +name: "package:cli_util" +about: "Create a bug or file a feature request against package:cli_util." +labels: "package:cli_util" +--- \ No newline at end of file diff --git a/pkgs/cli_util/CONTRIBUTING.md b/pkgs/cli_util/CONTRIBUTING.md deleted file mode 100644 index 286d61c8b..000000000 --- a/pkgs/cli_util/CONTRIBUTING.md +++ /dev/null @@ -1,33 +0,0 @@ -Want to contribute? Great! First, read this page (including the small print at -the end). - -### Before you contribute -Before we can use your code, you must sign the -[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual) -(CLA), which you can do online. The CLA is necessary mainly because you own the -copyright to your changes, even after your contribution becomes part of our -codebase, so we need your permission to use and distribute your code. We also -need to be sure of various other things—for instance that you'll tell us if you -know that your code infringes on other people's patents. You don't have to sign -the CLA until after you've submitted your code for review and a member has -approved it, but you must do it before we can put your code into our codebase. - -Before you start working on a larger contribution, you should get in touch with -us first through the issue tracker with your idea so that we can help out and -possibly guide you. Coordinating up front makes it much easier to avoid -frustration later on. - -### Code reviews -All submissions, including submissions by project members, require review. - -### File headers -All files in the project must start with the following header. - - // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file - // for details. All rights reserved. Use of this source code is governed by a - // BSD-style license that can be found in the LICENSE file. - -### The small print -Contributions made by corporations are covered by a different agreement than the -one above, the -[Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate). diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index 036815297..ede1340ff 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,7 +1,7 @@ name: cli_util version: 0.4.2-wip description: A library to help in building Dart command-line apps. -repository: https://github.com/dart-lang/cli_util +repository: https://github.com/dart-lang/tools/tree/main/pkgs/cli_util environment: sdk: ^3.4.0 From aca61345c813e589b1b9c0d4306b7a420c7c7253 Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 25 Oct 2024 11:34:14 +0200 Subject: [PATCH 109/110] Moving fixes --- .github/labeler.yml | 4 ++ .../workflows/cli_util.yaml | 25 +++++++++---- README.md | 1 + pkgs/cli_util/.github/dependabot.yml | 15 -------- .../.github/workflows/no-response.yml | 37 ------------------- pkgs/cli_util/.github/workflows/publish.yaml | 14 ------- pkgs/cli_util/CHANGELOG.md | 3 +- pkgs/cli_util/README.md | 4 +- pkgs/cli_util/pubspec.yaml | 2 +- 9 files changed, 28 insertions(+), 77 deletions(-) rename pkgs/cli_util/.github/workflows/build.yaml => .github/workflows/cli_util.yaml (78%) delete mode 100644 pkgs/cli_util/.github/dependabot.yml delete mode 100644 pkgs/cli_util/.github/workflows/no-response.yml delete mode 100644 pkgs/cli_util/.github/workflows/publish.yaml diff --git a/.github/labeler.yml b/.github/labeler.yml index c3d5de0b9..6a5529b76 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -12,6 +12,10 @@ - changed-files: - any-glob-to-any-file: 'pkgs/cli_config/**' +'package:cli_util': + - changed-files: + - any-glob-to-any-file: 'pkgs/cli_util/**' + 'package:coverage': - changed-files: - any-glob-to-any-file: 'pkgs/coverage/**' diff --git a/pkgs/cli_util/.github/workflows/build.yaml b/.github/workflows/cli_util.yaml similarity index 78% rename from pkgs/cli_util/.github/workflows/build.yaml rename to .github/workflows/cli_util.yaml index 5dd4d39c4..23d6fcaa6 100644 --- a/pkgs/cli_util/.github/workflows/build.yaml +++ b/.github/workflows/cli_util.yaml @@ -1,17 +1,28 @@ -name: Dart CI +name: package:cli_util on: - schedule: - # “At 00:00 (UTC) on Sunday.” - - cron: '0 0 * * 0' - pull_request: - branches: [ master ] + # Run on PRs and pushes to the default branch. push: - branches: [ master ] + branches: [ main ] + paths: + - '.github/workflows/cli_util.yml' + - 'pkgs/cli_util/**' + pull_request: + branches: [ main ] + paths: + - '.github/workflows/cli_util.yml' + - 'pkgs/cli_util/**' + schedule: + - cron: "0 0 * * 0" env: PUB_ENVIRONMENT: bot.github + +defaults: + run: + working-directory: pkgs/cli_util/ + jobs: analyze: runs-on: ubuntu-latest diff --git a/README.md b/README.md index ac4edf204..199604086 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ don't naturally belong to other topic monorepos (like | --- | --- | --- | | [boolean_selector](pkgs/boolean_selector/) | A flexible syntax for boolean expressions, based on a simplified version of Dart's expression syntax. | [![pub package](https://img.shields.io/pub/v/boolean_selector.svg)](https://pub.dev/packages/boolean_selector) | | [cli_config](pkgs/cli_config/) | A library to take config values from configuration files, CLI arguments, and environment variables. | [![pub package](https://img.shields.io/pub/v/cli_config.svg)](https://pub.dev/packages/cli_config) | +| [cli_util](pkgs/cli_util/) | A library to help in building Dart command-line apps. | [![pub package](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) | | [coverage](pkgs/coverage/) | Coverage data manipulation and formatting. | [![pub package](https://img.shields.io/pub/v/coverage.svg)](https://pub.dev/packages/coverage) | | [extension_discovery](pkgs/extension_discovery/) | A convention and utilities for package extension discovery. | [![pub package](https://img.shields.io/pub/v/extension_discovery.svg)](https://pub.dev/packages/extension_discovery) | | [file](pkgs/file/) | A pluggable, mockable file system abstraction for Dart. | [![pub package](https://img.shields.io/pub/v/file.svg)](https://pub.dev/packages/file) | diff --git a/pkgs/cli_util/.github/dependabot.yml b/pkgs/cli_util/.github/dependabot.yml deleted file mode 100644 index cde02ad6a..000000000 --- a/pkgs/cli_util/.github/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Dependabot configuration file. -# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates -version: 2 - -updates: - - package-ecosystem: github-actions - directory: / - schedule: - interval: monthly - labels: - - autosubmit - groups: - github-actions: - patterns: - - "*" diff --git a/pkgs/cli_util/.github/workflows/no-response.yml b/pkgs/cli_util/.github/workflows/no-response.yml deleted file mode 100644 index ab1ac4984..000000000 --- a/pkgs/cli_util/.github/workflows/no-response.yml +++ /dev/null @@ -1,37 +0,0 @@ -# A workflow to close issues where the author hasn't responded to a request for -# more information; see https://github.com/actions/stale. - -name: No Response - -# Run as a daily cron. -on: - schedule: - # Every day at 8am - - cron: '0 8 * * *' - -# All permissions not specified are set to 'none'. -permissions: - issues: write - pull-requests: write - -jobs: - no-response: - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'dart-lang' }} - steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e - with: - # Don't automatically mark inactive issues+PRs as stale. - days-before-stale: -1 - # Close needs-info issues and PRs after 14 days of inactivity. - days-before-close: 14 - stale-issue-label: "needs-info" - close-issue-message: > - Without additional information we're not able to resolve this issue. - Feel free to add more info or respond to any questions above and we - can reopen the case. Thanks for your contribution! - stale-pr-label: "needs-info" - close-pr-message: > - Without additional information we're not able to resolve this PR. - Feel free to add more info or respond to any questions above. - Thanks for your contribution! diff --git a/pkgs/cli_util/.github/workflows/publish.yaml b/pkgs/cli_util/.github/workflows/publish.yaml deleted file mode 100644 index 2239b63d3..000000000 --- a/pkgs/cli_util/.github/workflows/publish.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# A CI configuration to auto-publish pub packages. - -name: Publish - -on: - pull_request: - branches: [ master ] - push: - tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] - -jobs: - publish: - if: ${{ github.repository_owner == 'dart-lang' }} - uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main diff --git a/pkgs/cli_util/CHANGELOG.md b/pkgs/cli_util/CHANGELOG.md index bab56a9cd..9e77b8fe2 100644 --- a/pkgs/cli_util/CHANGELOG.md +++ b/pkgs/cli_util/CHANGELOG.md @@ -1,6 +1,7 @@ -## 0.4.2-wip +## 0.4.2 - Add `sdkPath` getter, deprecate `getSdkPath` function. +* Move to `dart-lang/tools` monorepo. ## 0.4.1 diff --git a/pkgs/cli_util/README.md b/pkgs/cli_util/README.md index d1add7c04..b86e8c084 100644 --- a/pkgs/cli_util/README.md +++ b/pkgs/cli_util/README.md @@ -1,4 +1,4 @@ -[![Dart CI](https://github.com/dart-lang/cli_util/actions/workflows/build.yaml/badge.svg)](https://github.com/dart-lang/cli_util/actions/workflows/build.yaml) +[![Build Status](https://github.com/dart-lang/tools/actions/workflows/cli_util.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/cli_util.yaml) [![Pub](https://img.shields.io/pub/v/cli_util.svg)](https://pub.dev/packages/cli_util) [![package publisher](https://img.shields.io/pub/publisher/cli_util.svg)](https://pub.dev/packages/cli_util/publisher) @@ -65,4 +65,4 @@ void main(List args) async { Please file feature requests and bugs at the [issue tracker][tracker]. -[tracker]: https://github.com/dart-lang/cli_util/issues +[tracker]: https://github.com/dart-lang/tools/issues diff --git a/pkgs/cli_util/pubspec.yaml b/pkgs/cli_util/pubspec.yaml index ede1340ff..b2253174b 100644 --- a/pkgs/cli_util/pubspec.yaml +++ b/pkgs/cli_util/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.4.2-wip +version: 0.4.2 description: A library to help in building Dart command-line apps. repository: https://github.com/dart-lang/tools/tree/main/pkgs/cli_util From 5e842b4a92f443d63fa62a3052349bd9ba781c5f Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 29 Oct 2024 15:49:16 +0100 Subject: [PATCH 110/110] Remove lint --- pkgs/cli_util/analysis_options.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/cli_util/analysis_options.yaml b/pkgs/cli_util/analysis_options.yaml index dbd96afa0..a30462ede 100644 --- a/pkgs/cli_util/analysis_options.yaml +++ b/pkgs/cli_util/analysis_options.yaml @@ -22,7 +22,6 @@ linter: - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_runtimeType_toString - - package_api_docs - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals