Coder Social home page Coder Social logo

Comments (6)

jensjoha avatar jensjoha commented on July 28, 2024

The idea of having a compile method where you call it with "oh, actually don't compile, but do run some other byproduct thing" seems weird.

For the one-off-run I think introducing a --native-only=<whateverFile> or something would make sense.
For the "stdin protocol" I think it would be cleaner to have a separate command.

from sdk.

dcharkes avatar dcharkes commented on July 28, 2024

That makes sense. 👍

I have no idea if we are ever in a situation where we would have two different byproducts that we want to compile in a single invocation. But assuming no, specifying byproduct-only makes more sense than not-main-thing.

Startup / single shot commandline API:

  • (already existing) --native-assets=<file> sets the side product for when compiling the full thing, either immediately or with subsequent compiles over the protocol.
  • (new option A) --native-assets-only (no file), should be supplied together with --native-assets=<file>
  • (new option B) --native-assets-only=<file>

The protocol

  • (already existing) native-assets <file> sets the side product for when compiling the full thing with subsequent compiles.
  • (new option A) native-assets-only after already having sent native-assets <file> before
  • (new option B) native-assets-only <file>

@jensjoha any preference for whether we add the <file> to native-assets-only, or whether it should be supplied with the already existing flag and command?

from sdk.

jensjoha avatar jensjoha commented on July 28, 2024

Already having --native-assets=<file> and native-assets <file> I suppose the native-assets-only without file makes more sense. I don't immediately have strong feelings about it though ;)

from sdk.

dcharkes avatar dcharkes commented on July 28, 2024

Already having --native-assets=<file> and native-assets <file> I suppose the native-assets-only without file makes more sense. I don't immediately have strong feelings about it though ;)

I had the same, not so strong, feelings. 👍

from sdk.

lrhn avatar lrhn commented on July 28, 2024

Compiling without an entry point could affect tree shaking (basically make it impossible, it has no root).
It's that a problem?

from sdk.

dcharkes avatar dcharkes commented on July 28, 2024

Compiling without an entry point could affect tree shaking (basically make it impossible, it has no root). It's that a problem?

"Compiling" is a bit of a strange word here. We're creating an encoding of the native_assets.yaml in a dart library.

/// Synthesizes a [Library] to be included in a kernel snapshot for the VM.
///
/// [nativeAssetsYaml] must have been validated with [NativeAssetsValidator].
///
/// The VM consumes this component in runtime/vm/ffi/native_assets.cc.
static Library synthesizeLibrary(
Map nativeAssetsYaml, {
nonNullableByDefaultCompiledMode = NonNullableByDefaultCompiledMode.Strong,
Class? pragmaClass,
}) {

And yes, this encoding only uses VM-recognized classes (list, string, map, and pragma), so that tree-shaking of the Dart program this special library is concatenated to can be read by the VM.

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.