Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to Dart 3 #990

Open
dave-doty opened this issue Sep 13, 2024 · 3 comments
Open

upgrade to Dart 3 #990

dave-doty opened this issue Sep 13, 2024 · 3 comments
Assignees
Labels
closed in dev Indicates issue is closed in the dev branch, available at: https://scadnano.org/dev/ enhancement New feature or request

Comments

@dave-doty
Copy link
Member

dave-doty commented Sep 13, 2024

Now that #419 is done (migrating to null safety mode using the latest Dart 2 version 2.19.6), that is the major difficulty in upgrading to Dart 3. But there still may be some issues since it's not backwards compatible. Follow the migration guide here:

https://dart.dev/resources/dart-3-migration

This issue is just just about the bare minimum to make scadnano work under Dart 3. Taking advantage of new features, e.g., records will be separate issues.

@dave-doty
Copy link
Member Author

dave-doty commented Sep 13, 2024

I've been running into massive trouble with getting build_runner to work (behind the scenes of webdev serve, and also this if I run it directly):

C:\Dropbox\git\scadnano>dart run build_runner build
Building package executable...
Built build_runner:build_runner.
[INFO] Generating build script completed, took 235ms
[INFO] Precompiling build script......Could not find a command named "C:\tools\dart-sdk\bin\snapshots\frontend_server.dart.snapshot".

Usage: dart <command|dart-file> [arguments]

Global options:
-v, --verbose               Show additional command output.
    --version               Print the Dart SDK version.
    --enable-analytics      Enable analytics.
    --disable-analytics     Disable analytics.
    --suppress-analytics    Disallow analytics for this `dart *` run without changing the analytics configuration.
-h, --help                  Print this usage information.

Available commands:
  analyze    Analyze Dart code in a directory.
  compile    Compile Dart to various formats.
  create     Create a new Dart project.
  devtools   Open DevTools (optionally connecting to an existing application).
  doc        Generate API documentation for Dart projects.
  fix        Apply automated fixes to Dart source code.
  format     Idiomatically format Dart source code.
  info       Show diagnostic information about the installed tooling.
  pub        Work with packages.
  run        Run a Dart program.
  test       Run tests for a project.

Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
[INFO] Precompiling build script... completed, took 103ms
[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.

Then I noticed this: https://github.com/Workiva/over_react/blob/master/pubspec.yaml, with the line sdk: '>=2.19.0 <3.0.0'

So it may be that OverReact simply doesn't support Dart 3 yet.

I did find this: dart-lang/sdk#55911 (comment), where they say

It looks to be because package: frontend_server_client is resolving to version 3.2.0 rather than 4.0.0 which added support for using the AOT snapshot

Indeed, we have frontend_server_client version 3.2.0, and if I try to upgrade to 4.0.0, it's not compatible with the version upper bounds of OverReact's other packages.

I'm a bit confused why we don't just get the much more straightforward dependency error that we have sdk: '>=3.5.02 <4.0.0' while OverReact has the conflicting sdk: '>=2.19.0 <3.0.0'. But it may be we have to wait for OverReact to update these dependencies.

@dave-doty
Copy link
Member Author

dave-doty commented Sep 14, 2024

I started to work on this in a branch, but I've since deleted the branch, since as my above comment says, we might have to wait for OverReact to upgrade to Dart 3.

I also noticed some errors in the dev branch (as of Sept 13, 2024) that had to do with not fully migrating to null safety. I accidentally left the comment // @dart=2.9 at the top of web/main.dart, which turned off some runtime checks and fooled me into thinking #419 was complete.

It should actually be good now that I fixed those errors, but I don't want to let the Dart 3 migration branch get more and more out of sync with dev. So I just put some of the Dart 3 compatible changes in dev directly (mostly switching a few abstract classes to mixins to deal with this issue), and hopefully it will be straightforward to migrate to Dart 3 when OverReact updates.

@dave-doty
Copy link
Member Author

Looks like OverReact officially supports Dart 3 now: https://pub.dev/packages/over_react/changelog

But let's look at the comments here to see if there is another issue we'll need to confront when upgrading, perhaps it was not due to OverReact's version upper bounds: Workiva/over_react#947 (comment)

@dave-doty dave-doty self-assigned this Oct 23, 2024
@dave-doty dave-doty added the enhancement New feature or request label Oct 23, 2024
@dave-doty dave-doty assigned beanbeanjuice and unassigned dave-doty Oct 25, 2024
beanbeanjuice added a commit that referenced this issue Dec 8, 2024
@beanbeanjuice beanbeanjuice added the closed in dev Indicates issue is closed in the dev branch, available at: https://scadnano.org/dev/ label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed in dev Indicates issue is closed in the dev branch, available at: https://scadnano.org/dev/ enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants