Skip to content

dart2js flags are unnecessarily split up #169714

@fishythefish

Description

@fishythefish

See prior discussion at #134423.

Some arguments to dart2js are specified here:

/// Arguments to use in both phases: full JS compile and CFE-only.
List<String> toSharedCommandOptions(BuildMode buildMode) => <String>[
if (nativeNullAssertions) '--native-null-assertions',
if (!sourceMaps) '--no-source-maps',
if (buildMode == BuildMode.debug) '--enable-asserts',
'-O${optimizationLevelForBuildMode(buildMode)}',
];

And some are specified here:

/// Arguments to use in the full JS compile, but not CFE-only.
///
/// Includes the contents of [toSharedCommandOptions].
@override
List<String> toCommandOptions(BuildMode buildMode) => <String>[
if (minify ?? buildMode == BuildMode.release) '--minify' else '--no-minify',
...toSharedCommandOptions(buildMode),
if (dumpInfo) '--stage=dump-info-all',
if (noFrequencyBasedMinification) '--no-frequency-based-minification',
if (csp) '--csp',
];

This is error-prone as dart2js generally assumes its flags to be consistent across a sequential compilation (with the exception of flags like --stage which actually govern how the compilation is split up).

Metadata

Metadata

Assignees

Labels

platform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions