• Tess Strickland's avatar
    Use `--target-os` for appropriate precompiled targets. (#127567) · 840d7dd6
    Tess Strickland authored
    This PR adds uses of the `--target-os` command line argument when
    building kernel sources for precompiled applications for supported
    target operating systems. The Dart CFE then:
    
    * treats `Platform.operatingSystem` as if it were defined as the
    constant string provided as an argument to the flag,
    * treats `Platform.pathSeparator` as the appropriate separator for that
    operating system,
    * attempts to constant evaluate the initializer for any field annotated
    with the `vm:platform-const` pragma, and
    * attempts to constant evaluate all calls to a method annotated with the
    `vm:platform-const` pragma.
    
    The `vm:platform-const` pragma can appear in either library or user
    code. If the attempt to constant evaluate the field initializer or
    method call fails, then an error is thrown at kernel compilation time.
    
    Addresses #14233.
    
    The tests in
    `packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart`
    have been adjusted properly to account for the new passed command line
    arguments.
    840d7dd6
common.dart 15.7 KB