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

Migrate VM libraries to NNBD #38037

Closed
leafpetersen opened this issue Aug 27, 2019 · 15 comments
Closed

Migrate VM libraries to NNBD #38037

leafpetersen opened this issue Aug 27, 2019 · 15 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. Epic NNBD Issues related to NNBD Release vm-nnbd-unfork-sdk Label for all issues that need to be done before the nnbd sdk can be unforked
Milestone

Comments

@leafpetersen
Copy link
Member

This tracks the migration of the VM specific platform libraries to NNBD. Specifically, this covers the following libraries:

  • cli, ffi, developer, io, isolate, mirrors, profiler, vmservice
@leafpetersen leafpetersen added the area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. label Aug 27, 2019
@leafpetersen
Copy link
Member Author

@a-siva Is this on your radar? I think this makes most sense for the VM team to handle.

cc @lrhn

@a-siva
Copy link
Contributor

a-siva commented Aug 27, 2019

I had not considered this yet, I will have to add it to our list of things to do for nnbd.
Do you have a recipe for how libraries are being migrated to NNBD so I can have somebofy start on this in Q4.

@leafpetersen
Copy link
Member Author

We will shortly land a copy of sdk/sdk as sdk/sdk_nnbd . Migration will happen in place there. When we flip the experiment flag on by default, we can then unfork by copying over sdk_nnbd to sdk. In the meantime, we need to be be sure that any non-nnbd related changes go into both copies.

The migration itself might take advantage of the analyzer's migration tool where possible, but will also require somebody to just look at the APIs and make decisions about where to allow nullability, and then propagate that through the code.

cc @stereotype441

@lrhn
Copy link
Member

lrhn commented Aug 28, 2019

One important caveat is that the VM's patch files do not live in sdk/.
It might be a good idea to move them (and any other Dart code that the VM depends on) to be under the sdk/ directory, so that we can have two versions of those files as well.

@aadilmaan aadilmaan added the NNBD Issues related to NNBD Release label Sep 3, 2019
@a-siva a-siva self-assigned this Sep 13, 2019
@leafpetersen
Copy link
Member Author

@sortie I heard indirectly that you might be considering taking on io, is that correct?

@sortie
Copy link
Contributor

sortie commented Oct 14, 2019

@leafpetersen No, this is the first I hear about this. I did talk about Bob about migrating benchmarks, but that is another issue. I do currently own dart:io.

What would be involved in migrating such a library, or reviewing such changes?

@leafpetersen
Copy link
Member Author

Ah, maybe I was just told that you were taking over dart:io, and hence you might be the right person to talk to.

In any case, someone needs to migrate the copy of dart:io in sdk_nnbd. This means basically two things: first making the API choices about which things should be nullable, and secondly migrating the code to be null clean. I could show you how to run the analyzer on the code with the experiment enabled.

@dcharkes
Copy link
Contributor

I can take care of dart:ffi, most of the stuff should be not-nullable.

However, I'd like to only get started on this once we have some automated testing in place. Please keep me updated on the testing of the sdk_nnbd folder.

@sortie
Copy link
Contributor

sortie commented Oct 30, 2019

Hi @leafpetersen, can you describe the steps needed to migrate dart:io to nnbd?

@sortie
Copy link
Contributor

sortie commented Nov 6, 2019

Ping @leafpetersen

@leafpetersen
Copy link
Member Author

Thanks for looking into this!

The plan for the dart:core libraries is to go with the following workflow:

  • Migrate the libraries to pass the static analyzer (leave the patch files to the relevant teams)
  • Migrate the core library tests to statically analyze (fix any issues from step 1)
  • Get the core library tests running on each platform
    • This is blocked for each platform until the relevant team implements runtime support and migrates their patch files

I'd suggest that you might want to follow the same workflow. With that in mind, the first step is to make the API choices about what parameters/return types should be nullable vs non-nullable, and to get the code passing the static analyzer. You can run the analyzer on core libraries as follows:

xcodebuild/ReleaseX64/dart-sdk/bin/dartanalyzer --dart-sdk=/Users/leafp/src/dart-repo/sdk/sdk_nnbd/ --sdk-warnings --enable-experiment=non-nullable /Users/leafp/src/dart-repo/sdk/sdk_nnbd/lib/io

You will need to remove the // @ dart = 2.5 comments from the files in io to opt them into NNBD. Then you should see a mess of static errors from the above. :) At that point, you need to:

  • make choices for the APIs (does this method accept int or int?)?
  • fix the method bodies to pass the analyzer

Some example CLs showing how other core libraries were migrated:

Feel free to ping me, @munificent or @lrhn with questions about the NNBD features or whatever. Reviews can probably also be sent our way.

@leafpetersen
Copy link
Member Author

The current open list is:

lib/isolate
lib/wasm
lib/io
lib/cli
lib/mirrors
lib/vmservice
lib/ffi

I believe that @sortie owns io, @dcharkes can you start on ffi? The test infrastructure is in place, you will probably need to port your own tests though. @munificent can help with the process.

@leafpetersen
Copy link
Member Author

Migration instructions here.

@munificent
Copy link
Member

There are subissues here for the various VM libraries, but it's not clear how those libraries map to tests in the "tests" directory. Can someone confirm that these test directories are all fully covered by this issue:

standalone_2/
standalone_2/deferred
standalone_2/http_launch_data
standalone_2/io
standalone_2/package

We are migrating tests by forking all of them which means it's possible for tests to slip through the cracks if no one owns a directory. Will the VM team claim all of those?

@a-siva a-siva added the vm-nnbd-unfork-sdk Label for all issues that need to be done before the nnbd sdk can be unforked label Jan 16, 2020
@franklinyow franklinyow added this to the D28 Release milestone Jan 21, 2020
@a-siva
Copy link
Contributor

a-siva commented Feb 12, 2020

This is done, we have switched all the libraries to the NNBD versions in the NNBD sdk builds.

@a-siva a-siva closed this as completed Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. Epic NNBD Issues related to NNBD Release vm-nnbd-unfork-sdk Label for all issues that need to be done before the nnbd sdk can be unforked
Projects
None yet
Development

No branches or pull requests

8 participants