[dart2js]: require dart2js to be invoked from an approved CLI

The dart2js snapshot is not meant to be invoked directly except from
a limited set of entry points (CLIs and internal build systems).
This change makes it an error to invoke it in unsupported ways.

Note: this change is not expected to be visible to end users.

Fixes #51695

Change-Id: I4013dd00b90bb3d54483e2f112e0ddfb8dc694e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289885
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem
2023-03-23 01:58:58 +00:00
committed by Commit Queue
parent 9231c6182c
commit f72782ce9b
5 changed files with 31 additions and 7 deletions
+1
View File
@@ -63,6 +63,7 @@ application_snapshot("dart2js") {
vm_args = []
main_dart = "$target_gen_dir/dart2js.dart"
training_args = [
"--invoker=gn_build",
"--packages=" +
rebase_path("../../.dart_tool/package_config.json", root_build_dir),
"--libraries-spec=" +
+1
View File
@@ -78,6 +78,7 @@ template("dart2js_compile") {
args = [
"$abs_main",
"-m",
"--invoker=gn_build",
"-o$abs_output",
"--no-source-maps",
"--platform-binaries=" + rebase_path("$root_out_dir"),