From 7f7714f57efb8d982c905ea25205a92ace5de67f Mon Sep 17 00:00:00 2001 From: Lasse Reichstein Holst Nielsen Date: Wed, 2 Sep 2020 11:38:26 +0200 Subject: [PATCH 01/49] Create Repository From 8412ad77d191e602848a1f1bc9fc21a67f371e86 Mon Sep 17 00:00:00 2001 From: Lasse Reichstein Holst Nielsen Date: Wed, 2 Sep 2020 17:05:48 +0200 Subject: [PATCH 02/49] Initial implementation. --- pkgs/os_detect/.gitignore | 3 + pkgs/os_detect/.travis.yml | 14 ++++ pkgs/os_detect/AUTHORS | 6 ++ pkgs/os_detect/CHANGELOG.md | 5 ++ pkgs/os_detect/LICENSE | 26 +++++++ pkgs/os_detect/README.md | 42 ++++++++++ pkgs/os_detect/analysis_options.yaml | 9 +++ pkgs/os_detect/lib/os_id.dart | 67 ++++++++++++++++ pkgs/os_detect/lib/override.dart | 99 ++++++++++++++++++++++++ pkgs/os_detect/lib/src/osid_html.dart | 12 +++ pkgs/os_detect/lib/src/osid_io.dart | 12 +++ pkgs/os_detect/lib/src/osid_unknown.dart | 11 +++ pkgs/os_detect/pubspec.yaml | 7 ++ pkgs/os_detect/test/osid_test.dart | 75 ++++++++++++++++++ 14 files changed, 388 insertions(+) create mode 100644 pkgs/os_detect/.gitignore create mode 100644 pkgs/os_detect/.travis.yml create mode 100644 pkgs/os_detect/AUTHORS create mode 100644 pkgs/os_detect/CHANGELOG.md create mode 100644 pkgs/os_detect/LICENSE create mode 100644 pkgs/os_detect/README.md create mode 100644 pkgs/os_detect/analysis_options.yaml create mode 100644 pkgs/os_detect/lib/os_id.dart create mode 100644 pkgs/os_detect/lib/override.dart create mode 100644 pkgs/os_detect/lib/src/osid_html.dart create mode 100644 pkgs/os_detect/lib/src/osid_io.dart create mode 100644 pkgs/os_detect/lib/src/osid_unknown.dart create mode 100644 pkgs/os_detect/pubspec.yaml create mode 100644 pkgs/os_detect/test/osid_test.dart diff --git a/pkgs/os_detect/.gitignore b/pkgs/os_detect/.gitignore new file mode 100644 index 00000000..49ce72d7 --- /dev/null +++ b/pkgs/os_detect/.gitignore @@ -0,0 +1,3 @@ +.dart_tool/ +.packages +pubspec.lock diff --git a/pkgs/os_detect/.travis.yml b/pkgs/os_detect/.travis.yml new file mode 100644 index 00000000..69c6f72f --- /dev/null +++ b/pkgs/os_detect/.travis.yml @@ -0,0 +1,14 @@ +language: dart +dart: +- dev +- 2.7.0 +# Only building master means that we don't run two builds for each pull request. +dart_task: +- test: --platform vm,chrome +- dartanalyzer +- dartfmt +branches: + only: [master] +cache: + directories: + - $HOME/.pub-cache diff --git a/pkgs/os_detect/AUTHORS b/pkgs/os_detect/AUTHORS new file mode 100644 index 00000000..846e4a15 --- /dev/null +++ b/pkgs/os_detect/AUTHORS @@ -0,0 +1,6 @@ +# Below is a list of people and organizations that have contributed +# to the Dart project. Names should be added to the list like so: +# +# Name/Organization + +Google LLC diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md new file mode 100644 index 00000000..e1e1be20 --- /dev/null +++ b/pkgs/os_detect/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 + +* Initial release \ No newline at end of file diff --git a/pkgs/os_detect/LICENSE b/pkgs/os_detect/LICENSE new file mode 100644 index 00000000..18daf2b5 --- /dev/null +++ b/pkgs/os_detect/LICENSE @@ -0,0 +1,26 @@ +Copyright 2020, 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/os_detect/README.md b/pkgs/os_detect/README.md new file mode 100644 index 00000000..40feb4fe --- /dev/null +++ b/pkgs/os_detect/README.md @@ -0,0 +1,42 @@ +[![Build Status](https://travis-ci.org/lrhn/os_id.svg?branch=master)](https://travis-ci.org/lrhn/os_id) + +Platform independent access to information about the current operating system. + +## Querying the current OS + +Exposes `operatingSystem` and `operatingSystemVersion` strings +similar to those of the `Platform` class in `dart:io`, +but also works on the web. +The `operatingSystem` of a browser is the string "browser". +Also exposes convenience getters like `isLinux`, `isAndroid` and `isBrowser` +based on the `operatingSystem` string. + +To use this package instead of `dart:io`, replace +the import of `dart:io` with: +```dart +import "package:platform_id/platform_id.dart" as Platform; +``` +That should keep the code working if the only functionality used from `dart:io` +is operating system detection. +You should then use your IDE to rename the import prefix from `Platform` +to something lower-cased which follows the style guide for import prefixes. + +Any new platform which supports neither `dart:io` nor `dart:html` +can make itself recognizable by configuring +the `dart.os.name` and `dart.os.version` environment settings, +so that `const String.fromEnvironment` can access them. + +## Overriding the current OS string + +It's possible to override the current operating system string, +as exposed by `operatingSystem` and `operatingSystemVersion` +in `package:os_id/os_id.dart`. +To do so, import the `package:os_id/override.dart` library +and use the `overrideOperatingSystem` function to run code in a zone +where the operating system and version values are set +to whatever values are desired. + +The class `OperatingSystemID` can also be used directly to +abstract over the operating system name and version. +The `OperatingSystemID.current` defaults to the values provided by the platform +when not overridden using `overrideOperatingSystem`, \ No newline at end of file diff --git a/pkgs/os_detect/analysis_options.yaml b/pkgs/os_detect/analysis_options.yaml new file mode 100644 index 00000000..6d32d926 --- /dev/null +++ b/pkgs/os_detect/analysis_options.yaml @@ -0,0 +1,9 @@ +# Copyright (c) 2020, 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. +include: package:pedantic/analysis_options.1.9.0.yaml +analyzer: + errors: + annotate_overrides: ignore + prefer_single_quotes: ignore + use_function_type_syntax_for_parameters: ignore \ No newline at end of file diff --git a/pkgs/os_detect/lib/os_id.dart b/pkgs/os_detect/lib/os_id.dart new file mode 100644 index 00000000..8cc4f3a2 --- /dev/null +++ b/pkgs/os_detect/lib/os_id.dart @@ -0,0 +1,67 @@ +// Copyright (c) 2020, 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. + +/// Information about the current operating system. +library pkg.os_id; + +import 'override.dart'; + +/// Identification of the current operating system or platform. +/// +/// Specific known operating systems are reported by a unique string. +String get operatingSystem => OperatingSystemID.current.operatingSystem; + +/// Representation of the version of the current operating system or platform. +/// +/// May be empty if no version is known or available. +String get operatingSystemVersion => + OperatingSystemID.current.operatingSystemVersion; + +/// Whether the current operating system is a version of +/// [Linux](https://en.wikipedia.org/wiki/Linux). +/// +/// Identified by [operatingSystem] being the string `linux`. +/// +/// This value is `false` if the operating system is a specialized +/// version of Linux that identifies itself by a different name, +/// for example Android (see [isAndroid]). +bool get isLinux => OperatingSystemID.current.isLinux; + +/// Whether the current operating system is a version of +/// [macOS](https://en.wikipedia.org/wiki/MacOS). +/// +/// Identified by [operatingSystem] being the string `macos`. +bool get isMacOS => OperatingSystemID.current.isMacOS; + +/// Whether the current operating system is a version of +/// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). +/// +/// Identified by [operatingSystem] being the string `windows`. +bool get isWindows => OperatingSystemID.current.isWindows; + +/// Whether the current operating system is a version of +/// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). +/// +/// Identified by [operatingSystem] being the string `android`. +bool get isAndroid => OperatingSystemID.current.isAndroid; + +/// Whether the current operating system is a version of +/// [iOS](https://en.wikipedia.org/wiki/IOS). +/// +/// Identified by [operatingSystem] being the string `ios`. +bool get isIOS => OperatingSystemID.current.isIOS; + +/// Whether the current operating system is a version of +/// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). +/// +/// Identified by [operatingSystem] being the string `fuchsia`. +bool get isFuchsia => OperatingSystemID.current.isFuchsia; + +/// Whether running in a web browser. +/// +/// Identified by [operatingSystem] being the string `browser`. +/// +/// If so, the [operatingSystemVersion] is the string made available +/// through `window.navigator.appVersion`. +bool get isBrowser => OperatingSystemID.current.isBrowser; diff --git a/pkgs/os_detect/lib/override.dart b/pkgs/os_detect/lib/override.dart new file mode 100644 index 00000000..72a40026 --- /dev/null +++ b/pkgs/os_detect/lib/override.dart @@ -0,0 +1,99 @@ +// Copyright (c) 2020, 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. + +/// Functionality to override information about the current platform. +library pkg.os_id.override; + +import "dart:async" show Zone, runZoned; + +import 'src/osid_unknown.dart' + if (dart.library.io) "src/osid_io.dart" + if (dart.library.html) "src/osid_html.dart"; + +/// The name and version of an operating system. +class OperatingSystemID { + /// The current operating system ID. + /// + /// Defaults to what information is available + /// from known platform specific libraries, + /// but can be overridden using functionality from the + /// `osid_override.dart` library. + static OperatingSystemID get current => Zone.current[#_osid] ?? platformOSID; + + /// A string representing the operating system or platform. + final String operatingSystem; + + /// A string representing the version of the operating system or platform. + /// + /// May be empty if no version is known or available. + final String operatingSystemVersion; + + /// Creates an operating system ID with the provided values. + const OperatingSystemID(this.operatingSystem, this.operatingSystemVersion); +} + +/// Convenience operations on [OperatingSystemID]. +/// +/// Implemented as extensions to allow users to *implement* [OperatingSystemID] +/// without having to implement all of these getters. +extension OperatingSystemIDGetters on OperatingSystemID { + /// Whether the operating system is a version of + /// [Linux](https://en.wikipedia.org/wiki/Linux). + /// + /// Identified by [operatingSystem] being the string `linux`. + /// + /// This value is `false` if the operating system is a specialized + /// version of Linux that identifies itself by a different name, + /// for example Android (see [isAndroid]). + bool get isLinux => ("linux" == operatingSystem); + + /// Whether the operating system is a version of + /// [macOS](https://en.wikipedia.org/wiki/MacOS). + /// + /// Identified by [operatingSystem] being the string `macos`. + bool get isMacOS => ("macos" == operatingSystem); + + /// Whether the operating system is a version of + /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). + /// + /// Identified by [operatingSystem] being the string `windows`. + bool get isWindows => ("windows" == operatingSystem); + + /// Whether the operating system is a version of + /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). + /// + /// Identified by [operatingSystem] being the string `android`. + bool get isAndroid => ("android" == operatingSystem); + + /// Whether the operating system is a version of + /// [iOS](https://en.wikipedia.org/wiki/IOS). + /// + /// Identified by [operatingSystem] being the string `ios`. + bool get isIOS => ("ios" == operatingSystem); + + /// Whether the operating system is a version of + /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). + /// + /// Identified by [operatingSystem] being the string `fuchsia`. + bool get isFuchsia => ("fuchsia" == operatingSystem); + + /// Whether running in a web browser. + /// + /// Identified by [operatingSystem] being the string `browser`. + /// + /// If so, the [operatingSystemVersion] is the string made available + /// through `window.navigator.appVersion`. + bool get isBrowser => ("browser" == operatingSystem); +} + +/// Run [body] in a zone with platform overrides. +/// +/// Overrides [OperatingSystemID.current] with the supplied [osId] +/// value while running in a new zone, and then runs [body] in that zone. +/// +/// This override affects the `operatingSystem` and `operatingSystemVersion` +/// exported by `package:osid/osid.dart`. +R overrideOperatingSystem(OperatingSystemID osId, R body()) { + return runZoned(body, zoneValues: {#_osid: osId}); +} diff --git a/pkgs/os_detect/lib/src/osid_html.dart b/pkgs/os_detect/lib/src/osid_html.dart new file mode 100644 index 00000000..8c833d31 --- /dev/null +++ b/pkgs/os_detect/lib/src/osid_html.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2020, 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:html"; + +import '../override.dart'; + +const String _os = "browser"; +String get _osVersion => window.navigator.appVersion; + +final OperatingSystemID platformOSID = OperatingSystemID(_os, _osVersion); diff --git a/pkgs/os_detect/lib/src/osid_io.dart b/pkgs/os_detect/lib/src/osid_io.dart new file mode 100644 index 00000000..9a422e1c --- /dev/null +++ b/pkgs/os_detect/lib/src/osid_io.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2020, 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 '../override.dart'; + +String get _os => Platform.operatingSystem; +String get _osVersion => Platform.operatingSystemVersion; + +final OperatingSystemID platformOSID = OperatingSystemID(_os, _osVersion); diff --git a/pkgs/os_detect/lib/src/osid_unknown.dart b/pkgs/os_detect/lib/src/osid_unknown.dart new file mode 100644 index 00000000..03fb50a9 --- /dev/null +++ b/pkgs/os_detect/lib/src/osid_unknown.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2020, 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 '../override.dart'; + +const String _os = + String.fromEnvironment("dart.os.name", defaultValue: "unknown"); +const String _osVersion = String.fromEnvironment("dart.os.version"); + +const OperatingSystemID platformOSID = OperatingSystemID(_os, _osVersion); diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml new file mode 100644 index 00000000..b5d8419c --- /dev/null +++ b/pkgs/os_detect/pubspec.yaml @@ -0,0 +1,7 @@ +name: os_id +version: 1.0.0 +environment: + sdk: ">=2.8.0 <3.0.0" +dev_dependencies: + pedantic: ^1.9.0 + test: ^1.15.0 \ No newline at end of file diff --git a/pkgs/os_detect/test/osid_test.dart b/pkgs/os_detect/test/osid_test.dart new file mode 100644 index 00000000..4d865c5f --- /dev/null +++ b/pkgs/os_detect/test/osid_test.dart @@ -0,0 +1,75 @@ +// Copyright (c) 2020, 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:os_id/os_id.dart"; +import 'package:os_id/override.dart'; + +import "package:test/test.dart"; + +void main() { + test("Exists and is consistent", () { + expect(operatingSystem, isNotNull); + expect(operatingSystemVersion, isNotNull); + + expect(isLinux, operatingSystem == "linux"); + expect(isAndroid, operatingSystem == "android"); + expect(isMacOS, operatingSystem == "macos"); + expect(isWindows, operatingSystem == "windows"); + expect(isIOS, operatingSystem == "ios"); + expect(isFuchsia, operatingSystem == "fuchsia"); + expect(isBrowser, operatingSystem == "browser"); + }); + + test("Override", () { + const overrideName = "argle-bargle"; + const overrideVersion = "glop-glyf"; + const overrideID = OperatingSystemID(overrideName, overrideVersion); + Zone/*?*/ overrideZone; + + var originalName = operatingSystem; + var originalVersion = operatingSystemVersion; + var originalID = OperatingSystemID.current; + var originalZone = Zone.current; + expect(originalName, isNot(overrideName)); + expect(originalVersion, isNot(overrideVersion)); + + + // Override OS ID. + overrideOperatingSystem(overrideID, () { + overrideZone = Zone.current; + expect(operatingSystem, overrideName); + expect(operatingSystemVersion, overrideVersion); + expect(OperatingSystemID.current, same(overrideID)); + // Nested override. + overrideOperatingSystem(originalID, () { + expect(operatingSystem, originalName); + expect(operatingSystemVersion, originalVersion); + expect(OperatingSystemID.current, same(originalID)); + }); + expect(operatingSystem, overrideName); + expect(operatingSystemVersion, overrideVersion); + expect(OperatingSystemID.current, same(overrideID)); + // Captured parent zone does not have override. + originalZone.run(() { + expect(operatingSystem, originalName); + expect(operatingSystemVersion, originalVersion); + }); + expect(operatingSystem, overrideName); + expect(operatingSystemVersion, overrideVersion); + expect(OperatingSystemID.current, same(overrideID)); + }); + + expect(operatingSystem, originalName); + expect(operatingSystemVersion, originalVersion); + + // A captured override zone retains the override. + overrideZone/*!*/.run(() { + expect(operatingSystem, overrideName); + expect(operatingSystemVersion, overrideVersion); + expect(OperatingSystemID.current, same(overrideID)); + }); + }); +} From aeef2721c1e2e871662a45fc0efa8d0f450e79ad Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Thu, 24 Sep 2020 15:55:40 +0200 Subject: [PATCH 03/49] Update README.md (dart-lang/os_detect#1) * Update README.md --- pkgs/os_detect/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/README.md b/pkgs/os_detect/README.md index 40feb4fe..7c8274e5 100644 --- a/pkgs/os_detect/README.md +++ b/pkgs/os_detect/README.md @@ -14,7 +14,7 @@ based on the `operatingSystem` string. To use this package instead of `dart:io`, replace the import of `dart:io` with: ```dart -import "package:platform_id/platform_id.dart" as Platform; +import "package:os_id/os_id.dart" as Platform; ``` That should keep the code working if the only functionality used from `dart:io` is operating system detection. @@ -39,4 +39,4 @@ to whatever values are desired. The class `OperatingSystemID` can also be used directly to abstract over the operating system name and version. The `OperatingSystemID.current` defaults to the values provided by the platform -when not overridden using `overrideOperatingSystem`, \ No newline at end of file +when not overridden using `overrideOperatingSystem`. From c98acbbbf17c6cac349b9c20871ba102fe5f9e30 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Thu, 24 Sep 2020 16:01:44 +0200 Subject: [PATCH 04/49] Update .travis.yml (dart-lang/os_detect#3) --- pkgs/os_detect/.travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os_detect/.travis.yml b/pkgs/os_detect/.travis.yml index 69c6f72f..8f0ecf66 100644 --- a/pkgs/os_detect/.travis.yml +++ b/pkgs/os_detect/.travis.yml @@ -1,7 +1,7 @@ language: dart dart: - dev -- 2.7.0 +- stable # Only building master means that we don't run two builds for each pull request. dart_task: - test: --platform vm,chrome From cfb842df2e80ebe8dca90be72860939c447917bf Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Thu, 24 Sep 2020 16:02:08 +0200 Subject: [PATCH 05/49] Update travis in README.md (dart-lang/os_detect#2) * Update README.md --- pkgs/os_detect/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os_detect/README.md b/pkgs/os_detect/README.md index 7c8274e5..00c470a1 100644 --- a/pkgs/os_detect/README.md +++ b/pkgs/os_detect/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/lrhn/os_id.svg?branch=master)](https://travis-ci.org/lrhn/os_id) +[![Build Status](https://api.travis-ci.org/dart-lang/os_id.svg?branch=master)](https://travis-ci.org/github/dart-lang/os_id) Platform independent access to information about the current operating system. From dccdca642f17b7479e4edcf9fc1aeebcf9b860af Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Thu, 24 Sep 2020 16:21:41 +0200 Subject: [PATCH 06/49] Please formatter. (dart-lang/os_detect#4) --- pkgs/os_detect/test/osid_test.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/os_detect/test/osid_test.dart b/pkgs/os_detect/test/osid_test.dart index 4d865c5f..63718d6b 100644 --- a/pkgs/os_detect/test/osid_test.dart +++ b/pkgs/os_detect/test/osid_test.dart @@ -27,7 +27,7 @@ void main() { const overrideName = "argle-bargle"; const overrideVersion = "glop-glyf"; const overrideID = OperatingSystemID(overrideName, overrideVersion); - Zone/*?*/ overrideZone; + Zone /*?*/ overrideZone; var originalName = operatingSystem; var originalVersion = operatingSystemVersion; @@ -36,7 +36,6 @@ void main() { expect(originalName, isNot(overrideName)); expect(originalVersion, isNot(overrideVersion)); - // Override OS ID. overrideOperatingSystem(overrideID, () { overrideZone = Zone.current; @@ -66,7 +65,7 @@ void main() { expect(operatingSystemVersion, originalVersion); // A captured override zone retains the override. - overrideZone/*!*/.run(() { + overrideZone /*!*/ .run(() { expect(operatingSystem, overrideName); expect(operatingSystemVersion, overrideVersion); expect(OperatingSystemID.current, same(overrideID)); From 51c8c9f664e354ca19d7dd51a5114762f03b132f Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Thu, 1 Oct 2020 15:51:01 +0200 Subject: [PATCH 07/49] Rename project to os_detect. (dart-lang/os_detect#5) Also rename some classes and members in `override.dart` to not say `OperatingSystemID` and not repeat "operating system" unnecessarily. --- pkgs/os_detect/README.md | 8 +-- .../lib/{os_id.dart => os_detect.dart} | 21 ++++--- pkgs/os_detect/lib/override.dart | 56 +++++++++---------- pkgs/os_detect/lib/src/osid_html.dart | 2 +- pkgs/os_detect/lib/src/osid_io.dart | 2 +- pkgs/os_detect/lib/src/osid_unknown.dart | 2 +- pkgs/os_detect/pubspec.yaml | 2 +- pkgs/os_detect/test/osid_test.dart | 20 +++---- 8 files changed, 56 insertions(+), 57 deletions(-) rename pkgs/os_detect/lib/{os_id.dart => os_detect.dart} (78%) diff --git a/pkgs/os_detect/README.md b/pkgs/os_detect/README.md index 00c470a1..0d2b8686 100644 --- a/pkgs/os_detect/README.md +++ b/pkgs/os_detect/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://api.travis-ci.org/dart-lang/os_id.svg?branch=master)](https://travis-ci.org/github/dart-lang/os_id) +[![Build Status](https://api.travis-ci.org/dart-lang/os_detect.svg?branch=master)](https://travis-ci.org/github/dart-lang/os_detect) Platform independent access to information about the current operating system. @@ -14,7 +14,7 @@ based on the `operatingSystem` string. To use this package instead of `dart:io`, replace the import of `dart:io` with: ```dart -import "package:os_id/os_id.dart" as Platform; +import "package:os_detect/os_detect.dart" as Platform; ``` That should keep the code working if the only functionality used from `dart:io` is operating system detection. @@ -30,8 +30,8 @@ so that `const String.fromEnvironment` can access them. It's possible to override the current operating system string, as exposed by `operatingSystem` and `operatingSystemVersion` -in `package:os_id/os_id.dart`. -To do so, import the `package:os_id/override.dart` library +in `package:os_detect/os_detect.dart`. +To do so, import the `package:os_detect/override.dart` library and use the `overrideOperatingSystem` function to run code in a zone where the operating system and version values are set to whatever values are desired. diff --git a/pkgs/os_detect/lib/os_id.dart b/pkgs/os_detect/lib/os_detect.dart similarity index 78% rename from pkgs/os_detect/lib/os_id.dart rename to pkgs/os_detect/lib/os_detect.dart index 8cc4f3a2..2e252eb6 100644 --- a/pkgs/os_detect/lib/os_id.dart +++ b/pkgs/os_detect/lib/os_detect.dart @@ -3,20 +3,19 @@ // BSD-style license that can be found in the LICENSE file. /// Information about the current operating system. -library pkg.os_id; +library pkg.os_detect; import 'override.dart'; /// Identification of the current operating system or platform. /// /// Specific known operating systems are reported by a unique string. -String get operatingSystem => OperatingSystemID.current.operatingSystem; +String get operatingSystem => OperatingSystem.current.id; /// Representation of the version of the current operating system or platform. /// /// May be empty if no version is known or available. -String get operatingSystemVersion => - OperatingSystemID.current.operatingSystemVersion; +String get operatingSystemVersion => OperatingSystem.current.version; /// Whether the current operating system is a version of /// [Linux](https://en.wikipedia.org/wiki/Linux). @@ -26,37 +25,37 @@ String get operatingSystemVersion => /// This value is `false` if the operating system is a specialized /// version of Linux that identifies itself by a different name, /// for example Android (see [isAndroid]). -bool get isLinux => OperatingSystemID.current.isLinux; +bool get isLinux => OperatingSystem.current.isLinux; /// Whether the current operating system is a version of /// [macOS](https://en.wikipedia.org/wiki/MacOS). /// /// Identified by [operatingSystem] being the string `macos`. -bool get isMacOS => OperatingSystemID.current.isMacOS; +bool get isMacOS => OperatingSystem.current.isMacOS; /// Whether the current operating system is a version of /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). /// /// Identified by [operatingSystem] being the string `windows`. -bool get isWindows => OperatingSystemID.current.isWindows; +bool get isWindows => OperatingSystem.current.isWindows; /// Whether the current operating system is a version of /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). /// /// Identified by [operatingSystem] being the string `android`. -bool get isAndroid => OperatingSystemID.current.isAndroid; +bool get isAndroid => OperatingSystem.current.isAndroid; /// Whether the current operating system is a version of /// [iOS](https://en.wikipedia.org/wiki/IOS). /// /// Identified by [operatingSystem] being the string `ios`. -bool get isIOS => OperatingSystemID.current.isIOS; +bool get isIOS => OperatingSystem.current.isIOS; /// Whether the current operating system is a version of /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). /// /// Identified by [operatingSystem] being the string `fuchsia`. -bool get isFuchsia => OperatingSystemID.current.isFuchsia; +bool get isFuchsia => OperatingSystem.current.isFuchsia; /// Whether running in a web browser. /// @@ -64,4 +63,4 @@ bool get isFuchsia => OperatingSystemID.current.isFuchsia; /// /// If so, the [operatingSystemVersion] is the string made available /// through `window.navigator.appVersion`. -bool get isBrowser => OperatingSystemID.current.isBrowser; +bool get isBrowser => OperatingSystem.current.isBrowser; diff --git a/pkgs/os_detect/lib/override.dart b/pkgs/os_detect/lib/override.dart index 72a40026..bb54cc0f 100644 --- a/pkgs/os_detect/lib/override.dart +++ b/pkgs/os_detect/lib/override.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. /// Functionality to override information about the current platform. -library pkg.os_id.override; +library pkg.os_detect.override; import "dart:async" show Zone, runZoned; @@ -12,88 +12,88 @@ import 'src/osid_unknown.dart' if (dart.library.html) "src/osid_html.dart"; /// The name and version of an operating system. -class OperatingSystemID { +class OperatingSystem { /// The current operating system ID. /// /// Defaults to what information is available /// from known platform specific libraries, /// but can be overridden using functionality from the /// `osid_override.dart` library. - static OperatingSystemID get current => Zone.current[#_osid] ?? platformOSID; + static OperatingSystem get current => Zone.current[#_os] ?? platformOS; /// A string representing the operating system or platform. - final String operatingSystem; + final String id; /// A string representing the version of the operating system or platform. /// /// May be empty if no version is known or available. - final String operatingSystemVersion; + final String version; /// Creates an operating system ID with the provided values. - const OperatingSystemID(this.operatingSystem, this.operatingSystemVersion); + const OperatingSystem(this.id, this.version); } -/// Convenience operations on [OperatingSystemID]. +/// Convenience operations on [OperatingSystem]. /// -/// Implemented as extensions to allow users to *implement* [OperatingSystemID] +/// Implemented as extensions to allow users to *implement* [OperatingSystem] /// without having to implement all of these getters. -extension OperatingSystemIDGetters on OperatingSystemID { +extension OperatingSystemGetters on OperatingSystem { /// Whether the operating system is a version of /// [Linux](https://en.wikipedia.org/wiki/Linux). /// - /// Identified by [operatingSystem] being the string `linux`. + /// Identified by [id] being the string `linux`. /// /// This value is `false` if the operating system is a specialized /// version of Linux that identifies itself by a different name, /// for example Android (see [isAndroid]). - bool get isLinux => ("linux" == operatingSystem); + bool get isLinux => ("linux" == id); /// Whether the operating system is a version of /// [macOS](https://en.wikipedia.org/wiki/MacOS). /// - /// Identified by [operatingSystem] being the string `macos`. - bool get isMacOS => ("macos" == operatingSystem); + /// Identified by [id] being the string `macos`. + bool get isMacOS => ("macos" == id); /// Whether the operating system is a version of /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). /// - /// Identified by [operatingSystem] being the string `windows`. - bool get isWindows => ("windows" == operatingSystem); + /// Identified by [id] being the string `windows`. + bool get isWindows => ("windows" == id); /// Whether the operating system is a version of /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). /// - /// Identified by [operatingSystem] being the string `android`. - bool get isAndroid => ("android" == operatingSystem); + /// Identified by [id] being the string `android`. + bool get isAndroid => ("android" == id); /// Whether the operating system is a version of /// [iOS](https://en.wikipedia.org/wiki/IOS). /// - /// Identified by [operatingSystem] being the string `ios`. - bool get isIOS => ("ios" == operatingSystem); + /// Identified by [id] being the string `ios`. + bool get isIOS => ("ios" == id); /// Whether the operating system is a version of /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). /// - /// Identified by [operatingSystem] being the string `fuchsia`. - bool get isFuchsia => ("fuchsia" == operatingSystem); + /// Identified by [id] being the string `fuchsia`. + bool get isFuchsia => ("fuchsia" == id); /// Whether running in a web browser. /// - /// Identified by [operatingSystem] being the string `browser`. + /// Identified by [id] being the string `browser`. /// - /// If so, the [operatingSystemVersion] is the string made available + /// If so, the [version] is the string made available /// through `window.navigator.appVersion`. - bool get isBrowser => ("browser" == operatingSystem); + bool get isBrowser => ("browser" == id); } /// Run [body] in a zone with platform overrides. /// -/// Overrides [OperatingSystemID.current] with the supplied [osId] +/// Overrides [OperatingSystem.current] with the supplied [osId] /// value while running in a new zone, and then runs [body] in that zone. /// -/// This override affects the `operatingSystem` and `operatingSystemVersion` +/// This override affects the `operatingSystem` and `version` /// exported by `package:osid/osid.dart`. -R overrideOperatingSystem(OperatingSystemID osId, R body()) { - return runZoned(body, zoneValues: {#_osid: osId}); +R overrideOperatingSystem(OperatingSystem operatingSystem, R body()) { + return runZoned(body, zoneValues: {#_os: operatingSystem}); } diff --git a/pkgs/os_detect/lib/src/osid_html.dart b/pkgs/os_detect/lib/src/osid_html.dart index 8c833d31..0c13e679 100644 --- a/pkgs/os_detect/lib/src/osid_html.dart +++ b/pkgs/os_detect/lib/src/osid_html.dart @@ -9,4 +9,4 @@ import '../override.dart'; const String _os = "browser"; String get _osVersion => window.navigator.appVersion; -final OperatingSystemID platformOSID = OperatingSystemID(_os, _osVersion); +final OperatingSystem platformOS = OperatingSystem(_os, _osVersion); diff --git a/pkgs/os_detect/lib/src/osid_io.dart b/pkgs/os_detect/lib/src/osid_io.dart index 9a422e1c..440280f9 100644 --- a/pkgs/os_detect/lib/src/osid_io.dart +++ b/pkgs/os_detect/lib/src/osid_io.dart @@ -9,4 +9,4 @@ import '../override.dart'; String get _os => Platform.operatingSystem; String get _osVersion => Platform.operatingSystemVersion; -final OperatingSystemID platformOSID = OperatingSystemID(_os, _osVersion); +final OperatingSystem platformOS = OperatingSystem(_os, _osVersion); diff --git a/pkgs/os_detect/lib/src/osid_unknown.dart b/pkgs/os_detect/lib/src/osid_unknown.dart index 03fb50a9..1339c2c5 100644 --- a/pkgs/os_detect/lib/src/osid_unknown.dart +++ b/pkgs/os_detect/lib/src/osid_unknown.dart @@ -8,4 +8,4 @@ const String _os = String.fromEnvironment("dart.os.name", defaultValue: "unknown"); const String _osVersion = String.fromEnvironment("dart.os.version"); -const OperatingSystemID platformOSID = OperatingSystemID(_os, _osVersion); +const OperatingSystem platformOS = OperatingSystem(_os, _osVersion); diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index b5d8419c..69026f6b 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,4 +1,4 @@ -name: os_id +name: os_detect version: 1.0.0 environment: sdk: ">=2.8.0 <3.0.0" diff --git a/pkgs/os_detect/test/osid_test.dart b/pkgs/os_detect/test/osid_test.dart index 63718d6b..28351c4f 100644 --- a/pkgs/os_detect/test/osid_test.dart +++ b/pkgs/os_detect/test/osid_test.dart @@ -4,8 +4,8 @@ import "dart:async"; -import "package:os_id/os_id.dart"; -import 'package:os_id/override.dart'; +import "package:os_detect/os_detect.dart"; +import 'package:os_detect/override.dart'; import "package:test/test.dart"; @@ -26,31 +26,31 @@ void main() { test("Override", () { const overrideName = "argle-bargle"; const overrideVersion = "glop-glyf"; - const overrideID = OperatingSystemID(overrideName, overrideVersion); + const overrideOS = OperatingSystem(overrideName, overrideVersion); Zone /*?*/ overrideZone; var originalName = operatingSystem; var originalVersion = operatingSystemVersion; - var originalID = OperatingSystemID.current; + var originalID = OperatingSystem.current; var originalZone = Zone.current; expect(originalName, isNot(overrideName)); expect(originalVersion, isNot(overrideVersion)); // Override OS ID. - overrideOperatingSystem(overrideID, () { + overrideOperatingSystem(overrideOS, () { overrideZone = Zone.current; expect(operatingSystem, overrideName); expect(operatingSystemVersion, overrideVersion); - expect(OperatingSystemID.current, same(overrideID)); + expect(OperatingSystem.current, same(overrideOS)); // Nested override. overrideOperatingSystem(originalID, () { expect(operatingSystem, originalName); expect(operatingSystemVersion, originalVersion); - expect(OperatingSystemID.current, same(originalID)); + expect(OperatingSystem.current, same(originalID)); }); expect(operatingSystem, overrideName); expect(operatingSystemVersion, overrideVersion); - expect(OperatingSystemID.current, same(overrideID)); + expect(OperatingSystem.current, same(overrideOS)); // Captured parent zone does not have override. originalZone.run(() { expect(operatingSystem, originalName); @@ -58,7 +58,7 @@ void main() { }); expect(operatingSystem, overrideName); expect(operatingSystemVersion, overrideVersion); - expect(OperatingSystemID.current, same(overrideID)); + expect(OperatingSystem.current, same(overrideOS)); }); expect(operatingSystem, originalName); @@ -68,7 +68,7 @@ void main() { overrideZone /*!*/ .run(() { expect(operatingSystem, overrideName); expect(operatingSystemVersion, overrideVersion); - expect(OperatingSystemID.current, same(overrideID)); + expect(OperatingSystem.current, same(overrideOS)); }); }); } From bdef0210717848f4ccfa929f45dbfc7743d9526b Mon Sep 17 00:00:00 2001 From: Lasse Reichstein Holst Nielsen Date: Fri, 23 Oct 2020 13:05:22 +0200 Subject: [PATCH 08/49] Add description and homepage fields to pubspec. --- pkgs/os_detect/pubspec.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index 69026f6b..1c6e0a57 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,7 +1,9 @@ name: os_detect version: 1.0.0 +description: Platform independent OS detection. +homepage: https://github.com/dart-lang/os_detect environment: sdk: ">=2.8.0 <3.0.0" dev_dependencies: pedantic: ^1.9.0 - test: ^1.15.0 \ No newline at end of file + test: ^1.15.0 From 98838505c25cf24180af672dced8eba9f2d233b2 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Mon, 14 Dec 2020 16:11:36 +0100 Subject: [PATCH 09/49] Migrate to null safety (dart-lang/os_detect#6) * Migrate to null safety --- pkgs/os_detect/.travis.yml | 4 +++- pkgs/os_detect/pubspec.yaml | 8 ++++---- pkgs/os_detect/test/osid_test.dart | 5 ++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkgs/os_detect/.travis.yml b/pkgs/os_detect/.travis.yml index 8f0ecf66..982eb4b9 100644 --- a/pkgs/os_detect/.travis.yml +++ b/pkgs/os_detect/.travis.yml @@ -1,7 +1,9 @@ language: dart dart: - dev -- stable +# Disabling the stable build until 2.12 stable with null safety is available. +# TODO: Enable stable testing in CI once 2.12 stable is ready. +# - stable # Only building master means that we don't run two builds for each pull request. dart_task: - test: --platform vm,chrome diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index 1c6e0a57..cd848fe9 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,9 +1,9 @@ name: os_detect -version: 1.0.0 +version: 1.1.0-nullsafety.0 description: Platform independent OS detection. homepage: https://github.com/dart-lang/os_detect environment: - sdk: ">=2.8.0 <3.0.0" + sdk: '>=2.12.0-0 <3.0.0' dev_dependencies: - pedantic: ^1.9.0 - test: ^1.15.0 + pedantic: ^1.10.0-nullsafety + test: ^1.16.0-nullsafety diff --git a/pkgs/os_detect/test/osid_test.dart b/pkgs/os_detect/test/osid_test.dart index 28351c4f..4c2c8c5d 100644 --- a/pkgs/os_detect/test/osid_test.dart +++ b/pkgs/os_detect/test/osid_test.dart @@ -6,7 +6,6 @@ import "dart:async"; import "package:os_detect/os_detect.dart"; import 'package:os_detect/override.dart'; - import "package:test/test.dart"; void main() { @@ -27,7 +26,7 @@ void main() { const overrideName = "argle-bargle"; const overrideVersion = "glop-glyf"; const overrideOS = OperatingSystem(overrideName, overrideVersion); - Zone /*?*/ overrideZone; + Zone? overrideZone; var originalName = operatingSystem; var originalVersion = operatingSystemVersion; @@ -65,7 +64,7 @@ void main() { expect(operatingSystemVersion, originalVersion); // A captured override zone retains the override. - overrideZone /*!*/ .run(() { + overrideZone!.run(() { expect(operatingSystem, overrideName); expect(operatingSystemVersion, overrideVersion); expect(OperatingSystem.current, same(overrideOS)); From 01dbf4193d138ca44af4ef893102c7d02b59fdaa Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 16 Dec 2020 09:12:15 -0800 Subject: [PATCH 10/49] Use a major version bump for null safety (dart-lang/os_detect#7) Even though this package has very little usage follow the migration guide including a breaking change version bump. --- pkgs/os_detect/CHANGELOG.md | 6 ++++-- pkgs/os_detect/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index e1e1be20..9693c2db 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,5 +1,7 @@ -# Changelog +## 2.0.0-nullsafety.0 + +- Migrate to null safety. ## 1.0.0 -* Initial release \ No newline at end of file +* Initial release diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index cd848fe9..e33d53dc 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,5 +1,5 @@ name: os_detect -version: 1.1.0-nullsafety.0 +version: 2.0.0-nullsafety.0 description: Platform independent OS detection. homepage: https://github.com/dart-lang/os_detect environment: From d3df277b8c922ab6b54444c6306766096a00e1c8 Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Mon, 1 Feb 2021 17:58:13 +0100 Subject: [PATCH 11/49] Migrate to GitHub Actions (dart-lang/os_detect#8) * Migrate to GitHub Actions * Delete .travis.yml * Replace Travis badge --- .../.github/workflows/test-package.yml | 64 +++++++++++++++++++ pkgs/os_detect/.travis.yml | 16 ----- pkgs/os_detect/README.md | 2 +- 3 files changed, 65 insertions(+), 17 deletions(-) create mode 100644 pkgs/os_detect/.github/workflows/test-package.yml delete mode 100644 pkgs/os_detect/.travis.yml diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml new file mode 100644 index 00000000..0a2a8743 --- /dev/null +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -0,0 +1,64 @@ +name: Dart CI + +on: + # Run on PRs and pushes to the default branch. + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: "0 0 * * 0" + +env: + PUB_ENVIRONMENT: bot.github + +jobs: + # Check code formatting and static analysis on a single OS (linux) + # against Dart dev. + analyze: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [dev] + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v0.3 + 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' + + # Run tests on a matrix consisting of two dimensions: + # 1. OS: ubuntu-latest, (macos-latest, windows-latest) + # 2. release channel: dev + test: + needs: analyze + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # Add macos-latest and/or windows-latest if relevant for this package. + os: [ubuntu-latest] + sdk: [dev] + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v0.3 + with: + sdk: ${{ matrix.sdk }} + - id: install + name: Install dependencies + run: dart pub get + - name: Run VM tests + run: dart test --platform vm + if: always() && steps.install.outcome == 'success' + - name: Run Chrome tests + run: dart test --platform chrome + if: always() && steps.install.outcome == 'success' diff --git a/pkgs/os_detect/.travis.yml b/pkgs/os_detect/.travis.yml deleted file mode 100644 index 982eb4b9..00000000 --- a/pkgs/os_detect/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: dart -dart: -- dev -# Disabling the stable build until 2.12 stable with null safety is available. -# TODO: Enable stable testing in CI once 2.12 stable is ready. -# - stable -# Only building master means that we don't run two builds for each pull request. -dart_task: -- test: --platform vm,chrome -- dartanalyzer -- dartfmt -branches: - only: [master] -cache: - directories: - - $HOME/.pub-cache diff --git a/pkgs/os_detect/README.md b/pkgs/os_detect/README.md index 0d2b8686..88e667d1 100644 --- a/pkgs/os_detect/README.md +++ b/pkgs/os_detect/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://api.travis-ci.org/dart-lang/os_detect.svg?branch=master)](https://travis-ci.org/github/dart-lang/os_detect) +[![Build Status](https://github.com/dart-lang/os_detect/workflows/Dart%20CI/badge.svg)](https://github.com/dart-lang/os_detect/actions?query=workflow%3A"Dart+CI"+branch%3Amaster) Platform independent access to information about the current operating system. From cec8d0bf9af37a296ca49dfdc8c8c41e79d7d9c4 Mon Sep 17 00:00:00 2001 From: Franklin Yow <58489007+franklinyow@users.noreply.github.com> Date: Thu, 1 Apr 2021 09:38:51 -0700 Subject: [PATCH 12/49] Update LICENSE (dart-lang/os_detect#11) Changes to comply with internal review --- pkgs/os_detect/LICENSE | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/LICENSE b/pkgs/os_detect/LICENSE index 18daf2b5..ed0a3506 100644 --- a/pkgs/os_detect/LICENSE +++ b/pkgs/os_detect/LICENSE @@ -1,4 +1,5 @@ -Copyright 2020, the Dart project authors. All rights reserved. +Copyright 2020, 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 fc9df012a1b6522d0aeb94009d8fce1333d41775 Mon Sep 17 00:00:00 2001 From: Lasse Rosenow <10547444+LasseRosenow@users.noreply.github.com> Date: Tue, 6 Apr 2021 13:00:39 +0200 Subject: [PATCH 13/49] Update version and dependencies (dart-lang/os_detect#10) --- pkgs/os_detect/CHANGELOG.md | 4 ++++ pkgs/os_detect/pubspec.yaml | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index 9693c2db..9fb2ee89 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0 + +- Stable null safety release. + ## 2.0.0-nullsafety.0 - Migrate to null safety. diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index e33d53dc..b9c1803d 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,9 +1,9 @@ name: os_detect -version: 2.0.0-nullsafety.0 +version: 2.0.0 description: Platform independent OS detection. homepage: https://github.com/dart-lang/os_detect environment: sdk: '>=2.12.0-0 <3.0.0' dev_dependencies: - pedantic: ^1.10.0-nullsafety - test: ^1.16.0-nullsafety + pedantic: ^1.11.0 + test: ^1.16.8 From 5a5844094e981c628013f807d60503bfcaa1828f Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Mon, 26 Apr 2021 11:41:05 +0200 Subject: [PATCH 14/49] Update the SDK constraint to 2.12.0 from 2.12.0-0 (dart-lang/os_detect#12) --- pkgs/os_detect/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index b9c1803d..fa12eb44 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -3,7 +3,7 @@ version: 2.0.0 description: Platform independent OS detection. homepage: https://github.com/dart-lang/os_detect environment: - sdk: '>=2.12.0-0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dev_dependencies: pedantic: ^1.11.0 test: ^1.16.8 From 41253e7e0b9f3fbbe672aff992a5ff8805eebcf1 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 7 Jun 2021 10:48:45 -0700 Subject: [PATCH 15/49] Add dependabot --- pkgs/os_detect/.github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 pkgs/os_detect/.github/dependabot.yml diff --git a/pkgs/os_detect/.github/dependabot.yml b/pkgs/os_detect/.github/dependabot.yml new file mode 100644 index 00000000..40cab315 --- /dev/null +++ b/pkgs/os_detect/.github/dependabot.yml @@ -0,0 +1,11 @@ +# Set update schedule for GitHub Actions +# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot + +version: 2 +updates: + +- package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "monthly" From 26891142792cd1af7458bf2f7dc70fafd43870ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Jun 2021 10:56:03 -0700 Subject: [PATCH 16/49] Bump dart-lang/setup-dart from 0.3 to 1 (dart-lang/os_detect#13) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 0.3 to 1. - [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/v0.3...v1) --- updated-dependencies: - dependency-name: dart-lang/setup-dart 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> Co-authored-by: Kevin Moore --- pkgs/os_detect/.github/workflows/test-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 0a2a8743..611200bc 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v0.3 + - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} - id: install @@ -46,11 +46,11 @@ jobs: fail-fast: false matrix: # Add macos-latest and/or windows-latest if relevant for this package. - os: [ubuntu-latest] - sdk: [dev] + os: [ubuntu-latest, windows-latest, macos-latest] + sdk: [2.12.0, dev] steps: - uses: actions/checkout@v2 - - uses: dart-lang/setup-dart@v0.3 + - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} - id: install From b795cf595f7e1772708a70469c8b748d217d0a1f Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 12 Aug 2021 02:04:54 -0700 Subject: [PATCH 17/49] Migrate to pkg:lints lints (dart-lang/os_detect#14) --- pkgs/os_detect/analysis_options.yaml | 9 ++++----- pkgs/os_detect/lib/override.dart | 6 ++++-- pkgs/os_detect/pubspec.yaml | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/os_detect/analysis_options.yaml b/pkgs/os_detect/analysis_options.yaml index 6d32d926..ff53a8b1 100644 --- a/pkgs/os_detect/analysis_options.yaml +++ b/pkgs/os_detect/analysis_options.yaml @@ -1,9 +1,8 @@ # Copyright (c) 2020, 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. -include: package:pedantic/analysis_options.1.9.0.yaml +include: package:lints/recommended.yaml + analyzer: - errors: - annotate_overrides: ignore - prefer_single_quotes: ignore - use_function_type_syntax_for_parameters: ignore \ No newline at end of file + strong-mode: + implicit-casts: false diff --git a/pkgs/os_detect/lib/override.dart b/pkgs/os_detect/lib/override.dart index bb54cc0f..14042b10 100644 --- a/pkgs/os_detect/lib/override.dart +++ b/pkgs/os_detect/lib/override.dart @@ -19,7 +19,8 @@ class OperatingSystem { /// from known platform specific libraries, /// but can be overridden using functionality from the /// `osid_override.dart` library. - static OperatingSystem get current => Zone.current[#_os] ?? platformOS; + static OperatingSystem get current => + Zone.current[#_os] as OperatingSystem? ?? platformOS; /// A string representing the operating system or platform. final String id; @@ -94,6 +95,7 @@ extension OperatingSystemGetters on OperatingSystem { /// /// This override affects the `operatingSystem` and `version` /// exported by `package:osid/osid.dart`. -R overrideOperatingSystem(OperatingSystem operatingSystem, R body()) { +R overrideOperatingSystem( + OperatingSystem operatingSystem, R Function() body) { return runZoned(body, zoneValues: {#_os: operatingSystem}); } diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index fa12eb44..bfc29598 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -4,6 +4,7 @@ description: Platform independent OS detection. homepage: https://github.com/dart-lang/os_detect environment: sdk: '>=2.12.0 <3.0.0' + dev_dependencies: - pedantic: ^1.11.0 + lints: ^1.0.0 test: ^1.16.8 From 2e297396af51871b464edea804cea22c1f352077 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 20 Apr 2022 14:52:53 -0700 Subject: [PATCH 18/49] Switch from homepage to repository in pubspec (dart-lang/os_detect#17) --- pkgs/os_detect/CHANGELOG.md | 2 ++ pkgs/os_detect/pubspec.yaml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index 9fb2ee89..2c91ed24 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.0.1-dev + ## 2.0.0 - Stable null safety release. diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index bfc29598..489311be 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,7 +1,8 @@ name: os_detect -version: 2.0.0 +version: 2.0.1-dev description: Platform independent OS detection. -homepage: https://github.com/dart-lang/os_detect +repository: https://github.com/dart-lang/os_detect + environment: sdk: '>=2.12.0 <3.0.0' From e4b64f3f252a6a08ff3a3cf6ebc0f58886f3ab50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 May 2022 11:17:56 -0700 Subject: [PATCH 19/49] Bump actions/checkout from 2 to 3 (dart-lang/os_detect#16) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [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/v2...v3) --- 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 611200bc..7066a015 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 with: sdk: ${{ matrix.sdk }} From bc7c255093f79b591bd0a213b3c3c6c13e3d4c32 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 16 May 2022 08:40:26 -0700 Subject: [PATCH 20/49] prep for publishing 2.0.1 (dart-lang/os_detect#18) --- pkgs/os_detect/CHANGELOG.md | 6 ++++-- pkgs/os_detect/README.md | 2 ++ pkgs/os_detect/pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index 2c91ed24..416d8525 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,4 +1,6 @@ -## 2.0.1-dev +## 2.0.1 + +- Populate the pubspec `repository` field. ## 2.0.0 @@ -10,4 +12,4 @@ ## 1.0.0 -* Initial release +- Initial release diff --git a/pkgs/os_detect/README.md b/pkgs/os_detect/README.md index 88e667d1..a0f61d90 100644 --- a/pkgs/os_detect/README.md +++ b/pkgs/os_detect/README.md @@ -1,4 +1,6 @@ [![Build Status](https://github.com/dart-lang/os_detect/workflows/Dart%20CI/badge.svg)](https://github.com/dart-lang/os_detect/actions?query=workflow%3A"Dart+CI"+branch%3Amaster) +[![pub package](https://img.shields.io/pub/v/os_detect.svg)](https://pub.dev/packages/os_detect) +[![package publisher](https://img.shields.io/pub/publisher/os_detect.svg)](https://pub.dev/packages/os_detect/publisher) Platform independent access to information about the current operating system. diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index 489311be..a749ef01 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,5 +1,5 @@ name: os_detect -version: 2.0.1-dev +version: 2.0.1 description: Platform independent OS detection. repository: https://github.com/dart-lang/os_detect From 49f35539ed6086a3b31d451fddddd589f14cd1c8 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 15 Nov 2022 12:27:17 -0800 Subject: [PATCH 21/49] blast_repo fixes (dart-lang/os_detect#20) GitHub Action --- pkgs/os_detect/.github/workflows/test-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 7066a015..7882ada5 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,8 +22,8 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} - id: install @@ -49,8 +49,8 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [2.12.0, dev] steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@v1 + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} - id: install From 0865ce79d789cde831ffccbd3c2cc0a467bbba0f Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 9 Jan 2023 15:02:56 -0800 Subject: [PATCH 22/49] Migrate from no-implicit-casts to strict-casts (dart-lang/os_detect#22) --- pkgs/os_detect/analysis_options.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/analysis_options.yaml b/pkgs/os_detect/analysis_options.yaml index ff53a8b1..5e042b85 100644 --- a/pkgs/os_detect/analysis_options.yaml +++ b/pkgs/os_detect/analysis_options.yaml @@ -4,5 +4,5 @@ include: package:lints/recommended.yaml analyzer: - strong-mode: - implicit-casts: false + language: + strict-casts: true From 6a9bc96d0d1cbc659cf4b3de24fba2fed2d2a726 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Jan 2023 11:47:43 -0800 Subject: [PATCH 23/49] Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/os_detect#21) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 7882ada5..ae8e4a3a 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-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 a5737b1e7d2495640df7daa3e26a7b298dd7b12c Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 11 Jan 2023 14:00:50 -0800 Subject: [PATCH 24/49] Update min SDK to 2.18, enable and fix new lints, add an example (dart-lang/os_detect#23) --- .../.github/workflows/test-package.yml | 2 +- pkgs/os_detect/CHANGELOG.md | 8 +-- pkgs/os_detect/README.md | 56 +++++++++---------- pkgs/os_detect/analysis_options.yaml | 53 +++++++++++++++++- pkgs/os_detect/example/example.dart | 12 ++++ pkgs/os_detect/lib/override.dart | 27 +++++---- pkgs/os_detect/lib/src/osid_html.dart | 4 +- pkgs/os_detect/lib/src/osid_io.dart | 2 +- pkgs/os_detect/lib/src/osid_unknown.dart | 4 +- pkgs/os_detect/pubspec.yaml | 6 +- pkgs/os_detect/test/osid_test.dart | 36 ++++++------ 11 files changed, 133 insertions(+), 77 deletions(-) create mode 100644 pkgs/os_detect/example/example.dart diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index ae8e4a3a..de7260b3 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest, windows-latest, macos-latest] - sdk: [2.12.0, dev] + sdk: [2.18.0, dev] steps: - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index 416d8525..0328fbb9 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.2-dev + +- Require Dart 2.18 + ## 2.0.1 - Populate the pubspec `repository` field. @@ -6,10 +10,6 @@ - Stable null safety release. -## 2.0.0-nullsafety.0 - -- Migrate to null safety. - ## 1.0.0 - Initial release diff --git a/pkgs/os_detect/README.md b/pkgs/os_detect/README.md index a0f61d90..94abc516 100644 --- a/pkgs/os_detect/README.md +++ b/pkgs/os_detect/README.md @@ -6,39 +6,37 @@ Platform independent access to information about the current operating system. ## Querying the current OS -Exposes `operatingSystem` and `operatingSystemVersion` strings -similar to those of the `Platform` class in `dart:io`, -but also works on the web. -The `operatingSystem` of a browser is the string "browser". -Also exposes convenience getters like `isLinux`, `isAndroid` and `isBrowser` -based on the `operatingSystem` string. - -To use this package instead of `dart:io`, replace -the import of `dart:io` with: +Exposes `operatingSystem` and `operatingSystemVersion` strings similar to those +of the `Platform` class in `dart:io`, but also works on the web. The +`operatingSystem` of a browser is the string "browser". Also exposes convenience +getters like `isLinux`, `isAndroid` and `isBrowser` based on the +`operatingSystem` string. + +To use this package instead of `dart:io`, replace the import of `dart:io` with: + ```dart -import "package:os_detect/os_detect.dart" as Platform; +import 'package:os_detect/os_detect.dart' as os_detect; ``` + That should keep the code working if the only functionality used from `dart:io` -is operating system detection. -You should then use your IDE to rename the import prefix from `Platform` -to something lower-cased which follows the style guide for import prefixes. +is operating system detection. You should then use your IDE to rename the import +prefix from `Platform` to something lower-cased which follows the style guide +for import prefixes. -Any new platform which supports neither `dart:io` nor `dart:html` -can make itself recognizable by configuring -the `dart.os.name` and `dart.os.version` environment settings, -so that `const String.fromEnvironment` can access them. +Any new platform which supports neither `dart:io` nor `dart:html` can make +itself recognizable by configuring the `dart.os.name` and `dart.os.version` +environment settings, so that `const String.fromEnvironment` can access them. ## Overriding the current OS string -It's possible to override the current operating system string, -as exposed by `operatingSystem` and `operatingSystemVersion` -in `package:os_detect/os_detect.dart`. -To do so, import the `package:os_detect/override.dart` library -and use the `overrideOperatingSystem` function to run code in a zone -where the operating system and version values are set -to whatever values are desired. - -The class `OperatingSystemID` can also be used directly to -abstract over the operating system name and version. -The `OperatingSystemID.current` defaults to the values provided by the platform -when not overridden using `overrideOperatingSystem`. +It's possible to override the current operating system string, as exposed by +`operatingSystem` and `operatingSystemVersion` in +`package:os_detect/os_detect.dart`. To do so, import the +`package:os_detect/override.dart` library and use the `overrideOperatingSystem` +function to run code in a zone where the operating system and version values are +set to whatever values are desired. + +The class `OperatingSystemID` can also be used directly to abstract over the +operating system name and version. The `OperatingSystemID.current` defaults to +the values provided by the platform when not overridden using +`overrideOperatingSystem`. diff --git a/pkgs/os_detect/analysis_options.yaml b/pkgs/os_detect/analysis_options.yaml index 5e042b85..d32a8aab 100644 --- a/pkgs/os_detect/analysis_options.yaml +++ b/pkgs/os_detect/analysis_options.yaml @@ -1,8 +1,55 @@ -# Copyright (c) 2020, 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. +# https://dart.dev/guides/language/analysis-options include: package:lints/recommended.yaml analyzer: language: strict-casts: true + strict-inference: true + strict-raw-types: true + +linter: + rules: + - always_declare_return_types + - avoid_bool_literals_in_conditional_expressions + - avoid_catching_errors + - avoid_classes_with_only_static_members + - avoid_dynamic_calls + - 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 + - directives_ordering + - join_return_with_assignment + - lines_longer_than_80_chars + - literal_only_boolean_expressions + - missing_whitespace_between_adjacent_strings + - no_adjacent_strings_in_list + - no_runtimeType_toString + - omit_local_variable_types + - only_throw_errors + - package_api_docs + - prefer_asserts_in_initializer_lists + - prefer_const_constructors + - prefer_const_declarations + - prefer_expression_function_bodies + - prefer_final_locals + - prefer_relative_imports + - prefer_single_quotes + - sort_pub_dependencies + - test_types_in_equals + - throw_in_finally + - type_annotate_public_apis + - unawaited_futures + - unnecessary_await_in_return + - unnecessary_lambdas + - unnecessary_parenthesis + - unnecessary_raw_strings + - unnecessary_statements + - use_if_null_to_convert_nulls_to_bools + - use_raw_strings + - use_string_buffers + - use_super_parameters diff --git a/pkgs/os_detect/example/example.dart b/pkgs/os_detect/example/example.dart new file mode 100644 index 00000000..331cf453 --- /dev/null +++ b/pkgs/os_detect/example/example.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2023, 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:os_detect/os_detect.dart' as os_detect; + +void main() { + print(''' + OS: ${os_detect.operatingSystem} +OS Version: ${os_detect.operatingSystemVersion} +'''); +} diff --git a/pkgs/os_detect/lib/override.dart b/pkgs/os_detect/lib/override.dart index 14042b10..a3e64f3b 100644 --- a/pkgs/os_detect/lib/override.dart +++ b/pkgs/os_detect/lib/override.dart @@ -5,11 +5,11 @@ /// Functionality to override information about the current platform. library pkg.os_detect.override; -import "dart:async" show Zone, runZoned; +import 'dart:async' show Zone, runZoned; import 'src/osid_unknown.dart' - if (dart.library.io) "src/osid_io.dart" - if (dart.library.html) "src/osid_html.dart"; + if (dart.library.io) 'src/osid_io.dart' + if (dart.library.html) 'src/osid_html.dart'; /// The name and version of an operating system. class OperatingSystem { @@ -47,37 +47,37 @@ extension OperatingSystemGetters on OperatingSystem { /// This value is `false` if the operating system is a specialized /// version of Linux that identifies itself by a different name, /// for example Android (see [isAndroid]). - bool get isLinux => ("linux" == id); + bool get isLinux => 'linux' == id; /// Whether the operating system is a version of /// [macOS](https://en.wikipedia.org/wiki/MacOS). /// /// Identified by [id] being the string `macos`. - bool get isMacOS => ("macos" == id); + bool get isMacOS => 'macos' == id; /// Whether the operating system is a version of /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). /// /// Identified by [id] being the string `windows`. - bool get isWindows => ("windows" == id); + bool get isWindows => 'windows' == id; /// Whether the operating system is a version of /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). /// /// Identified by [id] being the string `android`. - bool get isAndroid => ("android" == id); + bool get isAndroid => 'android' == id; /// Whether the operating system is a version of /// [iOS](https://en.wikipedia.org/wiki/IOS). /// /// Identified by [id] being the string `ios`. - bool get isIOS => ("ios" == id); + bool get isIOS => 'ios' == id; /// Whether the operating system is a version of /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). /// /// Identified by [id] being the string `fuchsia`. - bool get isFuchsia => ("fuchsia" == id); + bool get isFuchsia => 'fuchsia' == id; /// Whether running in a web browser. /// @@ -85,17 +85,16 @@ extension OperatingSystemGetters on OperatingSystem { /// /// If so, the [version] is the string made available /// through `window.navigator.appVersion`. - bool get isBrowser => ("browser" == id); + bool get isBrowser => 'browser' == id; } /// Run [body] in a zone with platform overrides. /// -/// Overrides [OperatingSystem.current] with the supplied [osId] +/// Overrides [OperatingSystem.current] with the supplied [operatingSystem] /// value while running in a new zone, and then runs [body] in that zone. /// /// This override affects the `operatingSystem` and `version` /// exported by `package:osid/osid.dart`. R overrideOperatingSystem( - OperatingSystem operatingSystem, R Function() body) { - return runZoned(body, zoneValues: {#_os: operatingSystem}); -} + OperatingSystem operatingSystem, R Function() body) => + runZoned(body, zoneValues: {#_os: operatingSystem}); diff --git a/pkgs/os_detect/lib/src/osid_html.dart b/pkgs/os_detect/lib/src/osid_html.dart index 0c13e679..2eead7c3 100644 --- a/pkgs/os_detect/lib/src/osid_html.dart +++ b/pkgs/os_detect/lib/src/osid_html.dart @@ -2,11 +2,11 @@ // 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:html"; +import 'dart:html'; import '../override.dart'; -const String _os = "browser"; +const String _os = 'browser'; String get _osVersion => window.navigator.appVersion; final OperatingSystem platformOS = OperatingSystem(_os, _osVersion); diff --git a/pkgs/os_detect/lib/src/osid_io.dart b/pkgs/os_detect/lib/src/osid_io.dart index 440280f9..e2771f2d 100644 --- a/pkgs/os_detect/lib/src/osid_io.dart +++ b/pkgs/os_detect/lib/src/osid_io.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. -import "dart:io"; +import 'dart:io'; import '../override.dart'; diff --git a/pkgs/os_detect/lib/src/osid_unknown.dart b/pkgs/os_detect/lib/src/osid_unknown.dart index 1339c2c5..fb33d52b 100644 --- a/pkgs/os_detect/lib/src/osid_unknown.dart +++ b/pkgs/os_detect/lib/src/osid_unknown.dart @@ -5,7 +5,7 @@ import '../override.dart'; const String _os = - String.fromEnvironment("dart.os.name", defaultValue: "unknown"); -const String _osVersion = String.fromEnvironment("dart.os.version"); + String.fromEnvironment('dart.os.name', defaultValue: 'unknown'); +const String _osVersion = String.fromEnvironment('dart.os.version'); const OperatingSystem platformOS = OperatingSystem(_os, _osVersion); diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index a749ef01..586e69e8 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,11 +1,11 @@ name: os_detect -version: 2.0.1 +version: 2.0.2-dev description: Platform independent OS detection. repository: https://github.com/dart-lang/os_detect environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.18.0 <3.0.0' dev_dependencies: - lints: ^1.0.0 + lints: ^2.0.0 test: ^1.16.8 diff --git a/pkgs/os_detect/test/osid_test.dart b/pkgs/os_detect/test/osid_test.dart index 4c2c8c5d..a8d56814 100644 --- a/pkgs/os_detect/test/osid_test.dart +++ b/pkgs/os_detect/test/osid_test.dart @@ -2,36 +2,36 @@ // 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:async'; -import "package:os_detect/os_detect.dart"; +import 'package:os_detect/os_detect.dart'; import 'package:os_detect/override.dart'; -import "package:test/test.dart"; +import 'package:test/test.dart'; void main() { - test("Exists and is consistent", () { + test('Exists and is consistent', () { expect(operatingSystem, isNotNull); expect(operatingSystemVersion, isNotNull); - expect(isLinux, operatingSystem == "linux"); - expect(isAndroid, operatingSystem == "android"); - expect(isMacOS, operatingSystem == "macos"); - expect(isWindows, operatingSystem == "windows"); - expect(isIOS, operatingSystem == "ios"); - expect(isFuchsia, operatingSystem == "fuchsia"); - expect(isBrowser, operatingSystem == "browser"); + expect(isLinux, operatingSystem == 'linux'); + expect(isAndroid, operatingSystem == 'android'); + expect(isMacOS, operatingSystem == 'macos'); + expect(isWindows, operatingSystem == 'windows'); + expect(isIOS, operatingSystem == 'ios'); + expect(isFuchsia, operatingSystem == 'fuchsia'); + expect(isBrowser, operatingSystem == 'browser'); }); - test("Override", () { - const overrideName = "argle-bargle"; - const overrideVersion = "glop-glyf"; + test('Override', () { + const overrideName = 'argle-bargle'; + const overrideVersion = 'glop-glyf'; const overrideOS = OperatingSystem(overrideName, overrideVersion); Zone? overrideZone; - var originalName = operatingSystem; - var originalVersion = operatingSystemVersion; - var originalID = OperatingSystem.current; - var originalZone = Zone.current; + final originalName = operatingSystem; + final originalVersion = operatingSystemVersion; + final originalID = OperatingSystem.current; + final originalZone = Zone.current; expect(originalName, isNot(overrideName)); expect(originalVersion, isNot(overrideVersion)); From d3fb8edfcb0962ce4613373b79e836a633366b12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Jan 2023 21:55:48 -0800 Subject: [PATCH 25/49] Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/os_detect#25) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index de7260b3..ea63a9c1 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [2.18.0, dev] steps: - - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d with: sdk: ${{ matrix.sdk }} From ac6d638072bc1954ddcaa363396e83ab7adc4471 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Jan 2023 23:29:02 -0800 Subject: [PATCH 26/49] Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/os_detect#24) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index ea63a9c1..38b5978e 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [2.18.0, dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d + - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ matrix.sdk }} - id: install From 216b05bee7806287efbd7ec22e8c9d9a81fa09b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Apr 2023 19:53:06 -0700 Subject: [PATCH 27/49] Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/os_detect#27) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 38b5978e..f03344d9 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [2.18.0, dev] steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} - id: install From 3e5a514972825b79fb4cbdcdde455eac08069c67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Apr 2023 21:50:48 -0700 Subject: [PATCH 28/49] Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/os_detect#26) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index f03344d9..29080fab 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [2.18.0, dev] steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From e81931d7a34d7fc943ab911dd71a73fedad74578 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 May 2023 16:58:50 -0700 Subject: [PATCH 29/49] Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/os_detect#28) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 29080fab..4532a0d3 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [2.18.0, dev] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 + - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From 8856488d6c627fdb1dd9cde8562e78d0631aac39 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Mon, 22 May 2023 09:22:48 -0700 Subject: [PATCH 30/49] blast_repo fixes (dart-lang/os_detect#29) dependabot --- pkgs/os_detect/.github/dependabot.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/os_detect/.github/dependabot.yml b/pkgs/os_detect/.github/dependabot.yml index 40cab315..b66b0402 100644 --- a/pkgs/os_detect/.github/dependabot.yml +++ b/pkgs/os_detect/.github/dependabot.yml @@ -4,8 +4,9 @@ version: 2 updates: -- package-ecosystem: "github-actions" - directory: "/" +- package-ecosystem: github-actions + directory: / schedule: - # Check for updates to GitHub Actions every weekday - interval: "monthly" + interval: monthly + labels: + - autosubmit From d6478837387fc4a42b4785bf45e04c181e51ddff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 02:31:21 +0000 Subject: [PATCH 31/49] Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/os_detect#30) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 4532a0d3..f441093b 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [2.18.0, dev] steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From b4f1d5086bac3177b3dafc5ac6b198728d3576c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Sep 2023 02:51:03 +0000 Subject: [PATCH 32/49] Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/os_detect#32) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index f441093b..a010de99 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [2.18.0, dev] steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f with: sdk: ${{ matrix.sdk }} From 754f048855ff214bf152c9f93257fec51c6aa28c Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Thu, 28 Sep 2023 08:28:26 +0200 Subject: [PATCH 33/49] Use the VM's "platform-const" feature to achieve tree-shaking. (dart-lang/os_detect#31) * Use the VM's "platform-const" feature to achieve tree-shaking. By using the VM's `@pragma("vm:platform-const")` annotation, and `Platform` members annotated with it, ensure that the `isLinux` and `operatingSystem` values are also known at compile-time, even if they cannot be annotated as platform-constants. This is done by having a class per known operating system, and making sure to only create instances of those classes guarded by platform-constants (or real constants), so that if nobody goes out of their way to create a custom instance, which they should only do for testing, all but one of those platform-specific classes can be tree-shaken. At that point, checks like `is MacOS` (one of the types) can be statically determined to be false if `MacOS` was tree-shaken, and `.id` can be statically resolved to a single final variable with a known value. * Update test matrix to start at 3.0.0 * Add example discussing tree-shaking. * Format * Address comments. * Don't refer to unimported name in docs. --- .../.github/workflows/test-package.yml | 2 +- pkgs/os_detect/CHANGELOG.md | 3 +- pkgs/os_detect/analysis_options.yaml | 35 ++-- pkgs/os_detect/bin/os_detect.dart | 40 ++++ pkgs/os_detect/example/example.dart | 20 +- pkgs/os_detect/example/tree_shaking.dart | 29 +++ pkgs/os_detect/lib/os_detect.dart | 44 ++++- pkgs/os_detect/lib/override.dart | 98 +--------- pkgs/os_detect/lib/src/os_kind.dart | 101 ++++++++++ pkgs/os_detect/lib/src/os_override.dart | 180 ++++++++++++++++++ pkgs/os_detect/lib/src/osid_html.dart | 7 +- pkgs/os_detect/lib/src/osid_io.dart | 29 ++- pkgs/os_detect/lib/src/osid_unknown.dart | 22 ++- pkgs/os_detect/pubspec.yaml | 7 +- pkgs/os_detect/test/osid_test.dart | 16 +- 15 files changed, 500 insertions(+), 133 deletions(-) create mode 100644 pkgs/os_detect/bin/os_detect.dart create mode 100644 pkgs/os_detect/example/tree_shaking.dart create mode 100644 pkgs/os_detect/lib/src/os_kind.dart create mode 100644 pkgs/os_detect/lib/src/os_override.dart diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index a010de99..fed0bdcd 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest, windows-latest, macos-latest] - sdk: [2.18.0, dev] + sdk: [3.0.0, dev] steps: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index 0328fbb9..47355ebe 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,6 +1,7 @@ ## 2.0.2-dev -- Require Dart 2.18 +- Require Dart 3.0 +- Make work with VM's platform-constants. ## 2.0.1 diff --git a/pkgs/os_detect/analysis_options.yaml b/pkgs/os_detect/analysis_options.yaml index d32a8aab..9d91fd3f 100644 --- a/pkgs/os_detect/analysis_options.yaml +++ b/pkgs/os_detect/analysis_options.yaml @@ -14,42 +14,55 @@ linter: - avoid_catching_errors - avoid_classes_with_only_static_members - avoid_dynamic_calls + - avoid_empty_else - avoid_private_typedef_functions - avoid_redundant_argument_values - - avoid_returning_null_for_future + - avoid_relative_lib_imports - avoid_returning_this + - avoid_shadowing_type_parameters + - avoid_types_as_parameter_names - avoid_unused_constructor_parameters - avoid_void_async - - cancel_subscriptions + - await_only_futures + - camel_case_extensions + - collection_methods_unrelated_type - comment_references + - curly_braces_in_flow_control_structures - directives_ordering - - join_return_with_assignment + - empty_catches + - file_names + - hash_and_equals - lines_longer_than_80_chars - literal_only_boolean_expressions - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list + - no_duplicate_case_values - no_runtimeType_toString - omit_local_variable_types - only_throw_errors - package_api_docs - prefer_asserts_in_initializer_lists - - prefer_const_constructors - prefer_const_declarations - - prefer_expression_function_bodies - - prefer_final_locals + - prefer_generic_function_type_aliases + - prefer_is_empty + - prefer_is_not_empty + - prefer_iterable_whereType - prefer_relative_imports - prefer_single_quotes + - prefer_typing_uninitialized_variables + - provide_deprecation_message - sort_pub_dependencies - test_types_in_equals - throw_in_finally - type_annotate_public_apis - unawaited_futures - - unnecessary_await_in_return - unnecessary_lambdas + - unnecessary_overrides - unnecessary_parenthesis - - unnecessary_raw_strings - unnecessary_statements - - use_if_null_to_convert_nulls_to_bools + - unrelated_type_equality_checks + - use_is_even_rather_than_modulo + - void_checks - use_raw_strings - - use_string_buffers - - use_super_parameters + + diff --git a/pkgs/os_detect/bin/os_detect.dart b/pkgs/os_detect/bin/os_detect.dart new file mode 100644 index 00000000..e9e6fc15 --- /dev/null +++ b/pkgs/os_detect/bin/os_detect.dart @@ -0,0 +1,40 @@ +// Copyright (c) 2023, 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. + +/// Prints the operating system detected by the current compilation environment. +library pkg.os_detect.run; + +import 'package:os_detect/os_detect.dart' as os_detect; + +void main() { + final knownName = knownOSName(); + print('OS name : ${os_detect.operatingSystem} ' + '${knownName != null ? '($knownName)' : ''}'); + print('OS version : ${os_detect.operatingSystemVersion}'); +} + +String? knownOSName() { + if (os_detect.isAndroid) { + return 'Android'; + } + if (os_detect.isBrowser) { + return 'Browser'; + } + if (os_detect.isFuchsia) { + return 'Fuchsia'; + } + if (os_detect.isIOS) { + return 'iOS'; + } + if (os_detect.isLinux) { + return 'Linux'; + } + if (os_detect.isMacOS) { + return 'MacOS'; + } + if (os_detect.isWindows) { + return 'Windows'; + } + return null; +} diff --git a/pkgs/os_detect/example/example.dart b/pkgs/os_detect/example/example.dart index 331cf453..4a159d86 100644 --- a/pkgs/os_detect/example/example.dart +++ b/pkgs/os_detect/example/example.dart @@ -6,7 +6,21 @@ import 'package:os_detect/os_detect.dart' as os_detect; void main() { print(''' - OS: ${os_detect.operatingSystem} -OS Version: ${os_detect.operatingSystemVersion} -'''); + OS ID: ${os_detect.operatingSystem} +OS Version: ${os_detect.operatingSystemVersion}'''); + if (os_detect.isAndroid) { + print(' OS Type: Android'); + } else if (os_detect.isBrowser) { + print(' OS Type: Browser'); + } else if (os_detect.isFuchsia) { + print(' OS Type: Fuchsia'); + } else if (os_detect.isIOS) { + print(' OS Type: iOS'); + } else if (os_detect.isLinux) { + print(' OS Type: Linux'); + } else if (os_detect.isMacOS) { + print(' OS Type: MacOS'); + } else if (os_detect.isWindows) { + print(' OS Type: Windows'); + } } diff --git a/pkgs/os_detect/example/tree_shaking.dart b/pkgs/os_detect/example/tree_shaking.dart new file mode 100644 index 00000000..987f3ddb --- /dev/null +++ b/pkgs/os_detect/example/tree_shaking.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2023, 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. + +// Try compiling this example with (if on Linux): +// +// dart compile exe --target-os=linux tree_shaking.dart +// +// then check that "SOMETHING ELSE" does not occur in the +// output `tree_shaking.exe` program, e.g.: +// +// strings tree_shaking.exe | grep SOMETHING +// +// which shows no matches. + +import 'package:os_detect/os_detect.dart' as platform; + +void main() { + if (platform.isLinux) { + print('Is Linux'); + } else { + print('SOMETHING ELSE'); + } + if (platform.operatingSystem == 'linux') { + print('Is Linux'); + } else { + print('SOMETHING ELSE'); + } +} diff --git a/pkgs/os_detect/lib/os_detect.dart b/pkgs/os_detect/lib/os_detect.dart index 2e252eb6..d323f63a 100644 --- a/pkgs/os_detect/lib/os_detect.dart +++ b/pkgs/os_detect/lib/os_detect.dart @@ -5,11 +5,19 @@ /// Information about the current operating system. library pkg.os_detect; -import 'override.dart'; +import 'src/os_override.dart'; /// Identification of the current operating system or platform. /// -/// Specific known operating systems are reported by a unique string. +/// Specific known operating systems are reported by a unique known string, +/// and all the `is` values are computed by comparing the +/// [operatingSystem] string against those known strings. +/// That means that *at most* one of those value can be `true`, +/// and usually precisely one will be `true`. +/// +/// **Notice:** Programs running in a browser will report their +/// operating system as `"browser"`, not the operating system +/// that browser is running on. See [isBrowser]. String get operatingSystem => OperatingSystem.current.id; /// Representation of the version of the current operating system or platform. @@ -24,37 +32,59 @@ String get operatingSystemVersion => OperatingSystem.current.version; /// /// This value is `false` if the operating system is a specialized /// version of Linux that identifies itself by a different name, -/// for example Android (see [isAndroid]). +/// for example Android (see [isAndroid]), +/// or if the code is running inside a browser (see [isBrowser]). +@pragma('vm:prefer-inline') bool get isLinux => OperatingSystem.current.isLinux; /// Whether the current operating system is a version of /// [macOS](https://en.wikipedia.org/wiki/MacOS). /// /// Identified by [operatingSystem] being the string `macos`. +/// +/// The value is `false` if the code is running inside a browser, +/// even if that browser is running on MacOS (see [isBrowser]). +@pragma('vm:prefer-inline') bool get isMacOS => OperatingSystem.current.isMacOS; /// Whether the current operating system is a version of /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). /// /// Identified by [operatingSystem] being the string `windows`. +/// +/// The value is `false` if the code is running inside a browser, +/// even if that browser is running on Windows (see [isBrowser]). +@pragma('vm:prefer-inline') bool get isWindows => OperatingSystem.current.isWindows; /// Whether the current operating system is a version of /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). /// /// Identified by [operatingSystem] being the string `android`. +/// +/// The value is `false` if the code is running inside a browser, +/// even if that browser is running on Android (see [isBrowser]). +@pragma('vm:prefer-inline') bool get isAndroid => OperatingSystem.current.isAndroid; /// Whether the current operating system is a version of /// [iOS](https://en.wikipedia.org/wiki/IOS). /// /// Identified by [operatingSystem] being the string `ios`. +/// +/// The value is `false` if the code is running inside a browser, +/// even if that browser is running on iOS (see [isBrowser]). +@pragma('vm:prefer-inline') bool get isIOS => OperatingSystem.current.isIOS; /// Whether the current operating system is a version of /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). /// /// Identified by [operatingSystem] being the string `fuchsia`. +/// +/// The value is `false` if the code is running inside a browser, +/// even if that browser is running on Fuchsia (see [isBrowser]). +@pragma('vm:prefer-inline') bool get isFuchsia => OperatingSystem.current.isFuchsia; /// Whether running in a web browser. @@ -63,4 +93,12 @@ bool get isFuchsia => OperatingSystem.current.isFuchsia; /// /// If so, the [operatingSystemVersion] is the string made available /// through `window.navigator.appVersion`. +/// +/// The value is `true` when the code is running inside a browser, +/// no matter which operating system the browser is itself running on. +/// No attempt is made to detect the underlying operating system. +/// That information *may* be derived from [operatingSystemVersion], +/// but browsers are able to lie in the app-version/user-agent +/// string. +@pragma('vm:prefer-inline') bool get isBrowser => OperatingSystem.current.isBrowser; diff --git a/pkgs/os_detect/lib/override.dart b/pkgs/os_detect/lib/override.dart index a3e64f3b..cc3e9188 100644 --- a/pkgs/os_detect/lib/override.dart +++ b/pkgs/os_detect/lib/override.dart @@ -1,100 +1,8 @@ -// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file +// Copyright (c) 2023, 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. /// Functionality to override information about the current platform. -library pkg.os_detect.override; +library; -import 'dart:async' show Zone, runZoned; - -import 'src/osid_unknown.dart' - if (dart.library.io) 'src/osid_io.dart' - if (dart.library.html) 'src/osid_html.dart'; - -/// The name and version of an operating system. -class OperatingSystem { - /// The current operating system ID. - /// - /// Defaults to what information is available - /// from known platform specific libraries, - /// but can be overridden using functionality from the - /// `osid_override.dart` library. - static OperatingSystem get current => - Zone.current[#_os] as OperatingSystem? ?? platformOS; - - /// A string representing the operating system or platform. - final String id; - - /// A string representing the version of the operating system or platform. - /// - /// May be empty if no version is known or available. - final String version; - - /// Creates an operating system ID with the provided values. - const OperatingSystem(this.id, this.version); -} - -/// Convenience operations on [OperatingSystem]. -/// -/// Implemented as extensions to allow users to *implement* [OperatingSystem] -/// without having to implement all of these getters. -extension OperatingSystemGetters on OperatingSystem { - /// Whether the operating system is a version of - /// [Linux](https://en.wikipedia.org/wiki/Linux). - /// - /// Identified by [id] being the string `linux`. - /// - /// This value is `false` if the operating system is a specialized - /// version of Linux that identifies itself by a different name, - /// for example Android (see [isAndroid]). - bool get isLinux => 'linux' == id; - - /// Whether the operating system is a version of - /// [macOS](https://en.wikipedia.org/wiki/MacOS). - /// - /// Identified by [id] being the string `macos`. - bool get isMacOS => 'macos' == id; - - /// Whether the operating system is a version of - /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). - /// - /// Identified by [id] being the string `windows`. - bool get isWindows => 'windows' == id; - - /// Whether the operating system is a version of - /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). - /// - /// Identified by [id] being the string `android`. - bool get isAndroid => 'android' == id; - - /// Whether the operating system is a version of - /// [iOS](https://en.wikipedia.org/wiki/IOS). - /// - /// Identified by [id] being the string `ios`. - bool get isIOS => 'ios' == id; - - /// Whether the operating system is a version of - /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). - /// - /// Identified by [id] being the string `fuchsia`. - bool get isFuchsia => 'fuchsia' == id; - - /// Whether running in a web browser. - /// - /// Identified by [id] being the string `browser`. - /// - /// If so, the [version] is the string made available - /// through `window.navigator.appVersion`. - bool get isBrowser => 'browser' == id; -} - -/// Run [body] in a zone with platform overrides. -/// -/// Overrides [OperatingSystem.current] with the supplied [operatingSystem] -/// value while running in a new zone, and then runs [body] in that zone. -/// -/// This override affects the `operatingSystem` and `version` -/// exported by `package:osid/osid.dart`. -R overrideOperatingSystem( - OperatingSystem operatingSystem, R Function() body) => - runZoned(body, zoneValues: {#_os: operatingSystem}); +export 'src/os_override.dart' show OperatingSystem, overrideOperatingSystem; diff --git a/pkgs/os_detect/lib/src/os_kind.dart b/pkgs/os_detect/lib/src/os_kind.dart new file mode 100644 index 00000000..7f4ee852 --- /dev/null +++ b/pkgs/os_detect/lib/src/os_kind.dart @@ -0,0 +1,101 @@ +// Copyright (c) 2023, 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. + +/// Shared constants and classes used to represent a recongized OS type +/// +/// Not exported in the public API, but used to communicate between +/// `override.dart` and the conditionally imported `osid_X.dart` files. +/// +/// When the platform is statically known, all but one of the subclasses +/// should be tree-shaken, so an `os is AndroidOS` can be resolved to +/// a constant true/false depending on whether the class is the retained one +/// or not. +library; + +/// Operating identity object. +/// +/// By only instantiating these subtypes guarded by target-OS guarded +/// checks, unless using the "for testing" `OperatingSystem` constructor, +/// all but one of the subclasses should be tree-shaken, +/// and, e.g., the `_isId is IOS` test above should become tree-shakable +/// on all other platforms. +sealed class RecognizedOS { + // The recognized OS identifier strings recognized. + static const androidId = 'android'; + static const browserId = 'browser'; + static const fuchsiaId = 'fuchsia'; + static const iOSId = 'ios'; + static const linuxId = 'linux'; + static const macOSId = 'macos'; + static const windowsId = 'windows'; + + abstract final String id; + const RecognizedOS(); +} + +/// Operations system object for Android. +class AndroidOS extends RecognizedOS { + @override + final String id = RecognizedOS.androidId; + const AndroidOS(); +} + +/// Operations system object for browsers. +class BrowserOS extends RecognizedOS { + @override + final String id = RecognizedOS.browserId; + const BrowserOS(); +} + +/// Operations system object for Fuchsia. +class FuchsiaOS extends RecognizedOS { + @override + final String id = RecognizedOS.fuchsiaId; + const FuchsiaOS(); +} + +/// Operations system object for iOS. +class IOS extends RecognizedOS { + @override + final String id = RecognizedOS.iOSId; + const IOS(); +} + +/// Operations system object for Linux. +class LinuxOS extends RecognizedOS { + @override + final String id = RecognizedOS.linuxId; + const LinuxOS(); +} + +/// Operations system object for MacOS. +class MacOS extends RecognizedOS { + @override + final String id = RecognizedOS.macOSId; + const MacOS(); +} + +/// Operations system object for Windows. +class WindowsOS extends RecognizedOS { + @override + final String id = RecognizedOS.windowsId; + const WindowsOS(); +} + +/// Fallback to represent unknown operating system. +/// +/// Do not use for one of the recognized operating +/// systems +class UnknownOS extends RecognizedOS { + @override + final String id; + const UnknownOS(this.id) + : assert(id != RecognizedOS.linuxId), + assert(id != RecognizedOS.macOSId), + assert(id != RecognizedOS.windowsId), + assert(id != RecognizedOS.androidId), + assert(id != RecognizedOS.iOSId), + assert(id != RecognizedOS.fuchsiaId), + assert(id != RecognizedOS.browserId); +} diff --git a/pkgs/os_detect/lib/src/os_override.dart b/pkgs/os_detect/lib/src/os_override.dart new file mode 100644 index 00000000..6f31bfd4 --- /dev/null +++ b/pkgs/os_detect/lib/src/os_override.dart @@ -0,0 +1,180 @@ +// Copyright (c) 2020, 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' show Zone, runZoned; + +import 'package:meta/meta.dart'; + +import 'os_kind.dart'; +import 'osid_unknown.dart' + if (dart.library.io) 'osid_io.dart' + if (dart.library.html) 'osid_html.dart'; + +/// The name and version of an operating system. +final class OperatingSystem { + // The recognized OS identifier strings. + + /// The operating system ID string for Linux. + /// + /// Compare against [id] or the `operatingSystem` of `os_detect.dart`, + /// or use as argument to [OperatingSystem.new]. + static const androidId = RecognizedOS.androidId; + + /// The operating system ID string for browsers. + /// + /// Compare against [id] or the `operatingSystem` of `os_detect.dart`, + /// or use as argument to [OperatingSystem.new]. + static const browserId = RecognizedOS.browserId; + + /// The operating system ID string for Fuchsia. + /// + /// Compare against [id] or the `operatingSystem` of `os_detect.dart`, + /// or use as argument to [OperatingSystem.new]. + static const fuchsiaId = RecognizedOS.fuchsiaId; + + /// The operating system ID string for iOS. + /// + /// Compare against [id] or the `operatingSystem` of `os_detect.dart`, + /// or use as argument to [OperatingSystem.new]. + static const iOSId = RecognizedOS.iOSId; + + /// The operating system ID string for Linux. + /// + /// Compare against [id] or the `operatingSystem` of `os_detect.dart`, + /// or use as argument to [OperatingSystem.new]. + static const linuxId = RecognizedOS.linuxId; + + /// The operating system ID string for macOS. + /// + /// Compare against [id] or the `operatingSystem` of `os_detect.dart`, + /// or use as argument to [OperatingSystem.new]. + static const macOSId = RecognizedOS.macOSId; + + /// The operating system ID string for Windows. + /// + /// Compare against [id] or the `operatingSystem` of `os_detect.dart`, + /// or use as argument to [OperatingSystem.new]. + static const windowsId = RecognizedOS.windowsId; + + /// The current operating system ID. + /// + /// Defaults to what information is available + /// from known platform specific libraries, + /// but can be overridden using functionality from the + /// `osid_override.dart` library. + @pragma('vm:try-inline') + static OperatingSystem get current => + Zone.current[#_os] as OperatingSystem? ?? platformOS; + + /// A string representing the operating system or platform. + String get id => _osId.id; + + // Operating system ID object. + final RecognizedOS _osId; + + /// A string representing the version of the operating system or platform. + /// + /// May be empty if no version is known or available. + final String version; + + /// Creates a new operating system object for testing. + /// + /// Can be used with [overrideOperatingSystem] to selectively + /// change the value returned by [current]. + /// + /// **Notice:** Using this constructor may reduce the efficiency + /// of compilers recognizing code that isn't needed when compiling + /// for a particular platform (aka. "tree-shaking" of unreachable code). + // Uses chained conditionals to allow back-ends to constant fold when they + // know what `id` is, which they'd usually know for a specific operation. + // That can avoid retaining *all* the subclasses of `OS`. + @visibleForTesting + @pragma('vm:prefer-inline') + OperatingSystem(String id, String version) + : this._( + id == linuxId + ? const LinuxOS() + : id == macOSId + ? const MacOS() + : id == windowsId + ? const WindowsOS() + : id == androidId + ? const AndroidOS() + : id == iOSId + ? const IOS() + : id == fuchsiaId + ? const FuchsiaOS() + : id == browserId + ? const BrowserOS() + : UnknownOS(id), + version); + + /// Used by platforms which know the ID object. + const OperatingSystem._(this._osId, this.version); + + /// Whether the operating system is a version of + /// [Linux](https://en.wikipedia.org/wiki/Linux). + /// + /// Identified by [id] being the string `linux`. + /// + /// This value is `false` if the operating system is a specialized + /// version of Linux that identifies itself by a different name, + /// for example Android (see [isAndroid]). + bool get isLinux => _osId is LinuxOS; + + /// Whether the operating system is a version of + /// [macOS](https://en.wikipedia.org/wiki/MacOS). + /// + /// Identified by [id] being the string `macos`. + bool get isMacOS => _osId is MacOS; + + /// Whether the operating system is a version of + /// [Microsoft Windows](https://en.wikipedia.org/wiki/Microsoft_Windows). + /// + /// Identified by [id] being the string `windows`. + bool get isWindows => _osId is WindowsOS; + + /// Whether the operating system is a version of + /// [Android](https://en.wikipedia.org/wiki/Android_%28operating_system%29). + /// + /// Identified by [id] being the string `android`. + bool get isAndroid => _osId is AndroidOS; + + /// Whether the operating system is a version of + /// [iOS](https://en.wikipedia.org/wiki/IOS). + /// + /// Identified by [id] being the string `ios`. + bool get isIOS => _osId is IOS; + + /// Whether the operating system is a version of + /// [Fuchsia](https://en.wikipedia.org/wiki/Google_Fuchsia). + /// + /// Identified by [id] being the string `fuchsia`. + bool get isFuchsia => _osId is FuchsiaOS; + + /// Whether running in a web browser. + /// + /// Identified by [id] being the string `browser`. + /// + /// If so, the [version] is the string made available + /// through `window.navigator.appVersion`. + bool get isBrowser => _osId is BrowserOS; +} + +/// Run [body] in a zone with platform overrides. +/// +/// Overrides [OperatingSystem.current] with the supplied [operatingSystem] +/// value while running in a new zone, and then runs [body] in that zone. +/// +/// This override affects the `operatingSystem` and `version` +/// exported by `package:osid/osid.dart`. +R overrideOperatingSystem( + OperatingSystem operatingSystem, R Function() body) => + runZoned(body, zoneValues: {#_os: operatingSystem}); + +// Exposes the `OperatingSystem._` constructor to the conditionally imported +// libraries. Not exported by `../override.dart'. +final class OperatingSystemInternal extends OperatingSystem { + const OperatingSystemInternal(super.id, super.version) : super._(); +} diff --git a/pkgs/os_detect/lib/src/osid_html.dart b/pkgs/os_detect/lib/src/osid_html.dart index 2eead7c3..a5d896fb 100644 --- a/pkgs/os_detect/lib/src/osid_html.dart +++ b/pkgs/os_detect/lib/src/osid_html.dart @@ -4,9 +4,10 @@ import 'dart:html'; -import '../override.dart'; +import 'os_kind.dart' show BrowserOS; +import 'os_override.dart'; -const String _os = 'browser'; String get _osVersion => window.navigator.appVersion; -final OperatingSystem platformOS = OperatingSystem(_os, _osVersion); +final OperatingSystem platformOS = + OperatingSystemInternal(const BrowserOS(), _osVersion); diff --git a/pkgs/os_detect/lib/src/osid_io.dart b/pkgs/os_detect/lib/src/osid_io.dart index e2771f2d..56b45eb9 100644 --- a/pkgs/os_detect/lib/src/osid_io.dart +++ b/pkgs/os_detect/lib/src/osid_io.dart @@ -4,9 +4,30 @@ import 'dart:io'; -import '../override.dart'; +import 'os_kind.dart'; +import 'os_override.dart'; -String get _os => Platform.operatingSystem; -String get _osVersion => Platform.operatingSystemVersion; +// Uses VM platform-constant functionality to constant fold this expression +// when `Platform.operatingSystem` is known at compile-time. +// Uses a valid "potentially constant" expression for this, instead of, e.g., +// a `switch` expression. +@pragma('vm:platform-const') +final RecognizedOS? _osType = Platform.operatingSystem == RecognizedOS.linuxId + ? const LinuxOS() + : Platform.operatingSystem == RecognizedOS.macOSId + ? const MacOS() + : Platform.operatingSystem == RecognizedOS.windowsId + ? const WindowsOS() + : Platform.operatingSystem == RecognizedOS.androidId + ? const AndroidOS() + : Platform.operatingSystem == RecognizedOS.iOSId + ? const IOS() + : Platform.operatingSystem == RecognizedOS.fuchsiaId + ? const FuchsiaOS() + : Platform.operatingSystem == RecognizedOS.browserId + ? const BrowserOS() + : null; -final OperatingSystem platformOS = OperatingSystem(_os, _osVersion); +final OperatingSystem platformOS = OperatingSystemInternal( + _osType ?? UnknownOS(Platform.operatingSystem), + Platform.operatingSystemVersion); diff --git a/pkgs/os_detect/lib/src/osid_unknown.dart b/pkgs/os_detect/lib/src/osid_unknown.dart index fb33d52b..2e6798ef 100644 --- a/pkgs/os_detect/lib/src/osid_unknown.dart +++ b/pkgs/os_detect/lib/src/osid_unknown.dart @@ -2,10 +2,28 @@ // 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 '../override.dart'; +import 'os_kind.dart'; +import 'os_override.dart'; +@pragma('vm:platform-const') const String _os = String.fromEnvironment('dart.os.name', defaultValue: 'unknown'); const String _osVersion = String.fromEnvironment('dart.os.version'); -const OperatingSystem platformOS = OperatingSystem(_os, _osVersion); +const OperatingSystem platformOS = OperatingSystemInternal( + _os == RecognizedOS.linuxId + ? LinuxOS() + : _os == RecognizedOS.macOSId + ? MacOS() + : _os == RecognizedOS.windowsId + ? WindowsOS() + : _os == RecognizedOS.androidId + ? AndroidOS() + : _os == RecognizedOS.iOSId + ? IOS() + : _os == RecognizedOS.fuchsiaId + ? FuchsiaOS() + : _os == RecognizedOS.browserId + ? BrowserOS() + : UnknownOS(_os), + _osVersion); diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index 586e69e8..d6435f9f 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -4,8 +4,11 @@ description: Platform independent OS detection. repository: https://github.com/dart-lang/os_detect environment: - sdk: '>=2.18.0 <3.0.0' + sdk: ^3.0.0 + +dependencies: + meta: ^1.9.0 dev_dependencies: lints: ^2.0.0 - test: ^1.16.8 + test: ^1.24.0 diff --git a/pkgs/os_detect/test/osid_test.dart b/pkgs/os_detect/test/osid_test.dart index a8d56814..862d9377 100644 --- a/pkgs/os_detect/test/osid_test.dart +++ b/pkgs/os_detect/test/osid_test.dart @@ -13,19 +13,19 @@ void main() { expect(operatingSystem, isNotNull); expect(operatingSystemVersion, isNotNull); - expect(isLinux, operatingSystem == 'linux'); - expect(isAndroid, operatingSystem == 'android'); - expect(isMacOS, operatingSystem == 'macos'); - expect(isWindows, operatingSystem == 'windows'); - expect(isIOS, operatingSystem == 'ios'); - expect(isFuchsia, operatingSystem == 'fuchsia'); - expect(isBrowser, operatingSystem == 'browser'); + expect(isLinux, operatingSystem == OperatingSystem.linuxId); + expect(isAndroid, operatingSystem == OperatingSystem.androidId); + expect(isMacOS, operatingSystem == OperatingSystem.macOSId); + expect(isWindows, operatingSystem == OperatingSystem.windowsId); + expect(isIOS, operatingSystem == OperatingSystem.iOSId); + expect(isFuchsia, operatingSystem == OperatingSystem.fuchsiaId); + expect(isBrowser, operatingSystem == OperatingSystem.browserId); }); test('Override', () { const overrideName = 'argle-bargle'; const overrideVersion = 'glop-glyf'; - const overrideOS = OperatingSystem(overrideName, overrideVersion); + final overrideOS = OperatingSystem(overrideName, overrideVersion); Zone? overrideZone; final originalName = operatingSystem; From 0ce935ad32251e190caa8dd5ec9e2b5171090ff4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 02:43:04 +0000 Subject: [PATCH 34/49] Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/os_detect#34) 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/os_detect#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/os_detect#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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index fed0bdcd..eec65017 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -23,7 +23,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 @@ -50,7 +50,7 @@ jobs: sdk: [3.0.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 3f2fa608b9e5f158a3e13e2d0da55df8aeb14ea7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Oct 2023 02:47:30 +0000 Subject: [PATCH 35/49] Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/os_detect#33) 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.6.0 to 4.1.0.
Release notes

Sourced from actions/checkout's releases.

v4.1.0

What's Changed

New Contributors

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

v4.0.0

What's Changed

New Contributors

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

Changelog

Sourced from actions/checkout's changelog.

Changelog

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

v3.1.0

v3.0.2

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=3.6.0&new-version=4.1.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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index eec65017..0b9d37d8 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.0, dev] steps: - - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} From 74daff485e82148c9599a7617c47c5b1fcd77d79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 02:55:04 +0000 Subject: [PATCH 36/49] Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/os_detect#36) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 0b9d37d8..2dab3817 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.0, dev] steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 with: sdk: ${{ matrix.sdk }} From 6913069ca104a0e83ae8d9866011abc1e686e720 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 02:59:17 +0000 Subject: [PATCH 37/49] Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/os_detect#35) 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/os_detect#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/os_detect#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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 2dab3817..5146e0e7 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [3.0.0, dev] steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: dart-lang/setup-dart@8a4b97ea2017cc079571daec46542f76189836b1 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: ${{ matrix.sdk }} - id: install From 82f95414170d21bad216453e39249b603280a4e3 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 29 Nov 2023 10:21:19 -0800 Subject: [PATCH 38/49] Enable latest lints (dart-lang/os_detect#37) --- pkgs/os_detect/CHANGELOG.md | 2 +- pkgs/os_detect/analysis_options.yaml | 45 ++-------------------------- pkgs/os_detect/pubspec.yaml | 4 +-- 3 files changed, 5 insertions(+), 46 deletions(-) diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index 47355ebe..edb44d8a 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.2-dev +## 2.0.2-wip - Require Dart 3.0 - Make work with VM's platform-constants. diff --git a/pkgs/os_detect/analysis_options.yaml b/pkgs/os_detect/analysis_options.yaml index 9d91fd3f..f29baf1b 100644 --- a/pkgs/os_detect/analysis_options.yaml +++ b/pkgs/os_detect/analysis_options.yaml @@ -1,5 +1,5 @@ -# https://dart.dev/guides/language/analysis-options -include: package:lints/recommended.yaml +# https://dart.dev/tools/analysis#the-analysis-options-file +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: @@ -9,60 +9,19 @@ analyzer: linter: rules: - - always_declare_return_types - avoid_bool_literals_in_conditional_expressions - - avoid_catching_errors - avoid_classes_with_only_static_members - - avoid_dynamic_calls - - avoid_empty_else - avoid_private_typedef_functions - avoid_redundant_argument_values - - avoid_relative_lib_imports - avoid_returning_this - - avoid_shadowing_type_parameters - - avoid_types_as_parameter_names - avoid_unused_constructor_parameters - avoid_void_async - - await_only_futures - - camel_case_extensions - - collection_methods_unrelated_type - - comment_references - - curly_braces_in_flow_control_structures - - directives_ordering - - empty_catches - - file_names - - hash_and_equals - - lines_longer_than_80_chars - literal_only_boolean_expressions - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - - no_duplicate_case_values - no_runtimeType_toString - - omit_local_variable_types - - only_throw_errors - package_api_docs - - prefer_asserts_in_initializer_lists - prefer_const_declarations - - prefer_generic_function_type_aliases - - prefer_is_empty - - prefer_is_not_empty - - prefer_iterable_whereType - - prefer_relative_imports - - prefer_single_quotes - - prefer_typing_uninitialized_variables - - provide_deprecation_message - - sort_pub_dependencies - - test_types_in_equals - - throw_in_finally - - type_annotate_public_apis - - unawaited_futures - - unnecessary_lambdas - - unnecessary_overrides - - unnecessary_parenthesis - - unnecessary_statements - - unrelated_type_equality_checks - - use_is_even_rather_than_modulo - - void_checks - use_raw_strings diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index d6435f9f..3418d326 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,5 +1,5 @@ name: os_detect -version: 2.0.2-dev +version: 2.0.2-wip description: Platform independent OS detection. repository: https://github.com/dart-lang/os_detect @@ -10,5 +10,5 @@ dependencies: meta: ^1.9.0 dev_dependencies: - lints: ^2.0.0 + dart_flutter_team_lints: ^2.0.0 test: ^1.24.0 From 30564a9ae861fde46ce84e5b486c45d976177f28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 02:52:14 +0000 Subject: [PATCH 39/49] Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/os_detect#38) 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/os_detect#43).
  • Fixed an issue where cached downloads could lead to unzip issues on self-hosted runners (dart-lang/os_detect#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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 5146e0e7..41cabef7 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -23,7 +23,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 @@ -50,7 +50,7 @@ jobs: sdk: [3.0.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 03ae80d3b9b9b1c7827bc5671431777e5c249444 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 02:10:10 +0000 Subject: [PATCH 40/49] Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/os_detect#39) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 41cabef7..370d9316 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.0, dev] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} From 3c921b050770944846a4aa037c0fb69b801b42b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 02:40:23 +0000 Subject: [PATCH 41/49] Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/os_detect#41) 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.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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 370d9316..e03bf453 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.0, dev] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: sdk: ${{ matrix.sdk }} From f7b1fb831d323573ce72031d48a3605de7486f4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 15:26:06 +0000 Subject: [PATCH 42/49] Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/os_detect#40) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index e03bf453..01b496f9 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -23,7 +23,7 @@ jobs: sdk: [dev] steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} - id: install @@ -50,7 +50,7 @@ jobs: sdk: [3.0.0, dev] steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b - - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} - id: install From 79cd6550915a032731cd3afb872043f873f3d1a6 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Tue, 7 May 2024 12:19:17 -0700 Subject: [PATCH 43/49] blast_repo fixes (dart-lang/os_detect#42) dependabot --- pkgs/os_detect/.github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/os_detect/.github/dependabot.yml b/pkgs/os_detect/.github/dependabot.yml index b66b0402..d11b305d 100644 --- a/pkgs/os_detect/.github/dependabot.yml +++ b/pkgs/os_detect/.github/dependabot.yml @@ -10,3 +10,7 @@ updates: interval: monthly labels: - autosubmit + groups: + github-actions: + patterns: + - "*" From 19a11d9f3b0a30f78dc87bcf95e2fd7b2df7aa98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 May 2024 19:23:22 +0000 Subject: [PATCH 44/49] Bump actions/checkout from 4.1.4 to 4.1.5 in the github-actions group (dart-lang/os_detect#43) 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.5
Release notes

Sourced from actions/checkout's releases.

v4.1.5

What's Changed

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

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.5)](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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 01b496f9..03673f7d 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.0, dev] steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From 9f985a2077b818b754e3242055f5e273174c78c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Jun 2024 02:55:20 +0000 Subject: [PATCH 45/49] Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group (dart-lang/os_detect#44) 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.5 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

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.5&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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 03673f7d..7ff3180c 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.0, dev] steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: sdk: ${{ matrix.sdk }} From 09a1c9837761719bf290669a74035ab84dcd38a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 02:53:19 +0000 Subject: [PATCH 46/49] Bump the github-actions group with 2 updates (dart-lang/os_detect#47) 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/os_detect#118: dart-lang/setup-dartdart-lang/os_detect#118

Changelog

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

v1.6.5

dart-lang/os_detect#118: dart-lang/setup-dartdart-lang/os_detect#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/os_detect/.github/workflows/test-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index 7ff3180c..ef6092c0 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,8 +22,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 @@ -49,8 +49,8 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.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 d61649d10ef22b31d5daa389f1352b5bf11d762d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 02:05:34 +0000 Subject: [PATCH 47/49] Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group (dart-lang/os_detect#48) 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/os_detect/.github/workflows/test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/pkgs/os_detect/.github/workflows/test-package.yml index ef6092c0..ad6e73f1 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/pkgs/os_detect/.github/workflows/test-package.yml @@ -22,7 +22,7 @@ jobs: matrix: sdk: [dev] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} @@ -49,7 +49,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] sdk: [3.0.0, dev] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: sdk: ${{ matrix.sdk }} From 66b5ae36273ec97f05f95e8d6a6a8cd21ff2f6cb Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 16 Oct 2024 13:06:46 +0200 Subject: [PATCH 48/49] Add issue template and other fixes --- .github/ISSUE_TEMPLATE/os_detect.md | 5 +++++ pkgs/os_detect/pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/os_detect.md diff --git a/.github/ISSUE_TEMPLATE/os_detect.md b/.github/ISSUE_TEMPLATE/os_detect.md new file mode 100644 index 00000000..4648d154 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/os_detect.md @@ -0,0 +1,5 @@ +--- +name: "package:os_detect" +about: "Create a bug or file a feature request against package:os_detect." +labels: "package:os_detect" +--- \ No newline at end of file diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index 3418d326..e1bdbae5 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,7 +1,7 @@ name: os_detect version: 2.0.2-wip description: Platform independent OS detection. -repository: https://github.com/dart-lang/os_detect +repository: https://github.com/dart-lang/core/tree/main/pkgs/os_detect environment: sdk: ^3.0.0 From 9d2259130b40098af7dccfd3786adcfb14b25718 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 16 Oct 2024 13:10:23 +0200 Subject: [PATCH 49/49] Moving fixes --- .github/labeler.yml | 4 ++++ .../workflows/os_detect.yaml | 19 ++++++++++++++----- README.md | 1 + pkgs/os_detect/.github/dependabot.yml | 16 ---------------- pkgs/os_detect/CHANGELOG.md | 3 ++- pkgs/os_detect/README.md | 2 +- pkgs/os_detect/pubspec.yaml | 2 +- 7 files changed, 23 insertions(+), 24 deletions(-) rename pkgs/os_detect/.github/workflows/test-package.yml => .github/workflows/os_detect.yaml (83%) delete mode 100644 pkgs/os_detect/.github/dependabot.yml diff --git a/.github/labeler.yml b/.github/labeler.yml index fc71da29..cc393c67 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -23,3 +23,7 @@ "package:fixnum": - changed-files: - any-glob-to-any-file: 'pkgs/fixnum/**' + +"package:os_detect": + - changed-files: + - any-glob-to-any-file: 'pkgs/os_detect/**' diff --git a/pkgs/os_detect/.github/workflows/test-package.yml b/.github/workflows/os_detect.yaml similarity index 83% rename from pkgs/os_detect/.github/workflows/test-package.yml rename to .github/workflows/os_detect.yaml index ad6e73f1..be86b67e 100644 --- a/pkgs/os_detect/.github/workflows/test-package.yml +++ b/.github/workflows/os_detect.yaml @@ -1,17 +1,26 @@ -name: Dart CI +name: package:os_detect on: - # Run on PRs and pushes to the default branch. + # Run CI on pushes to the main branch, and on PRs against main. push: - branches: [ master ] + branches: [ main ] + paths: + - '.github/workflows/os_detect.yaml' + - 'pkgs/os_detect/**' pull_request: - branches: [ master ] + branches: [ main ] + paths: + - '.github/workflows/os_detect.yaml' + - 'pkgs/os_detect/**' schedule: - cron: "0 0 * * 0" - env: PUB_ENVIRONMENT: bot.github +defaults: + run: + working-directory: pkgs/os_detect/ + jobs: # Check code formatting and static analysis on a single OS (linux) # against Dart dev. diff --git a/README.md b/README.md index 77c5fdb3..16d2fe79 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ This repository is home to various Dart packages under the [dart.dev](https://pu | [convert](pkgs/convert/) | Utilities for converting between data representations. | [![pub package](https://img.shields.io/pub/v/convert.svg)](https://pub.dev/packages/convert) | | [crypto](pkgs/crypto/) | Implementations of SHA, MD5, and HMAC cryptographic functions. | [![pub package](https://img.shields.io/pub/v/crypto.svg)](https://pub.dev/packages/crypto) | | [fixnum](pkgs/fixnum/) | Library for 32- and 64-bit signed fixed-width integers. | [![pub package](https://img.shields.io/pub/v/fixnum.svg)](https://pub.dev/packages/fixnum) | +| [os_detect](pkgs/os_detect/) | Platform independent OS detection. | [![pub package](https://img.shields.io/pub/v/os_detect.svg)](https://pub.dev/packages/os_detect) | ## Publishing automation diff --git a/pkgs/os_detect/.github/dependabot.yml b/pkgs/os_detect/.github/dependabot.yml deleted file mode 100644 index d11b305d..00000000 --- a/pkgs/os_detect/.github/dependabot.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Set update schedule for GitHub Actions -# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot - -version: 2 -updates: - -- package-ecosystem: github-actions - directory: / - schedule: - interval: monthly - labels: - - autosubmit - groups: - github-actions: - patterns: - - "*" diff --git a/pkgs/os_detect/CHANGELOG.md b/pkgs/os_detect/CHANGELOG.md index edb44d8a..0dea3e5d 100644 --- a/pkgs/os_detect/CHANGELOG.md +++ b/pkgs/os_detect/CHANGELOG.md @@ -1,7 +1,8 @@ -## 2.0.2-wip +## 2.0.2 - Require Dart 3.0 - Make work with VM's platform-constants. +- Move to `dart-lang/core` monorepo. ## 2.0.1 diff --git a/pkgs/os_detect/README.md b/pkgs/os_detect/README.md index 94abc516..cb931b15 100644 --- a/pkgs/os_detect/README.md +++ b/pkgs/os_detect/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://github.com/dart-lang/os_detect/workflows/Dart%20CI/badge.svg)](https://github.com/dart-lang/os_detect/actions?query=workflow%3A"Dart+CI"+branch%3Amaster) +[![Dart CI](https://github.com/dart-lang/core/actions/workflows/os_detect.yaml/badge.svg)](https://github.com/dart-lang/core/actions/workflows/os_detect.yaml) [![pub package](https://img.shields.io/pub/v/os_detect.svg)](https://pub.dev/packages/os_detect) [![package publisher](https://img.shields.io/pub/publisher/os_detect.svg)](https://pub.dev/packages/os_detect/publisher) diff --git a/pkgs/os_detect/pubspec.yaml b/pkgs/os_detect/pubspec.yaml index e1bdbae5..fb927b4c 100644 --- a/pkgs/os_detect/pubspec.yaml +++ b/pkgs/os_detect/pubspec.yaml @@ -1,5 +1,5 @@ name: os_detect -version: 2.0.2-wip +version: 2.0.2 description: Platform independent OS detection. repository: https://github.com/dart-lang/core/tree/main/pkgs/os_detect