[vm] Remove (unused & deprecated) --package-root parameter from VM binaries and from tests (Platform.packageRoot always returns null)

Closes https://github.com/dart-lang/sdk/issues/41245

Change-Id: Idd7526199b4c2479297c58b05bc13efcb79d01e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152321
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Martin Kustermann 2020-06-24 18:17:53 +00:00 committed by commit-bot@chromium.org
parent a1078d23c0
commit 39577ea564
9 changed files with 5 additions and 79 deletions

View file

@ -848,12 +848,6 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) {
Dart_IsolateFlags flags;
Dart_IsolateFlagsInitialize(&flags);
if (Options::package_root() != nullptr) {
Syslog::PrintErr(
"Warning: The --package-root option is deprecated (was: %s)\n",
Options::package_root());
}
Dart_Isolate isolate = CreateIsolateGroupAndSetupHelper(
is_main_isolate, script_name, "main", Options::packages_file(), &flags,
NULL /* callback_data */, &error, &exit_code);

View file

@ -145,8 +145,6 @@ void Options::PrintUsage() {
"--help or -h\n"
" Display this message (add -v or --verbose for information about\n"
" all VM options).\n"
"--package-root=<path> or -p<path>\n"
" Where to find packages, that is, \"package:...\" imports.\n"
"--packages=<path>\n"
" Where to find a package spec file.\n"
"--observe[=<port>[/<bind-address>]]\n"
@ -180,8 +178,6 @@ void Options::PrintUsage() {
"--help or -h\n"
" Display this message (add -v or --verbose for information about\n"
" all VM options).\n"
"--package-root=<path> or -p<path>\n"
" Where to find packages, that is, \"package:...\" imports.\n"
"--packages=<path>\n"
" Where to find a package spec file.\n"
"--observe[=<port>[/<bind-address>]]\n"
@ -659,17 +655,6 @@ int Options::ParseArguments(int argc,
snapshot_deps_filename_ = NULL;
}
if ((Options::package_root() != NULL) && (packages_file_ != NULL)) {
Syslog::PrintErr(
"Specifying both a packages directory and a packages "
"file is invalid.\n");
return -1;
}
if ((Options::package_root() != NULL) &&
(strlen(Options::package_root()) == 0)) {
Syslog::PrintErr("Empty package root specified.\n");
return -1;
}
if ((packages_file_ != NULL) && (strlen(packages_file_) == 0)) {
Syslog::PrintErr("Empty package file name specified.\n");
return -1;

View file

@ -19,7 +19,6 @@ namespace bin {
// The value of the flag can then be accessed with Options::field_name().
#define STRING_OPTIONS_LIST(V) \
V(packages, packages_file) \
V(package_root, package_root) \
V(snapshot, snapshot_filename) \
V(snapshot_depfile, snapshot_deps_filename) \
V(depfile, depfile) \

View file

@ -68,11 +68,6 @@ def BuildOptions():
action="store",
type="string",
help="Dart script for which snapshot is to be generated")
result.add_option(
"--package_root",
action="store",
type="string",
help="path used to resolve package: imports.")
result.add_option(
"--packages",
action="store",
@ -148,10 +143,6 @@ def Main():
script_args.append(''.join(
["--load_compilation_trace=", options.load_compilation_trace]))
# Pass along the package_root if there is one.
if options.package_root:
script_args.append(''.join(["--package_root=", options.package_root]))
# Pass along the packages if there is one.
if options.packages:
script_args.append(''.join(["--packages=", options.packages]))

View file

@ -14,9 +14,7 @@ final dartRootDir = path.dirname(path.dirname(execDir));
final dartRootPath = dartRootDir.toString();
List<String> packageOptions() {
if (Platform.packageRoot != null) {
return <String>['--package-root=${Platform.packageRoot}'];
} else if (Platform.packageConfig != null) {
if (Platform.packageConfig != null) {
return <String>['--packages=${Platform.packageConfig}'];
} else {
return <String>[];

View file

@ -49,29 +49,12 @@ test() {
Expect.isTrue(
Platform.script.path.endsWith('tests/standalone/io/platform_test.dart'));
Expect.isTrue(Platform.script.toFilePath().startsWith(oldDir.path));
// Restore dir.
Directory.current = oldDir;
var pkgRootString = Platform.packageRoot;
if (pkgRootString != null) {
Directory packageRoot = new Directory.fromUri(Uri.parse(pkgRootString));
Expect.isTrue(packageRoot.existsSync());
Expect.isTrue(new Directory("${packageRoot.path}/expect").existsSync());
Expect.isTrue(Platform.executableArguments.any((arg) {
if (!arg.startsWith("--package-root=")) {
return false;
}
// Cut out the '--package-root=' prefix.
arg = arg.substring(15);
return pkgRootString.contains(arg);
}));
}
}
void f(reply) {
reply.send({
"Platform.executable": Platform.executable,
"Platform.script": Platform.script,
"Platform.packageRoot": Platform.packageRoot,
"Platform.executableArguments": Platform.executableArguments
});
}
@ -88,7 +71,6 @@ testIsolate() {
// case was a relative path.
Expect.equals("file", uri.scheme);
Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart'));
Expect.equals(Platform.packageRoot, results["Platform.packageRoot"]);
Expect.listEquals(
Platform.executableArguments, results["Platform.executableArguments"]);
asyncEnd();

View file

@ -67,10 +67,7 @@ serverRunning(HttpServer server) {
pathToExecutable,
[]
..addAll(executableArguments)
..addAll([
'--package-root=http://127.0.0.1:$port/the_packages/',
'http://127.0.0.1:$port/http_launch_main.dart'
]));
..addAll(['http://127.0.0.1:$port/http_launch_main.dart']));
Future<ProcessResult> isolate_run = Process.run(
pathToExecutable,
[]

View file

@ -14,9 +14,7 @@ final dartRootDir = path.dirname(path.dirname(execDir));
final dartRootPath = dartRootDir.toString();
List<String> packageOptions() {
if (Platform.packageRoot != null) {
return <String>['--package-root=${Platform.packageRoot}'];
} else if (Platform.packageConfig != null) {
if (Platform.packageConfig != null) {
return <String>['--packages=${Platform.packageConfig}'];
} else {
return <String>[];

View file

@ -49,29 +49,12 @@ test() {
Expect.isTrue(Platform.script.path
.endsWith('tests/standalone_2/io/platform_test.dart'));
Expect.isTrue(Platform.script.toFilePath().startsWith(oldDir.path));
// Restore dir.
Directory.current = oldDir;
var pkgRootString = Platform.packageRoot;
if (pkgRootString != null) {
Directory packageRoot = new Directory.fromUri(Uri.parse(pkgRootString));
Expect.isTrue(packageRoot.existsSync());
Expect.isTrue(new Directory("${packageRoot.path}/expect").existsSync());
Expect.isTrue(Platform.executableArguments.any((arg) {
if (!arg.startsWith("--package-root=")) {
return false;
}
// Cut out the '--package-root=' prefix.
arg = arg.substring(15);
return pkgRootString.contains(arg);
}));
}
}
void f(reply) {
reply.send({
"Platform.executable": Platform.executable,
"Platform.script": Platform.script,
"Platform.packageRoot": Platform.packageRoot,
"Platform.executableArguments": Platform.executableArguments
});
}
@ -87,9 +70,8 @@ testIsolate() {
// SpawnFunction retains the script url of the parent which in this
// case was a relative path.
Expect.equals("file", uri.scheme);
Expect
.isTrue(uri.path.endsWith('tests/standalone_2/io/platform_test.dart'));
Expect.equals(Platform.packageRoot, results["Platform.packageRoot"]);
Expect.isTrue(
uri.path.endsWith('tests/standalone_2/io/platform_test.dart'));
Expect.listEquals(
Platform.executableArguments, results["Platform.executableArguments"]);
asyncEnd();