From 9d2c1c785bbab1277793241646a5adafea1c4488 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 15:48:23 -0700 Subject: [PATCH 01/15] Reset webdev, dwds, test_common after publishing --- dwds/CHANGELOG.md | 1 + dwds/pubspec.yaml | 2 +- test_common/pubspec.yaml | 6 +++--- webdev/CHANGELOG.md | 2 ++ webdev/pubspec.yaml | 8 ++++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index adc11006a..478adc182 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -1,3 +1,4 @@ +## 18.0.3-dev ## 18.0.2 - Support new DDC temp names for patterns. - [#2042](https://github.com/dart-lang/webdev/pull/2042) diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index 49d3b32bf..ddb86c63a 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -1,6 +1,6 @@ name: dwds # Every time this changes you need to run `dart run build_runner build`. -version: 18.0.2 +version: 18.0.3-dev description: >- A service that proxies between the Chrome debug protocol and the Dart VM service protocol. diff --git a/test_common/pubspec.yaml b/test_common/pubspec.yaml index 83c8f0b3b..0c17c3590 100644 --- a/test_common/pubspec.yaml +++ b/test_common/pubspec.yaml @@ -16,6 +16,6 @@ dev_dependencies: lints: ^2.0.0 # Comment out before releasing webdev. -# dependency_overrides: -# dwds: -# path: ../dwds +dependency_overrides: + dwds: + path: ../dwds diff --git a/webdev/CHANGELOG.md b/webdev/CHANGELOG.md index 5c021f0a3..6fe4831be 100644 --- a/webdev/CHANGELOG.md +++ b/webdev/CHANGELOG.md @@ -1,3 +1,5 @@ +## 3.0.4-dev + ## 3.0.3 - Update `dwds` constraint to `18.0.2`. diff --git a/webdev/pubspec.yaml b/webdev/pubspec.yaml index c760a4727..3cf514835 100644 --- a/webdev/pubspec.yaml +++ b/webdev/pubspec.yaml @@ -1,6 +1,6 @@ name: webdev # Every time this changes you need to run `dart run build_runner build`. -version: 3.0.3 +version: 3.0.4-dev # We should not depend on a dev SDK before publishing. # publish_to: none description: >- @@ -52,9 +52,9 @@ dev_dependencies: webdriver: ^3.0.0 # Comment out before releasing webdev. -# dependency_overrides: -# dwds: -# path: ../dwds +dependency_overrides: + dwds: + path: ../dwds executables: webdev: From bab2f80d889799707c9f88edfc44c09a73095888 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 15:53:22 -0700 Subject: [PATCH 02/15] New line --- dwds/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 478adc182..284397194 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -1,4 +1,5 @@ ## 18.0.3-dev + ## 18.0.2 - Support new DDC temp names for patterns. - [#2042](https://github.com/dart-lang/webdev/pull/2042) From 454b41105b5e193e66c137006d3f4ad031bc77ff Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 15:58:25 -0700 Subject: [PATCH 03/15] Update DWDS version --- test_common/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_common/pubspec.yaml b/test_common/pubspec.yaml index 0c17c3590..5b516cd18 100644 --- a/test_common/pubspec.yaml +++ b/test_common/pubspec.yaml @@ -6,7 +6,7 @@ environment: sdk: ">=3.0.0-134.0.dev <4.0.0" dependencies: - dwds: 18.0.2 + dwds: 18.0.3-dev file: ^6.1.3 logging: ^1.0.1 path: ^1.8.1 From 44af7d567ca3a0d722f6d78c9481891e553361fc Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:06:55 -0700 Subject: [PATCH 04/15] Switch to using pubspec_overrides --- dwds/debug_extension/pubspec.yaml | 7 +------ dwds/debug_extension/pubspec_overrides.yaml | 5 +++++ dwds/debug_extension_mv3/pubspec_overrides.yaml | 3 +++ frontend_server_client/pubspec.yaml | 4 ---- frontend_server_client/pubspec_overrides.yaml | 4 ++++ frontend_server_common/pubspec.yaml | 4 ---- frontend_server_common/pubspec_overrides.yaml | 3 +++ test_common/pubspec.yaml | 5 ----- test_common/pubspec_overrides.yaml | 3 +++ webdev/pubspec.yaml | 5 ----- webdev/pubspec_overrides.yaml | 3 +++ 11 files changed, 22 insertions(+), 24 deletions(-) create mode 100644 dwds/debug_extension/pubspec_overrides.yaml create mode 100644 dwds/debug_extension_mv3/pubspec_overrides.yaml create mode 100644 frontend_server_client/pubspec_overrides.yaml create mode 100644 frontend_server_common/pubspec_overrides.yaml create mode 100644 test_common/pubspec_overrides.yaml create mode 100644 webdev/pubspec_overrides.yaml diff --git a/dwds/debug_extension/pubspec.yaml b/dwds/debug_extension/pubspec.yaml index 82584e699..f084238ce 100644 --- a/dwds/debug_extension/pubspec.yaml +++ b/dwds/debug_extension/pubspec.yaml @@ -23,9 +23,4 @@ dev_dependencies: built_collection: ^5.0.0 dwds: ^11.0.0 webdev: ^2.0.0 - -dependency_overrides: - webdev: - path: ../../webdev - dwds: - path: .. + \ No newline at end of file diff --git a/dwds/debug_extension/pubspec_overrides.yaml b/dwds/debug_extension/pubspec_overrides.yaml new file mode 100644 index 000000000..4da474653 --- /dev/null +++ b/dwds/debug_extension/pubspec_overrides.yaml @@ -0,0 +1,5 @@ +dependency_overrides: + webdev: + path: ../../webdev + dwds: + path: .. diff --git a/dwds/debug_extension_mv3/pubspec_overrides.yaml b/dwds/debug_extension_mv3/pubspec_overrides.yaml new file mode 100644 index 000000000..581552eac --- /dev/null +++ b/dwds/debug_extension_mv3/pubspec_overrides.yaml @@ -0,0 +1,3 @@ +dependency_overrides: + dwds: + path: .. diff --git a/frontend_server_client/pubspec.yaml b/frontend_server_client/pubspec.yaml index 5043270ae..167b58a70 100644 --- a/frontend_server_client/pubspec.yaml +++ b/frontend_server_client/pubspec.yaml @@ -22,7 +22,3 @@ dev_dependencies: test_process: ^2.0.0 vm_service: ^8.0.0 -dependency_overrides: - # Necessary to get a version solve until test_core allows version 3.x of - # this package - test_core: ^0.4.13 diff --git a/frontend_server_client/pubspec_overrides.yaml b/frontend_server_client/pubspec_overrides.yaml new file mode 100644 index 000000000..319e25445 --- /dev/null +++ b/frontend_server_client/pubspec_overrides.yaml @@ -0,0 +1,4 @@ +dependency_overrides: + # Necessary to get a version solve until test_core allows version 3.x of + # this package + test_core: ^0.4.13 \ No newline at end of file diff --git a/frontend_server_common/pubspec.yaml b/frontend_server_common/pubspec.yaml index d1646b17f..d9ed20682 100644 --- a/frontend_server_common/pubspec.yaml +++ b/frontend_server_common/pubspec.yaml @@ -19,7 +19,3 @@ dependencies: test_common: path: ../test_common usage: ^4.0.0 - -dependency_overrides: - dwds: - path: ../dwds diff --git a/frontend_server_common/pubspec_overrides.yaml b/frontend_server_common/pubspec_overrides.yaml new file mode 100644 index 000000000..d3d78b8af --- /dev/null +++ b/frontend_server_common/pubspec_overrides.yaml @@ -0,0 +1,3 @@ +dependency_overrides: + dwds: + path: ../dwds diff --git a/test_common/pubspec.yaml b/test_common/pubspec.yaml index 5b516cd18..8e8a0df9a 100644 --- a/test_common/pubspec.yaml +++ b/test_common/pubspec.yaml @@ -14,8 +14,3 @@ dependencies: dev_dependencies: lints: ^2.0.0 - -# Comment out before releasing webdev. -dependency_overrides: - dwds: - path: ../dwds diff --git a/test_common/pubspec_overrides.yaml b/test_common/pubspec_overrides.yaml new file mode 100644 index 000000000..d3d78b8af --- /dev/null +++ b/test_common/pubspec_overrides.yaml @@ -0,0 +1,3 @@ +dependency_overrides: + dwds: + path: ../dwds diff --git a/webdev/pubspec.yaml b/webdev/pubspec.yaml index 3cf514835..69ac1dddc 100644 --- a/webdev/pubspec.yaml +++ b/webdev/pubspec.yaml @@ -51,10 +51,5 @@ dev_dependencies: test_process: ^2.0.2 webdriver: ^3.0.0 -# Comment out before releasing webdev. -dependency_overrides: - dwds: - path: ../dwds - executables: webdev: diff --git a/webdev/pubspec_overrides.yaml b/webdev/pubspec_overrides.yaml new file mode 100644 index 000000000..3463d2bbf --- /dev/null +++ b/webdev/pubspec_overrides.yaml @@ -0,0 +1,3 @@ +dependency_overrides: + dwds: + path: ../dwds \ No newline at end of file From accb9caa953fe2a4d03e44fe0fbd55975e79df94 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:09:12 -0700 Subject: [PATCH 05/15] Clean up --- dwds/debug_extension/pubspec.yaml | 3 +-- frontend_server_client/pubspec.yaml | 1 - test_common/pubspec.yaml | 2 +- webdev/pubspec.yaml | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dwds/debug_extension/pubspec.yaml b/dwds/debug_extension/pubspec.yaml index f084238ce..8f3fe7710 100644 --- a/dwds/debug_extension/pubspec.yaml +++ b/dwds/debug_extension/pubspec.yaml @@ -22,5 +22,4 @@ dev_dependencies: build_runner: ^2.4.0 built_collection: ^5.0.0 dwds: ^11.0.0 - webdev: ^2.0.0 - \ No newline at end of file + webdev: ^2.0.0 \ No newline at end of file diff --git a/frontend_server_client/pubspec.yaml b/frontend_server_client/pubspec.yaml index 167b58a70..e1507b406 100644 --- a/frontend_server_client/pubspec.yaml +++ b/frontend_server_client/pubspec.yaml @@ -21,4 +21,3 @@ dev_dependencies: test_descriptor: ^2.0.0 test_process: ^2.0.0 vm_service: ^8.0.0 - diff --git a/test_common/pubspec.yaml b/test_common/pubspec.yaml index 8e8a0df9a..e5af4a96d 100644 --- a/test_common/pubspec.yaml +++ b/test_common/pubspec.yaml @@ -6,7 +6,7 @@ environment: sdk: ">=3.0.0-134.0.dev <4.0.0" dependencies: - dwds: 18.0.3-dev + dwds: ^18.0.0 file: ^6.1.3 logging: ^1.0.1 path: ^1.8.1 diff --git a/webdev/pubspec.yaml b/webdev/pubspec.yaml index 69ac1dddc..426a80cc7 100644 --- a/webdev/pubspec.yaml +++ b/webdev/pubspec.yaml @@ -52,4 +52,4 @@ dev_dependencies: webdriver: ^3.0.0 executables: - webdev: + webdev: \ No newline at end of file From b648ee776a5915dd28a5ef04fea7b7be1d332dec Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:12:35 -0700 Subject: [PATCH 06/15] Build dwds and webdev --- dwds/lib/src/version.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwds/lib/src/version.dart b/dwds/lib/src/version.dart index a172ee8a6..b14bea8ec 100644 --- a/dwds/lib/src/version.dart +++ b/dwds/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '18.0.2'; +const packageVersion = '18.0.3-dev'; From 5103f644b68d41c4ed4890b4a4bf7323ba8c9c9b Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:15:12 -0700 Subject: [PATCH 07/15] Remove new lines --- dwds/debug_extension/pubspec_overrides.yaml | 2 +- dwds/pubspec.yaml | 2 +- example/pubspec.yaml | 2 +- frontend_server_client/pubspec.yaml | 2 +- test_common/pubspec.yaml | 2 +- test_common/pubspec_overrides.yaml | 2 +- webdev/lib/src/version.dart | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dwds/debug_extension/pubspec_overrides.yaml b/dwds/debug_extension/pubspec_overrides.yaml index 4da474653..41f3da2dd 100644 --- a/dwds/debug_extension/pubspec_overrides.yaml +++ b/dwds/debug_extension/pubspec_overrides.yaml @@ -2,4 +2,4 @@ dependency_overrides: webdev: path: ../../webdev dwds: - path: .. + path: .. \ No newline at end of file diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index ddb86c63a..25fd79344 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -57,4 +57,4 @@ dev_dependencies: test: ^1.21.1 test_common: path: ../test_common - webdriver: ^3.0.0 + webdriver: ^3.0.0 \ No newline at end of file diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 9bfd9c227..922e0161c 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -8,4 +8,4 @@ environment: dev_dependencies: build_runner: ^2.4.0 - build_web_compilers: ^4.0.0 + build_web_compilers: ^4.0.0 \ No newline at end of file diff --git a/frontend_server_client/pubspec.yaml b/frontend_server_client/pubspec.yaml index e1507b406..022ba0d42 100644 --- a/frontend_server_client/pubspec.yaml +++ b/frontend_server_client/pubspec.yaml @@ -20,4 +20,4 @@ dev_dependencies: test: ^1.16.0 test_descriptor: ^2.0.0 test_process: ^2.0.0 - vm_service: ^8.0.0 + vm_service: ^8.0.0 \ No newline at end of file diff --git a/test_common/pubspec.yaml b/test_common/pubspec.yaml index e5af4a96d..59547597e 100644 --- a/test_common/pubspec.yaml +++ b/test_common/pubspec.yaml @@ -13,4 +13,4 @@ dependencies: test: ^1.21.1 dev_dependencies: - lints: ^2.0.0 + lints: ^2.0.0 \ No newline at end of file diff --git a/test_common/pubspec_overrides.yaml b/test_common/pubspec_overrides.yaml index d3d78b8af..3463d2bbf 100644 --- a/test_common/pubspec_overrides.yaml +++ b/test_common/pubspec_overrides.yaml @@ -1,3 +1,3 @@ dependency_overrides: dwds: - path: ../dwds + path: ../dwds \ No newline at end of file diff --git a/webdev/lib/src/version.dart b/webdev/lib/src/version.dart index 70c1796cf..5e6c6096e 100644 --- a/webdev/lib/src/version.dart +++ b/webdev/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '3.0.3'; +const packageVersion = '3.0.4-dev'; From e3f1f44eb287d6b6f6f1034b063b6f547c57c937 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:17:33 -0700 Subject: [PATCH 08/15] Add new lines back --- dwds/debug_extension/pubspec.yaml | 2 +- dwds/debug_extension/pubspec_overrides.yaml | 2 +- test_common/pubspec.yaml | 2 +- test_common/pubspec_overrides.yaml | 2 +- webdev/pubspec.yaml | 2 +- webdev/pubspec_overrides.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dwds/debug_extension/pubspec.yaml b/dwds/debug_extension/pubspec.yaml index 8f3fe7710..9a3ecdf6a 100644 --- a/dwds/debug_extension/pubspec.yaml +++ b/dwds/debug_extension/pubspec.yaml @@ -22,4 +22,4 @@ dev_dependencies: build_runner: ^2.4.0 built_collection: ^5.0.0 dwds: ^11.0.0 - webdev: ^2.0.0 \ No newline at end of file + webdev: ^2.0.0 diff --git a/dwds/debug_extension/pubspec_overrides.yaml b/dwds/debug_extension/pubspec_overrides.yaml index 41f3da2dd..4da474653 100644 --- a/dwds/debug_extension/pubspec_overrides.yaml +++ b/dwds/debug_extension/pubspec_overrides.yaml @@ -2,4 +2,4 @@ dependency_overrides: webdev: path: ../../webdev dwds: - path: .. \ No newline at end of file + path: .. diff --git a/test_common/pubspec.yaml b/test_common/pubspec.yaml index 59547597e..e5af4a96d 100644 --- a/test_common/pubspec.yaml +++ b/test_common/pubspec.yaml @@ -13,4 +13,4 @@ dependencies: test: ^1.21.1 dev_dependencies: - lints: ^2.0.0 \ No newline at end of file + lints: ^2.0.0 diff --git a/test_common/pubspec_overrides.yaml b/test_common/pubspec_overrides.yaml index 3463d2bbf..d3d78b8af 100644 --- a/test_common/pubspec_overrides.yaml +++ b/test_common/pubspec_overrides.yaml @@ -1,3 +1,3 @@ dependency_overrides: dwds: - path: ../dwds \ No newline at end of file + path: ../dwds diff --git a/webdev/pubspec.yaml b/webdev/pubspec.yaml index 426a80cc7..69ac1dddc 100644 --- a/webdev/pubspec.yaml +++ b/webdev/pubspec.yaml @@ -52,4 +52,4 @@ dev_dependencies: webdriver: ^3.0.0 executables: - webdev: \ No newline at end of file + webdev: diff --git a/webdev/pubspec_overrides.yaml b/webdev/pubspec_overrides.yaml index 3463d2bbf..d3d78b8af 100644 --- a/webdev/pubspec_overrides.yaml +++ b/webdev/pubspec_overrides.yaml @@ -1,3 +1,3 @@ dependency_overrides: dwds: - path: ../dwds \ No newline at end of file + path: ../dwds From c8d4030cdf125517e523025349fc113a1b09ee01 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:23:42 -0700 Subject: [PATCH 09/15] More missing new lines --- dwds/pubspec.yaml | 2 +- example/pubspec.yaml | 2 +- frontend_server_client/pubspec.yaml | 2 +- frontend_server_client/pubspec_overrides.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index 25fd79344..ddb86c63a 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -57,4 +57,4 @@ dev_dependencies: test: ^1.21.1 test_common: path: ../test_common - webdriver: ^3.0.0 \ No newline at end of file + webdriver: ^3.0.0 diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 922e0161c..9bfd9c227 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -8,4 +8,4 @@ environment: dev_dependencies: build_runner: ^2.4.0 - build_web_compilers: ^4.0.0 \ No newline at end of file + build_web_compilers: ^4.0.0 diff --git a/frontend_server_client/pubspec.yaml b/frontend_server_client/pubspec.yaml index 022ba0d42..e1507b406 100644 --- a/frontend_server_client/pubspec.yaml +++ b/frontend_server_client/pubspec.yaml @@ -20,4 +20,4 @@ dev_dependencies: test: ^1.16.0 test_descriptor: ^2.0.0 test_process: ^2.0.0 - vm_service: ^8.0.0 \ No newline at end of file + vm_service: ^8.0.0 diff --git a/frontend_server_client/pubspec_overrides.yaml b/frontend_server_client/pubspec_overrides.yaml index 319e25445..6a113c999 100644 --- a/frontend_server_client/pubspec_overrides.yaml +++ b/frontend_server_client/pubspec_overrides.yaml @@ -1,4 +1,4 @@ dependency_overrides: # Necessary to get a version solve until test_core allows version 3.x of # this package - test_core: ^0.4.13 \ No newline at end of file + test_core: ^0.4.13 From 51294032828090c4c006e491dfb696f9e52a126b Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:04:34 -0700 Subject: [PATCH 10/15] Wip --- dwds/tool/prepare_release.dart | 83 ++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 dwds/tool/prepare_release.dart diff --git a/dwds/tool/prepare_release.dart b/dwds/tool/prepare_release.dart new file mode 100644 index 000000000..a0f5bf65f --- /dev/null +++ b/dwds/tool/prepare_release.dart @@ -0,0 +1,83 @@ +// 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 'dart:io'; + +import 'package:args/args.dart'; + +const _versionOption = 'version'; + +void main(List arguments) async { + final parser = ArgParser()..addOption(_versionOption, abbr: 'v'); + final argResults = parser.parse(arguments); + + _readVersionFile(); + + exitCode = await run( + newVersion: argResults[_versionOption] as String?, + ); + if (exitCode != 0) { + print('Run terminated unexpectedly with exit code: $exitCode'); + } +} + +Future run({String? newVersion}) async { + final currentVersion = _readVersionFile(); + final nextVersion = newVersion ?? _removeDev(currentVersion); + print('Updating DWDS from $currentVersion to $nextVersion'); + for (var fileName in [ + 'pubspec.yaml', + 'CHANGELOG.md', + ]) { + _replaceInFile( + File(fileName), + query: currentVersion, + replaceWith: nextVersion, + ); + } + + // Return exit code (0 indicates success): + return 0; +} + +void _replaceInFile( + File file, { + required String query, + required String replaceWith, +}) { + final newLines = []; + for (final line in file.readAsLinesSync()) { + if (line.contains(query)) { + newLines.add(line.replaceAll(query, replaceWith)); + } else { + newLines.add(line); + } + } + final content = newLines.join('\n'); + return file.writeAsStringSync(content); +} + +String _readVersionFile() { + final versionFile = File('lib/src/version.dart'); + final lines = versionFile.readAsLinesSync(); + for (final line in lines) { + if (line.startsWith('const packageVersion =')) { + final version = line + .split('=') + .last + .split('') + .where((char) => char != ";" && char != "'" && char != '"') + .join(''); + return version; + } + } + throw Exception('Could not read version in lib/src/version.dart'); +} + +String _removeDev(String devVersion) { + if (!devVersion.contains('dev')) { + throw Exception('$devVersion is not a dev version.'); + } + return devVersion.split('-dev').first; +} From 534980d5fa6342cef0817a593c4fbe19d72dd593 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:20:14 -0700 Subject: [PATCH 11/15] Preparing release works --- dwds/tool/prepare_release.dart | 70 +++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/dwds/tool/prepare_release.dart b/dwds/tool/prepare_release.dart index a0f5bf65f..47e8c3bca 100644 --- a/dwds/tool/prepare_release.dart +++ b/dwds/tool/prepare_release.dart @@ -7,26 +7,67 @@ import 'dart:io'; import 'package:args/args.dart'; const _versionOption = 'version'; +const _skipStableCheckFlag = 'skipStableCheck'; void main(List arguments) async { - final parser = ArgParser()..addOption(_versionOption, abbr: 'v'); + final parser = ArgParser() + ..addOption(_versionOption, abbr: 'v') + ..addFlag(_skipStableCheckFlag, abbr: 's'); final argResults = parser.parse(arguments); _readVersionFile(); exitCode = await run( newVersion: argResults[_versionOption] as String?, + skipStableCheck: argResults[_skipStableCheckFlag] as bool?, ); if (exitCode != 0) { print('Run terminated unexpectedly with exit code: $exitCode'); } } -Future run({String? newVersion}) async { +Future run({String? newVersion, bool? skipStableCheck}) async { + if (skipStableCheck != true) { + final checkVersionProcess = await Process.run('dart', ['--version']); + final versionInfo = checkVersionProcess.stdout; + if (!versionInfo.contains('stable')) { + _logWarning( + ''' + Expected to be on stable version of Dart, instead on: + $versionInfo + To skip this check, re-run with --skipStableCheck + ''', + ); + return checkVersionProcess.exitCode; + } + } + + for (final packagePath in [ + './', + '../webdev', + '../frontend_server_common', + '../frontend_server_client', + ]) { + _logInfo('Upgrading pub packages for $packagePath...'); + final pubUpgradeProcess = await Process.run( + 'dart', + [ + 'pub', + 'upgrade', + ], + workingDirectory: packagePath, + ); + final upgradeErrors = pubUpgradeProcess.stderr ?? ''; + if (upgradeErrors.isNotEmpty) { + _logWarning(upgradeErrors); + return pubUpgradeProcess.exitCode; + } + } + final currentVersion = _readVersionFile(); final nextVersion = newVersion ?? _removeDev(currentVersion); - print('Updating DWDS from $currentVersion to $nextVersion'); - for (var fileName in [ + _logInfo('Updating DWDS from $currentVersion to $nextVersion...'); + for (final fileName in [ 'pubspec.yaml', 'CHANGELOG.md', ]) { @@ -37,8 +78,17 @@ Future run({String? newVersion}) async { ); } - // Return exit code (0 indicates success): - return 0; + _logInfo('Building DWDS...'); + final buildProcess = await Process.run( + 'dart', + ['run', 'build_runner', 'build'], + ); + + final buildErrors = buildProcess.stderr ?? ''; + if (buildErrors.isNotEmpty) { + _logWarning(buildErrors); + } + return buildProcess.exitCode; } void _replaceInFile( @@ -81,3 +131,11 @@ String _removeDev(String devVersion) { } return devVersion.split('-dev').first; } + +void _logInfo(String message) { + stdout.writeln(message); +} + +void _logWarning(String warning) { + stderr.writeln(warning); +} From dcc37df30ccf74bbe8c4c845f8c66a836bed3072 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 23 Mar 2023 14:57:13 -0700 Subject: [PATCH 12/15] Move release tool and update instructions --- dwds/CONTRIBUTING.md | 18 +-- dwds/tool/prepare_release.dart | 141 ---------------- tool/release.dart | 286 +++++++++++++++++++++++++++++++++ webdev/CONTRIBUTING.md | 25 ++- 4 files changed, 301 insertions(+), 169 deletions(-) delete mode 100644 dwds/tool/prepare_release.dart create mode 100644 tool/release.dart diff --git a/dwds/CONTRIBUTING.md b/dwds/CONTRIBUTING.md index ae3abaa37..a76e3991d 100644 --- a/dwds/CONTRIBUTING.md +++ b/dwds/CONTRIBUTING.md @@ -83,20 +83,14 @@ the example app and connect to DWDS. ## Step 2: Publish DWDS to pub -- Make sure you are on the Dart stable SDK version (check with `dart --version`) -- From each of the subdirectories (`/dwds`, `/frontend_server_client`, - `/frontend_server_common`, and `/webdev`) update dependencies with - `dart pub upgrade` -- Update the version number in `dwds/pubspec.yaml` and `dwds/CHANGELOG.md` -- From `/dwds` run `dart run build_runner build`, this will build and update the - version in `/dwds/lib/src/version.dart` -- Submit a PR with those changes (example PR: - https://github.com/dart-lang/webdev/pull/1456). _Note: Ensure your PR doesn’t - have any dependency overrides._ -- Once the PR is submitted, pull from master and `run dart pub publish` -- Finally, go to https://github.com/dart-lang/webdev/releases and create a new +- From the `/tool` directory in the mono-repo root, run: `dart run release.dart -p dwds` +- Submit a PR with those changes (example PR: https://github.com/dart-lang/webdev/pull/1456) +- Once the PR is submitted, pull from master and run `dart pub publish` +- Go to https://github.com/dart-lang/webdev/releases and create a new release, eg https://github.com/dart-lang/webdev/releases/tag/dwds-v12.0.0. You might need to delete some of the content of the autogenerated notes. +- From the `/tool` directory in the mono-repo root, run: `dart run release.dart --reset -p dwds` +- Submit a PR with those changes. > _Note: To have the right permissions for publishing, you need to be invited to > the tools.dart.dev. A member of the Dart team should be able to add you at diff --git a/dwds/tool/prepare_release.dart b/dwds/tool/prepare_release.dart deleted file mode 100644 index 47e8c3bca..000000000 --- a/dwds/tool/prepare_release.dart +++ /dev/null @@ -1,141 +0,0 @@ -// 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 'dart:io'; - -import 'package:args/args.dart'; - -const _versionOption = 'version'; -const _skipStableCheckFlag = 'skipStableCheck'; - -void main(List arguments) async { - final parser = ArgParser() - ..addOption(_versionOption, abbr: 'v') - ..addFlag(_skipStableCheckFlag, abbr: 's'); - final argResults = parser.parse(arguments); - - _readVersionFile(); - - exitCode = await run( - newVersion: argResults[_versionOption] as String?, - skipStableCheck: argResults[_skipStableCheckFlag] as bool?, - ); - if (exitCode != 0) { - print('Run terminated unexpectedly with exit code: $exitCode'); - } -} - -Future run({String? newVersion, bool? skipStableCheck}) async { - if (skipStableCheck != true) { - final checkVersionProcess = await Process.run('dart', ['--version']); - final versionInfo = checkVersionProcess.stdout; - if (!versionInfo.contains('stable')) { - _logWarning( - ''' - Expected to be on stable version of Dart, instead on: - $versionInfo - To skip this check, re-run with --skipStableCheck - ''', - ); - return checkVersionProcess.exitCode; - } - } - - for (final packagePath in [ - './', - '../webdev', - '../frontend_server_common', - '../frontend_server_client', - ]) { - _logInfo('Upgrading pub packages for $packagePath...'); - final pubUpgradeProcess = await Process.run( - 'dart', - [ - 'pub', - 'upgrade', - ], - workingDirectory: packagePath, - ); - final upgradeErrors = pubUpgradeProcess.stderr ?? ''; - if (upgradeErrors.isNotEmpty) { - _logWarning(upgradeErrors); - return pubUpgradeProcess.exitCode; - } - } - - final currentVersion = _readVersionFile(); - final nextVersion = newVersion ?? _removeDev(currentVersion); - _logInfo('Updating DWDS from $currentVersion to $nextVersion...'); - for (final fileName in [ - 'pubspec.yaml', - 'CHANGELOG.md', - ]) { - _replaceInFile( - File(fileName), - query: currentVersion, - replaceWith: nextVersion, - ); - } - - _logInfo('Building DWDS...'); - final buildProcess = await Process.run( - 'dart', - ['run', 'build_runner', 'build'], - ); - - final buildErrors = buildProcess.stderr ?? ''; - if (buildErrors.isNotEmpty) { - _logWarning(buildErrors); - } - return buildProcess.exitCode; -} - -void _replaceInFile( - File file, { - required String query, - required String replaceWith, -}) { - final newLines = []; - for (final line in file.readAsLinesSync()) { - if (line.contains(query)) { - newLines.add(line.replaceAll(query, replaceWith)); - } else { - newLines.add(line); - } - } - final content = newLines.join('\n'); - return file.writeAsStringSync(content); -} - -String _readVersionFile() { - final versionFile = File('lib/src/version.dart'); - final lines = versionFile.readAsLinesSync(); - for (final line in lines) { - if (line.startsWith('const packageVersion =')) { - final version = line - .split('=') - .last - .split('') - .where((char) => char != ";" && char != "'" && char != '"') - .join(''); - return version; - } - } - throw Exception('Could not read version in lib/src/version.dart'); -} - -String _removeDev(String devVersion) { - if (!devVersion.contains('dev')) { - throw Exception('$devVersion is not a dev version.'); - } - return devVersion.split('-dev').first; -} - -void _logInfo(String message) { - stdout.writeln(message); -} - -void _logWarning(String warning) { - stderr.writeln(warning); -} diff --git a/tool/release.dart b/tool/release.dart new file mode 100644 index 000000000..73c4aa0ff --- /dev/null +++ b/tool/release.dart @@ -0,0 +1,286 @@ +// 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 'dart:io'; + +import 'package:args/args.dart'; + +const _packageOption = 'package'; +const _versionOption = 'version'; +const _resetFlag = 'reset'; +const _skipStableCheckFlag = 'skipStableCheck'; + +/// Note: Must be run from the /tool directory. +/// +/// To prepare DWDS for release: +/// `dart run release.dart -p dwds` +/// +/// To prepare WebDev for release: +/// `dart run release.dart -p webdev` +/// +/// To reset DWDS after a release: +/// `dart run release.dart --reset -p dwds -v -[[dev version]]` +/// +/// To reset WebDev after a release: +/// `dart run release.dart --reset -p webdev -v -[[dev version]]` + +void main(List arguments) async { + final parser = ArgParser() + ..addOption( + _packageOption, + abbr: 'p', + allowed: [ + 'webdev', + 'dwds', + ], + ) + ..addOption(_versionOption, abbr: 'v') + ..addFlag(_resetFlag, abbr: 'r') + ..addFlag(_skipStableCheckFlag, abbr: 's'); + + final argResults = parser.parse(arguments); + final package = argResults[_packageOption] as String?; + if (package == null) { + _logWarning('Please specify package with either --p=dwds or --p=webdev'); + return; + } + + final isReset = argResults[_resetFlag] as bool?; + final newVersion = argResults[_versionOption] as String?; + final skipStableCheck = argResults[_skipStableCheckFlag] as bool?; + + int exitCode; + if (isReset == true) { + exitCode = runReset( + package: package, + newVersion: newVersion, + ); + } else { + exitCode = await runRelease( + package: package, + newVersion: newVersion, + skipStableCheck: skipStableCheck, + ); + } + if (exitCode != 0) { + _logWarning('Run terminated unexpectedly with exit code: $exitCode'); + } +} + +int runReset({ + required String package, + String? newVersion, +}) { + // Check that a new dev version has been provided. + final currentVersion = _readVersionFile(package); + if (newVersion == null || !newVersion.contains('dev')) { + _logInfo( + ''' + Please provide the next dev version for $package, e.g. -v 3.0.1-dev + Current version is $currentVersion. + ''', + ); + return 1; + } + + // Update the version strings in CHANGELOG and pubspec.yaml. + _updateVersionStrings( + package, + currentVersion: currentVersion, + nextVersion: newVersion, + isReset: true, + ); + + return 0; +} + +Future runRelease({ + required String package, + String? newVersion, + bool? skipStableCheck, +}) async { + // Check that we are on a stable version of Dart. + if (skipStableCheck != true) { + final checkVersionProcess = await Process.run('dart', ['--version']); + final versionInfo = checkVersionProcess.stdout as String; + if (!versionInfo.contains('stable')) { + _logWarning( + ''' + Expected to be on stable version of Dart, instead on: + $versionInfo + To skip this check, re-run with --skipStableCheck + ''', + ); + return checkVersionProcess.exitCode; + } + } + + // Update the pinned version of DWDS for webdev releases. + if (package == 'webdev') { + _logInfo('Updating pinned version of DWDS.'); + await _updateDwdsPin(package); + } + + // Run dart pub upgrade. + for (final packagePath in [ + '../dwds', + '../webdev', + '../frontend_server_common', + '../frontend_server_client', + ]) { + _logInfo('Upgrading pub packages for $packagePath'); + final pubUpgradeProcess = await Process.run( + 'dart', + [ + 'pub', + 'upgrade', + ], + workingDirectory: packagePath, + ); + final upgradeErrors = pubUpgradeProcess.stderr as String; + if (upgradeErrors.isNotEmpty) { + _logWarning(upgradeErrors); + return pubUpgradeProcess.exitCode; + } + } + + // Update the version strings in CHANGELOG and pubspec.yaml. + final currentVersion = _readVersionFile(package); + final nextVersion = newVersion ?? _removeDev(currentVersion); + _updateVersionStrings( + package, + currentVersion: currentVersion, + nextVersion: nextVersion, + ); + + // Build the package. + final exitCode = _buildPackage(package); + return exitCode; +} + +Future _buildPackage(String package) async { + _logInfo('Building $package'); + final buildProcess = await Process.run( + 'dart', + ['run', 'build_runner', 'build'], + workingDirectory: '../$package', + ); + + final buildErrors = buildProcess.stderr as String; + if (buildErrors.isNotEmpty) { + _logWarning(buildErrors); + } + return buildProcess.exitCode; +} + +void _updateVersionStrings( + String package, { + required String nextVersion, + required String currentVersion, + bool isReset = false, +}) { + _logInfo('Updating $package from $currentVersion to $nextVersion'); + final pubspec = File('../$package/pubspec.yaml'); + final changelog = File('../$package/CHANGELOG.md'); + if (isReset) { + _addNewLine(changelog, newLine: '## $nextVersion'); + _replaceInFile(pubspec, query: currentVersion, replaceWith: nextVersion); + } else { + for (final file in [pubspec, changelog]) { + _replaceInFile(file, query: currentVersion, replaceWith: nextVersion); + } + } +} + +void _addNewLine( + File file, { + required String newLine, +}) { + final newLines = [newLine, '', ...file.readAsLinesSync()]; + final content = newLines.joinWithNewLine(); + return file.writeAsStringSync(content); +} + +void _replaceInFile( + File file, { + required String query, + required String replaceWith, +}) { + final newLines = []; + for (final line in file.readAsLinesSync()) { + if (line.contains(query)) { + newLines.add(line.replaceAll(query, replaceWith)); + } else { + newLines.add(line); + } + } + final content = newLines.joinWithNewLine(); + return file.writeAsStringSync(content); +} + +String _readVersionFile(String package) { + final versionFile = File('../$package/lib/src/version.dart'); + final lines = versionFile.readAsLinesSync(); + for (final line in lines) { + if (line.startsWith('const packageVersion =')) { + final version = line + .split('=') + .last + .split('') + .where((char) => char != ';' && char != "'" && char != '"') + .join(''); + return version.trim(); + } + } + throw Exception('Could not read version in $package/lib/src/version.dart'); +} + +String _removeDev(String devVersion) { + if (!devVersion.contains('dev')) { + throw Exception('$devVersion is not a dev version.'); + } + return devVersion.split('-dev').first; +} + +Future _updateDwdsPin(String package) async { + final pubOutdatedProcess = await Process.run( + 'dart', + [ + 'pub', + 'outdated', + '--no-dependency-overrides', + ], + workingDirectory: '../$package', + ); + final lines = pubOutdatedProcess.stdout.split('\n') as List; + for (final line in lines) { + if (line.trim().startsWith('dwds')) { + final segments = + line.trim().split(' ').where((segment) => segment != ' '); + final nextVersion = segments.last; + final currentVersion = + segments.lastWhere((segment) => segment.startsWith('*')).substring(1); + _logInfo('Changing DWDS pin from $currentVersion to $nextVersion'); + _replaceInFile( + File('../webdev/pubspec.yaml'), + query: currentVersion, + replaceWith: nextVersion, + ); + } + } +} + +void _logInfo(String message) { + stdout.writeln(message); +} + +void _logWarning(String warning) { + stderr.writeln(warning); +} + +extension JoinExtension on List { + String joinWithNewLine() { + return '${join('\n')}\n'; + } +} diff --git a/webdev/CONTRIBUTING.md b/webdev/CONTRIBUTING.md index a93f60aaf..9bafcd437 100644 --- a/webdev/CONTRIBUTING.md +++ b/webdev/CONTRIBUTING.md @@ -1,21 +1,14 @@ ## Instructions on releasing Webdev -- Make sure you are on the Dart stable SDK version (check with `dart --version`) -- Update the DWDS version in `/webdev/pubspec.yaml` to match the newly released - DWDS version, and update the Webdev version to the new version number. Also, - comment out the dependency_override so that Webdev is now depending on the - version of DWDS on pub (which should have just been published) instead of the - local version. -- Update `/webdev/CHANGELOG.md` to match the new webdev version -- From `/webdev`, run `dart pub upgrade` -- From `/webdev` run `dart run build_runner build`, this will build and update - the version in `webdev/lib/src/version.dart` -- Before submitting your PR, test that everything is working by following +- From the `/tool` directory in the mono-repo root, run: `dart run release.dart -p webdev` +- Open a PR with those changes (example PR: + https://github.com/dart-lang/webdev/pull/1498) +- Note: Before submitting your PR, test that everything is working by following instructions in the `webdev/example` [README](/example/README.md) to run the example app and connect to Dart DevTools. -- Submit a PR with those changes (example PR: - https://github.com/dart-lang/webdev/pull/1498) - Once the PR is submitted, pull from master and run `dart pub publish` -- Finally, go to https://github.com/dart-lang/webdev/releases and create a new - release, eg https://github.com/dart-lang/webdev/releases/tag/webdev-v2.7.8. - You might need to delete some of the content of the autogenerated notes. +- Go to https://github.com/dart-lang/webdev/releases and create a new + release, eg https://github.com/dart-lang/webdev/releases/tag/dwds-v12.0.0. You + might need to delete some of the content of the autogenerated notes. +- From the `/tool` directory in the mono-repo root, run: `dart run release.dart --reset -p webdev` +- Submit a PR with those changes. From 9a76e8940c8ab2ad625d60a275b705afffd5809a Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 23 Mar 2023 14:58:31 -0700 Subject: [PATCH 13/15] Add a pubspec file --- tool/pubspec.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tool/pubspec.yaml diff --git a/tool/pubspec.yaml b/tool/pubspec.yaml new file mode 100644 index 000000000..2e78f1363 --- /dev/null +++ b/tool/pubspec.yaml @@ -0,0 +1,9 @@ +name: tool +publish_to: none +description: >- + Common tools for the mono-repo. +environment: + sdk: ">=3.0.0-134.0.dev <4.0.0" + +dev_dependencies: + args: ^2.4.0 From f2edfd678adc0020a1ca39a0069044ca581254ce Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 23 Mar 2023 15:00:52 -0700 Subject: [PATCH 14/15] Delete unused file --- frontend_server_client/pubspec_overrides.yaml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 frontend_server_client/pubspec_overrides.yaml diff --git a/frontend_server_client/pubspec_overrides.yaml b/frontend_server_client/pubspec_overrides.yaml deleted file mode 100644 index 6a113c999..000000000 --- a/frontend_server_client/pubspec_overrides.yaml +++ /dev/null @@ -1,4 +0,0 @@ -dependency_overrides: - # Necessary to get a version solve until test_core allows version 3.x of - # this package - test_core: ^0.4.13 From af76818c5fe66d4b9f83539835a1ee7380ab7f10 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 23 Mar 2023 15:22:28 -0700 Subject: [PATCH 15/15] Respond to PR comments and cleanup --- dwds/CONTRIBUTING.md | 7 +++---- tool/release.dart | 3 ++- webdev/CONTRIBUTING.md | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dwds/CONTRIBUTING.md b/dwds/CONTRIBUTING.md index a76e3991d..a3ef4b322 100644 --- a/dwds/CONTRIBUTING.md +++ b/dwds/CONTRIBUTING.md @@ -85,10 +85,9 @@ the example app and connect to DWDS. - From the `/tool` directory in the mono-repo root, run: `dart run release.dart -p dwds` - Submit a PR with those changes (example PR: https://github.com/dart-lang/webdev/pull/1456) -- Once the PR is submitted, pull from master and run `dart pub publish` -- Go to https://github.com/dart-lang/webdev/releases and create a new - release, eg https://github.com/dart-lang/webdev/releases/tag/dwds-v12.0.0. You - might need to delete some of the content of the autogenerated notes. +- Once the PR is submitted, go to https://github.com/dart-lang/webdev/releases and create a new + release, eg https://github.com/dart-lang/webdev/releases/tag/dwds-v12.0.0. This should trigger + the auto-publisher. Verify that the package is published. - From the `/tool` directory in the mono-repo root, run: `dart run release.dart --reset -p dwds` - Submit a PR with those changes. diff --git a/tool/release.dart b/tool/release.dart index 73c4aa0ff..3c078328b 100644 --- a/tool/release.dart +++ b/tool/release.dart @@ -128,6 +128,7 @@ Future runRelease({ '../webdev', '../frontend_server_common', '../frontend_server_client', + '../test_common', ]) { _logInfo('Upgrading pub packages for $packagePath'); final pubUpgradeProcess = await Process.run( @@ -263,7 +264,7 @@ Future _updateDwdsPin(String package) async { segments.lastWhere((segment) => segment.startsWith('*')).substring(1); _logInfo('Changing DWDS pin from $currentVersion to $nextVersion'); _replaceInFile( - File('../webdev/pubspec.yaml'), + File('../$package/pubspec.yaml'), query: currentVersion, replaceWith: nextVersion, ); diff --git a/webdev/CONTRIBUTING.md b/webdev/CONTRIBUTING.md index 9bafcd437..7c652489b 100644 --- a/webdev/CONTRIBUTING.md +++ b/webdev/CONTRIBUTING.md @@ -6,9 +6,8 @@ - Note: Before submitting your PR, test that everything is working by following instructions in the `webdev/example` [README](/example/README.md) to run the example app and connect to Dart DevTools. -- Once the PR is submitted, pull from master and run `dart pub publish` -- Go to https://github.com/dart-lang/webdev/releases and create a new - release, eg https://github.com/dart-lang/webdev/releases/tag/dwds-v12.0.0. You - might need to delete some of the content of the autogenerated notes. +- Once the PR is submitted, go to https://github.com/dart-lang/webdev/releases and create a new + release, eg https://github.com/dart-lang/webdev/releases/tag/webdev-3.0.0. This should trigger + the auto-publisher. Verify that the package is published. - From the `/tool` directory in the mono-repo root, run: `dart run release.dart --reset -p webdev` - Submit a PR with those changes.