From fd9f8c876ba8cb16e8425eac0bfefa4f31871d44 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Mon, 30 Oct 2023 12:46:49 -0500 Subject: [PATCH] chore: Update to Dart >3.0.0 (#85) Also updates to common dependency versions through Melos. --- melos.yaml | 28 +++++++++++++++++++ packages/benchmark/README.md | 9 +++++- packages/benchmark/pubspec.yaml | 4 +-- packages/forge2d/example/pubspec.yaml | 8 +++--- packages/forge2d/example/web/demo.dart | 3 +- packages/forge2d/example/web/domino_test.dart | 4 +-- packages/forge2d/pubspec.yaml | 12 ++++---- pubspec.yaml | 4 +-- 8 files changed, 53 insertions(+), 19 deletions(-) diff --git a/melos.yaml b/melos.yaml index c1bdc773..e4d49cf6 100644 --- a/melos.yaml +++ b/melos.yaml @@ -13,6 +13,19 @@ command: linkToCommits: true # Only allow versioning to happen on main branch. branch: main + environment: + sdk: ">=3.0.0 <4.0.0" + bootstrap: + environment: + sdk: ">=3.0.0 <4.0.0" + dependencies: + meta: ^1.11.0 + vector_math: ^2.1.4 + dev_dependencies: + dartdoc: ^7.0.2 + flame_lint: ^1.1.1 + mocktail: ^1.0.1 + test: ^1.24.9 scripts: lint:all: @@ -54,3 +67,18 @@ scripts: packageFilters: dirExists: test description: Generate coverage for the selected package. + + benchmark: + run: melos exec -- dart web/bench2d.dart + packageFilters: + scope: forge2d_benchmark + + benchmark_serve: + run: melos exec -- dart pub global run webdev serve --release + packageFilters: + scope: forge2d_benchmark + + example: + run: melos exec -- dart pub global run webdev serve --release + packageFilters: + scope: forge2d_examples \ No newline at end of file diff --git a/packages/benchmark/README.md b/packages/benchmark/README.md index 8ff0b2b5..1ad259f3 100644 --- a/packages/benchmark/README.md +++ b/packages/benchmark/README.md @@ -2,10 +2,17 @@ ## In a browser ```sh -pub global run webdev serve --release +dart pub global run webdev serve --release ``` And then go to http://127.0.0.1:8080 +Note: remember that you need the `webdev` package to do this, install it like +this: + +```sh +dart pub global activate webdev +``` + ## In the terminal ```sh dart web/bench2d.dart diff --git a/packages/benchmark/pubspec.yaml b/packages/benchmark/pubspec.yaml index b149dee1..f616c677 100644 --- a/packages/benchmark/pubspec.yaml +++ b/packages/benchmark/pubspec.yaml @@ -6,7 +6,7 @@ version: 1.0.0+1 publish_to: 'none' environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: build_runner: ^2.4.5 @@ -14,4 +14,4 @@ dependencies: forge2d: ^0.11.0 dev_dependencies: - flame_lint: ^1.0.0 + flame_lint: ^1.1.1 diff --git a/packages/forge2d/example/pubspec.yaml b/packages/forge2d/example/pubspec.yaml index 36b9559a..a4b2353d 100644 --- a/packages/forge2d/example/pubspec.yaml +++ b/packages/forge2d/example/pubspec.yaml @@ -6,12 +6,12 @@ version: 1.0.0+1 publish_to: 'none' environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: - build_runner: ^2.4.5 - build_web_compilers: ^4.0.3 forge2d: ^0.11.0 dev_dependencies: - flame_lint: ^1.0.0 + build_runner: ^2.4.5 + build_web_compilers: ^4.0.4 + flame_lint: ^1.1.1 diff --git a/packages/forge2d/example/web/demo.dart b/packages/forge2d/example/web/demo.dart index 4991d349..6edfadee 100644 --- a/packages/forge2d/example/web/demo.dart +++ b/packages/forge2d/example/web/demo.dart @@ -43,7 +43,7 @@ abstract class Demo { late final DebugDraw debugDraw; /// Frame count for fps - late final int frameCount; + int frameCount = 0; /// HTML element used to display the FPS counter late final Element fpsCounter; @@ -96,7 +96,6 @@ abstract class Demo { // Have the world draw itself for debugging purposes. world.debugDraw = debugDraw; - frameCount = 0; fpsCounter = querySelector('#fps-counter')!; worldStepTime = querySelector('#world-step-time')!; Timer.periodic(const Duration(seconds: 1), (Timer t) { diff --git a/packages/forge2d/example/web/domino_test.dart b/packages/forge2d/example/web/domino_test.dart index 463e944c..12e052e0 100644 --- a/packages/forge2d/example/web/domino_test.dart +++ b/packages/forge2d/example/web/domino_test.dart @@ -11,7 +11,7 @@ class DominoTest extends Demo { { // Floor final shape = PolygonShape()..setAsBoxXY(50.0, 10.0); - final fixtureDef = FixtureDef(shape); + final fixtureDef = FixtureDef(shape)..friction = 0.1; final bd = BodyDef(); bd.position = Vector2(0.0, -10.0); @@ -24,7 +24,7 @@ class DominoTest extends Demo { // Platforms for (var i = 0; i < 4; i++) { final shape = PolygonShape()..setAsBoxXY(15.0, 0.125); - final fixtureDef = FixtureDef(shape); + final fixtureDef = FixtureDef(shape)..friction = 0.1; final bodyDef = BodyDef()..position = Vector2(0.0, 5.0 + 5 * i); final body = world.createBody(bodyDef); diff --git a/packages/forge2d/pubspec.yaml b/packages/forge2d/pubspec.yaml index b5f99240..c272aba5 100644 --- a/packages/forge2d/pubspec.yaml +++ b/packages/forge2d/pubspec.yaml @@ -4,14 +4,14 @@ description: A 2D physics engine for Dart (based on Box2D), also works with the homepage: https://github.com/flame-engine/forge2d environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: - meta: ^1.9.1 + meta: ^1.11.0 vector_math: ^2.1.4 dev_dependencies: - dartdoc: ^6.3.0 - flame_lint: ^1.0.0 - mocktail: ^0.3.0 - test: ^1.24.3 + dartdoc: ^7.0.2 + flame_lint: ^1.1.1 + mocktail: ^1.0.1 + test: ^1.24.9 diff --git a/pubspec.yaml b/pubspec.yaml index 9873067d..1c98e910 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: forge2d_workspace environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dev_dependencies: - melos: ^3.0.0 + melos: ^3.2.0