Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Jun 19, 2020

Description

Generates sound null safety code to resolve flutter/flutter#59792 . This is currently blocked by the dart:_engine migration to null safety. This is ready!

FYI @nshahan

Copy link
Contributor

@nshahan nshahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nit's but nothing blocking if this is working for you. My biggest question is about the kernel_worker.dart script and if it knows how to compile a sound .dill.

web_sdk/BUILD.gn Outdated
Comment on lines 8 to 10
sdk_dill = "$root_out_dir/flutter_web_sdk/kernel/flutter_ddc_sdk.dill"
sdk_dill_strong =
"$root_out_dir/flutter_web_sdk/kernel/flutter_ddc_sdk_strong.dill"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Rename to mirror the names used in the sdk: I'm in the process of renaming to be more consistent with other tools and avoid confusion between the full and outline dills.

flutter_ddc_outline.dill <-- (weak)
flutter_ddc_outline_sound.dill <-- (strong)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave any renames for later, we'd likely need to upload both though to google3 so all tools could update

web_sdk/BUILD.gn Outdated
args = [
"--enable-experiment=non-nullable",
"--sound-null-safety",
"-k",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: -k is no longer needed and is ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👆 I see what you did there.

web_sdk/BUILD.gn Outdated
}

# Compiles the DDC CanvasKit SDK's JS code for null safety.
prebuilt_dart_action("flutter_dartdevc_canvaskit_kernel_sdk_strong") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not a big deal but we've committed to the term "sound" going forward so I've been trying to use it everywhere we were saying "strong".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That SGTM, turns out we're still using strong in some places from the Dart 2 migration

web_sdk/BUILD.gn Outdated
args = [
"--enable-experiment=non-nullable",
"--sound-null-safety",
"-k",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


args = [
"--enable-experiment=non-nullable",
"--sound-null-safety ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the kernel_worker.dart script and I'm not using it when I build the .dill files in the sdk build target. Does it already support the --sound-null-safety flag? I didn't see it in the args in a quick search.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought It worked locally but I might have missed some flags. At any rate, everything still fails when compiling, I'll double check what dart_sdk is doing and update though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything seems to work OK

@jonahwilliams jonahwilliams changed the title [WIP][null-safety] rules for web [null-safety] updated rules to build sound dill/SDKs for web Jun 26, 2020
Copy link
Contributor

@nshahan nshahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more questions as I am trying to understand how the SDK gets compiled in js in flutter.

Comment on lines 33 to +34
":flutter_dartdevc_canvaskit_kernel_sdk",
":flutter_dartdevc_canvaskit_kernel_sdk_sound",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the canvaskit version need outlines?

web_sdk/BUILD.gn Outdated
# Compiles the DDC CanvasKit SDK's JS code for null safety.
prebuilt_dart_action("flutter_dartdevc_canvaskit_kernel_sdk_sound") {
deps = [
":flutter_dartdevc_kernel_sdk_outline_sound",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the outline dep for? I don't see it being passed as an arg.

In the SDK I use the full .dill to compile the js from .dill now.

If you do need it, should this outline be the canvaskit version just to be safe? I suppose we want the API to be the same but is it a guaranty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outlines are fed to the frontend_server for the hot reload cycle. We don't use them for building the precompiled SDK.

Their APIs should be the same since the only different is a define within the implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like I can remove the dep though, since it isn't used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the actual input given to DDC to compile the sdk? I don't see where we say use the sound vs unsound dill to compile the js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the source files are used directly, not the dills

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I should say that part of my question is rooted in the investigation I'm doing to try and figure out how DDC is being used to compile the sdk in all the different environments. Flutter web is the one I understand the least at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to discuss in person more if it helps. The compilation needs should be fairly similar to whatever the dart SDK is doing, and the current choice of scripts/args is more than likely historical rather than intentional.

web_sdk/BUILD.gn Outdated
# Compiles the DDC SDK's JS code for null safety.
prebuilt_dart_action("flutter_dartdevc_kernel_sdk_sound") {
deps = [
":flutter_dartdevc_kernel_sdk_outline_sound",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same questions here.

jonahwilliams pushed a commit that referenced this pull request Jun 29, 2020
Re-attempt at #19162 which seems to be stuck on a bad framework revision
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to produce strong/weak dill for non-nullable experiment/web
3 participants