Unverified Commit 51ededb9 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] reland: map file URIs to a multiroot scheme (#66405)

If a file scheme and one or more roots is provided, fall back to this mapping before the direct file path if the file path cannot be turned into a package URI.

Use URI representation so that the transformation is resilient to the org-dartlang-app scheme used by the web builds.

Fixes #66095
Fixes #66404
parent 6b39acdc
...@@ -198,6 +198,8 @@ class KernelSnapshot extends Target { ...@@ -198,6 +198,8 @@ class KernelSnapshot extends Target {
logger: environment.logger, logger: environment.logger,
processManager: environment.processManager, processManager: environment.processManager,
artifacts: environment.artifacts, artifacts: environment.artifacts,
fileSystemRoots: <String>[],
fileSystemScheme: null,
); );
if (environment.defines[kBuildMode] == null) { if (environment.defines[kBuildMode] == null) {
throw MissingDefineException(kBuildMode, 'kernel_snapshot'); throw MissingDefineException(kBuildMode, 'kernel_snapshot');
......
...@@ -385,6 +385,7 @@ class AttachCommand extends FlutterCommand { ...@@ -385,6 +385,7 @@ class AttachCommand extends FlutterCommand {
targetModel: TargetModel(stringArg('target-model')), targetModel: TargetModel(stringArg('target-model')),
buildInfo: getBuildInfo(), buildInfo: getBuildInfo(),
userIdentifier: userIdentifier, userIdentifier: userIdentifier,
platform: globals.platform,
); );
flutterDevice.observatoryUris = observatoryUris; flutterDevice.observatoryUris = observatoryUris;
final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice]; final List<FlutterDevice> flutterDevices = <FlutterDevice>[flutterDevice];
......
...@@ -470,6 +470,7 @@ class AppDomain extends Domain { ...@@ -470,6 +470,7 @@ class AppDomain extends Domain {
flutterProject: flutterProject, flutterProject: flutterProject,
target: target, target: target,
buildInfo: options.buildInfo, buildInfo: options.buildInfo,
platform: globals.platform,
); );
ResidentRunner runner; ResidentRunner runner;
......
...@@ -199,6 +199,7 @@ class DriveCommand extends RunCommandBase { ...@@ -199,6 +199,7 @@ class DriveCommand extends RunCommandBase {
flutterProject: flutterProject, flutterProject: flutterProject,
target: targetFile, target: targetFile,
buildInfo: buildInfo, buildInfo: buildInfo,
platform: globals.platform,
); );
residentRunner = webRunnerFactory.createWebRunner( residentRunner = webRunnerFactory.createWebRunner(
flutterDevice, flutterDevice,
......
...@@ -531,6 +531,7 @@ class RunCommand extends RunCommandBase { ...@@ -531,6 +531,7 @@ class RunCommand extends RunCommandBase {
target: stringArg('target'), target: stringArg('target'),
buildInfo: getBuildInfo(), buildInfo: getBuildInfo(),
userIdentifier: userIdentifier, userIdentifier: userIdentifier,
platform: globals.platform,
), ),
]; ];
// Only support "web mode" with a single web device due to resident runner // Only support "web mode" with a single web device due to resident runner
......
...@@ -11,42 +11,13 @@ import 'package:usage/uuid/uuid.dart'; ...@@ -11,42 +11,13 @@ import 'package:usage/uuid/uuid.dart';
import 'artifacts.dart'; import 'artifacts.dart';
import 'base/common.dart'; import 'base/common.dart';
import 'base/context.dart';
import 'base/file_system.dart'; import 'base/file_system.dart';
import 'base/io.dart'; import 'base/io.dart';
import 'base/logger.dart'; import 'base/logger.dart';
import 'base/platform.dart';
import 'build_info.dart'; import 'build_info.dart';
import 'convert.dart'; import 'convert.dart';
import 'globals.dart' as globals; import 'globals.dart' as globals;
import 'project.dart';
KernelCompilerFactory get kernelCompilerFactory => context.get<KernelCompilerFactory>();
class KernelCompilerFactory {
const KernelCompilerFactory({
@required FileSystem fileSystem,
@required Artifacts artifacts,
@required ProcessManager processManager,
@required Logger logger,
}) : _fileSystem = fileSystem,
_artifacts = artifacts,
_processManager = processManager,
_logger = logger;
final Logger _logger;
final Artifacts _artifacts;
final ProcessManager _processManager;
final FileSystem _fileSystem;
Future<KernelCompiler> create(FlutterProject flutterProject) async {
return KernelCompiler(
logger: _logger,
artifacts: _artifacts,
fileSystem: _fileSystem,
processManager: _processManager,
);
}
}
/// The target model describes the set of core libraries that are available within /// The target model describes the set of core libraries that are available within
/// the SDK. /// the SDK.
...@@ -204,19 +175,25 @@ List<String> buildModeOptions(BuildMode mode) { ...@@ -204,19 +175,25 @@ List<String> buildModeOptions(BuildMode mode) {
/// A compiler interface for producing single (non-incremental) kernel files. /// A compiler interface for producing single (non-incremental) kernel files.
class KernelCompiler { class KernelCompiler {
KernelCompiler({ KernelCompiler({
FileSystem fileSystem, // TODO(jonahwilliams): migrate to @required after google3 @required FileSystem fileSystem,
Logger logger, // TODO(jonahwilliams): migrate to @required after google3 @required Logger logger,
ProcessManager processManager, // TODO(jonahwilliams): migrate to @required after google3 @required ProcessManager processManager,
Artifacts artifacts, // TODO(jonahwilliams): migrate to @required after google3 @required Artifacts artifacts,
}) : _logger = logger ?? globals.logger, @required List<String> fileSystemRoots,
_fileSystem = fileSystem ?? globals.fs, @required String fileSystemScheme,
_artifacts = artifacts ?? globals.artifacts, }) : _logger = logger,
_processManager = processManager ?? globals.processManager; _fileSystem = fileSystem,
_artifacts = artifacts,
_processManager = processManager,
_fileSystemScheme = fileSystemScheme,
_fileSystemRoots = fileSystemRoots;
final FileSystem _fileSystem; final FileSystem _fileSystem;
final Artifacts _artifacts; final Artifacts _artifacts;
final ProcessManager _processManager; final ProcessManager _processManager;
final Logger _logger; final Logger _logger;
final String _fileSystemScheme;
final List<String> _fileSystemRoots;
Future<CompilerOutput> compile({ Future<CompilerOutput> compile({
String sdkRoot, String sdkRoot,
...@@ -248,10 +225,12 @@ class KernelCompiler { ...@@ -248,10 +225,12 @@ class KernelCompiler {
if (!_processManager.canRun(engineDartPath)) { if (!_processManager.canRun(engineDartPath)) {
throwToolExit('Unable to find Dart binary at $engineDartPath'); throwToolExit('Unable to find Dart binary at $engineDartPath');
} }
Uri mainUri; String mainUri;
final Uri mainFileUri = _fileSystem.file(mainPath).uri;
if (packagesPath != null) { if (packagesPath != null) {
mainUri = packageConfig.toPackageUri(_fileSystem.file(mainPath).uri); mainUri = packageConfig.toPackageUri(mainFileUri)?.toString();
} }
mainUri ??= toMultiRootPath(mainFileUri, _fileSystemScheme, _fileSystemRoots, _fileSystem.path.separator == r'\');
if (outputFilePath != null && !_fileSystem.isFileSync(outputFilePath)) { if (outputFilePath != null && !_fileSystem.isFileSync(outputFilePath)) {
_fileSystem.file(outputFilePath).createSync(recursive: true); _fileSystem.file(outputFilePath).createSync(recursive: true);
} }
...@@ -302,7 +281,7 @@ class KernelCompiler { ...@@ -302,7 +281,7 @@ class KernelCompiler {
platformDill, platformDill,
], ],
...?extraFrontEndOptions, ...?extraFrontEndOptions,
mainUri?.toString() ?? mainPath, mainUri ?? mainPath,
]; ];
_logger.printTrace(command.join(' ')); _logger.printTrace(command.join(' '));
...@@ -436,6 +415,7 @@ abstract class ResidentCompiler { ...@@ -436,6 +415,7 @@ abstract class ResidentCompiler {
String platformDill, String platformDill,
List<String> dartDefines, List<String> dartDefines,
String librariesSpec, String librariesSpec,
@required Platform platform,
// Deprecated // Deprecated
List<String> experimentalFlags, List<String> experimentalFlags,
}) = DefaultResidentCompiler; }) = DefaultResidentCompiler;
...@@ -522,6 +502,7 @@ class DefaultResidentCompiler implements ResidentCompiler { ...@@ -522,6 +502,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
DefaultResidentCompiler( DefaultResidentCompiler(
String sdkRoot, { String sdkRoot, {
@required this.buildMode, @required this.buildMode,
@required Platform platform,
Logger logger, // TODO(jonahwilliams): migrate to @required after google3 Logger logger, // TODO(jonahwilliams): migrate to @required after google3
ProcessManager processManager, // TODO(jonahwilliams): migrate to @required after google3 ProcessManager processManager, // TODO(jonahwilliams): migrate to @required after google3
Artifacts artifacts, // TODO(jonahwilliams): migrate to @required after google3 Artifacts artifacts, // TODO(jonahwilliams): migrate to @required after google3
...@@ -543,6 +524,7 @@ class DefaultResidentCompiler implements ResidentCompiler { ...@@ -543,6 +524,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
_processManager = processManager ?? globals.processManager, _processManager = processManager ?? globals.processManager,
_artifacts = artifacts ?? globals.artifacts, _artifacts = artifacts ?? globals.artifacts,
_stdoutHandler = StdoutHandler(logger: logger), _stdoutHandler = StdoutHandler(logger: logger),
_platform = platform,
dartDefines = dartDefines ?? const <String>[], dartDefines = dartDefines ?? const <String>[],
// This is a URI, not a file path, so the forward slash is correct even on Windows. // This is a URI, not a file path, so the forward slash is correct even on Windows.
sdkRoot = sdkRoot.endsWith('/') ? sdkRoot : '$sdkRoot/'; sdkRoot = sdkRoot.endsWith('/') ? sdkRoot : '$sdkRoot/';
...@@ -550,6 +532,7 @@ class DefaultResidentCompiler implements ResidentCompiler { ...@@ -550,6 +532,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
final Logger _logger; final Logger _logger;
final ProcessManager _processManager; final ProcessManager _processManager;
final Artifacts _artifacts; final Artifacts _artifacts;
final Platform _platform;
final BuildMode buildMode; final BuildMode buildMode;
final bool trackWidgetCreation; final bool trackWidgetCreation;
...@@ -616,8 +599,9 @@ class DefaultResidentCompiler implements ResidentCompiler { ...@@ -616,8 +599,9 @@ class DefaultResidentCompiler implements ResidentCompiler {
); );
} }
final String inputKey = Uuid().generateV4(); final String inputKey = Uuid().generateV4();
final String mainUri = request.packageConfig.toPackageUri(request.mainUri)?.toString() final String mainUri = request.packageConfig.toPackageUri(request.mainUri)?.toString() ??
?? request.mainUri.toString(); toMultiRootPath(request.mainUri, fileSystemScheme, fileSystemRoots, _platform.isWindows);
_server.stdin.writeln('recompile $mainUri $inputKey'); _server.stdin.writeln('recompile $mainUri $inputKey');
_logger.printTrace('<- recompile $mainUri $inputKey'); _logger.printTrace('<- recompile $mainUri $inputKey');
for (final Uri fileUri in request.invalidatedFiles) { for (final Uri fileUri in request.invalidatedFiles) {
...@@ -625,11 +609,11 @@ class DefaultResidentCompiler implements ResidentCompiler { ...@@ -625,11 +609,11 @@ class DefaultResidentCompiler implements ResidentCompiler {
if (fileUri.scheme == 'package') { if (fileUri.scheme == 'package') {
message = fileUri.toString(); message = fileUri.toString();
} else { } else {
message = request.packageConfig.toPackageUri(fileUri)?.toString() message = request.packageConfig.toPackageUri(fileUri)?.toString() ??
?? fileUri.toString(); toMultiRootPath(request.mainUri, fileSystemScheme, fileSystemRoots, _platform.isWindows);
} }
_server.stdin.writeln(message); _server.stdin.writeln(message);
_logger.printTrace(message); _logger.printTrace(message.toString());
} }
_server.stdin.writeln(inputKey); _server.stdin.writeln(inputKey);
_logger.printTrace('<- $inputKey'); _logger.printTrace('<- $inputKey');
...@@ -889,3 +873,19 @@ class DefaultResidentCompiler implements ResidentCompiler { ...@@ -889,3 +873,19 @@ class DefaultResidentCompiler implements ResidentCompiler {
return _server.exitCode; return _server.exitCode;
} }
} }
/// Convert a file URI into a multiroot scheme URI if provided, otherwise
/// return unmodified.
@visibleForTesting
String toMultiRootPath(Uri fileUri, String scheme, List<String> fileSystemRoots, bool windows) {
if (scheme == null || fileSystemRoots.isEmpty || fileUri.scheme != 'file') {
return fileUri.toString();
}
final String filePath = fileUri.toFilePath(windows: windows);
for (final String fileSystemRoot in fileSystemRoots) {
if (filePath.startsWith(fileSystemRoot)) {
return scheme + '://' + filePath.substring(fileSystemRoot.length);
}
}
return fileUri.toString();
}
...@@ -25,7 +25,6 @@ import 'base/user_messages.dart'; ...@@ -25,7 +25,6 @@ import 'base/user_messages.dart';
import 'build_info.dart'; import 'build_info.dart';
import 'build_system/build_system.dart'; import 'build_system/build_system.dart';
import 'cache.dart'; import 'cache.dart';
import 'compile.dart';
import 'dart/pub.dart'; import 'dart/pub.dart';
import 'devfs.dart'; import 'devfs.dart';
import 'device.dart'; import 'device.dart';
...@@ -181,12 +180,6 @@ Future<T> runInContext<T>( ...@@ -181,12 +180,6 @@ Future<T> runInContext<T>(
xcode: globals.xcode, xcode: globals.xcode,
platform: globals.platform, platform: globals.platform,
), ),
KernelCompilerFactory: () => KernelCompilerFactory(
logger: globals.logger,
processManager: globals.processManager,
artifacts: globals.artifacts,
fileSystem: globals.fs,
),
Logger: () => globals.platform.isWindows Logger: () => globals.platform.isWindows
? WindowsStdoutLogger( ? WindowsStdoutLogger(
terminal: globals.terminal, terminal: globals.terminal,
......
...@@ -18,6 +18,7 @@ import 'base/context.dart'; ...@@ -18,6 +18,7 @@ import 'base/context.dart';
import 'base/file_system.dart'; import 'base/file_system.dart';
import 'base/io.dart' as io; import 'base/io.dart' as io;
import 'base/logger.dart'; import 'base/logger.dart';
import 'base/platform.dart';
import 'base/signals.dart'; import 'base/signals.dart';
import 'base/utils.dart'; import 'base/utils.dart';
import 'build_info.dart'; import 'build_info.dart';
...@@ -63,6 +64,7 @@ class FlutterDevice { ...@@ -63,6 +64,7 @@ class FlutterDevice {
artifacts: globals.artifacts, artifacts: globals.artifacts,
processManager: globals.processManager, processManager: globals.processManager,
logger: globals.logger, logger: globals.logger,
platform: globals.platform,
); );
/// Create a [FlutterDevice] with optional code generation enabled. /// Create a [FlutterDevice] with optional code generation enabled.
...@@ -71,6 +73,7 @@ class FlutterDevice { ...@@ -71,6 +73,7 @@ class FlutterDevice {
@required FlutterProject flutterProject, @required FlutterProject flutterProject,
@required String target, @required String target,
@required BuildInfo buildInfo, @required BuildInfo buildInfo,
@required Platform platform,
List<String> fileSystemRoots, List<String> fileSystemRoots,
String fileSystemScheme, String fileSystemScheme,
TargetModel targetModel = TargetModel.flutter, TargetModel targetModel = TargetModel.flutter,
...@@ -129,6 +132,7 @@ class FlutterDevice { ...@@ -129,6 +132,7 @@ class FlutterDevice {
artifacts: globals.artifacts, artifacts: globals.artifacts,
processManager: globals.processManager, processManager: globals.processManager,
logger: globals.logger, logger: globals.logger,
platform: platform,
); );
} else { } else {
// The flutter-widget-cache feature only applies to run mode. // The flutter-widget-cache feature only applies to run mode.
...@@ -161,6 +165,7 @@ class FlutterDevice { ...@@ -161,6 +165,7 @@ class FlutterDevice {
artifacts: globals.artifacts, artifacts: globals.artifacts,
processManager: globals.processManager, processManager: globals.processManager,
logger: globals.logger, logger: globals.logger,
platform: platform,
); );
} }
......
...@@ -108,6 +108,7 @@ class TestCompiler { ...@@ -108,6 +108,7 @@ class TestCompiler {
dartDefines: const <String>[], dartDefines: const <String>[],
packagesPath: globalPackagesPath, packagesPath: globalPackagesPath,
extraFrontEndOptions: extraFrontEndOptions, extraFrontEndOptions: extraFrontEndOptions,
platform: globals.platform,
); );
return residentCompiler; return residentCompiler;
} }
......
...@@ -96,7 +96,7 @@ void main() { ...@@ -96,7 +96,7 @@ void main() {
'$build/app.dill', '$build/app.dill',
'--depfile', '--depfile',
'$build/kernel_snapshot.d', '$build/kernel_snapshot.d',
'/lib/main.dart', 'file:///lib/main.dart',
], exitCode: 1), ], exitCode: 1),
]); ]);
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
'$build/app.dill', '$build/app.dill',
'--depfile', '--depfile',
'$build/kernel_snapshot.d', '$build/kernel_snapshot.d',
'/lib/main.dart', 'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'), ], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'),
]); ]);
...@@ -164,7 +164,7 @@ void main() { ...@@ -164,7 +164,7 @@ void main() {
'$build/app.dill', '$build/app.dill',
'--depfile', '--depfile',
'$build/kernel_snapshot.d', '$build/kernel_snapshot.d',
'/lib/main.dart', 'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'), ], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'),
]); ]);
...@@ -201,7 +201,7 @@ void main() { ...@@ -201,7 +201,7 @@ void main() {
'$build/kernel_snapshot.d', '$build/kernel_snapshot.d',
'foo', 'foo',
'bar', 'bar',
'/lib/main.dart', 'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'), ], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'),
]); ]);
...@@ -235,7 +235,7 @@ void main() { ...@@ -235,7 +235,7 @@ void main() {
'$build/app.dill', '$build/app.dill',
'--depfile', '--depfile',
'$build/kernel_snapshot.d', '$build/kernel_snapshot.d',
'/lib/main.dart', 'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'), ], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'),
]); ]);
...@@ -269,7 +269,7 @@ void main() { ...@@ -269,7 +269,7 @@ void main() {
'$build/app.dill', '$build/app.dill',
'--depfile', '--depfile',
'$build/kernel_snapshot.d', '$build/kernel_snapshot.d',
'/lib/main.dart', 'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'), ], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey $build/app.dill 0\n'),
]); ]);
...@@ -318,7 +318,7 @@ void main() { ...@@ -318,7 +318,7 @@ void main() {
'$build/app.dill', '$build/app.dill',
'--depfile', '--depfile',
'$build/kernel_snapshot.d', '$build/kernel_snapshot.d',
'/lib/main.dart', 'file:///lib/main.dart',
], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey /build/653e11a8e6908714056a57cd6b4f602a/app.dill 0\n'), ], stdout: 'result $kBoundaryKey\n$kBoundaryKey\n$kBoundaryKey /build/653e11a8e6908714056a57cd6b4f602a/app.dill 0\n'),
]); ]);
......
...@@ -8,6 +8,7 @@ import 'package:flutter_tools/src/artifacts.dart'; ...@@ -8,6 +8,7 @@ import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/compile.dart'; import 'package:flutter_tools/src/compile.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
...@@ -40,6 +41,7 @@ void main() { ...@@ -40,6 +41,7 @@ void main() {
artifacts: Artifacts.test(), artifacts: Artifacts.test(),
processManager: mockProcessManager, processManager: mockProcessManager,
logger: testLogger, logger: testLogger,
platform: FakePlatform(operatingSystem: 'linux'),
); );
when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn); when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn);
......
...@@ -8,6 +8,7 @@ import 'package:flutter_tools/src/artifacts.dart'; ...@@ -8,6 +8,7 @@ import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/async_guard.dart'; import 'package:flutter_tools/src/base/async_guard.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/compile.dart'; import 'package:flutter_tools/src/compile.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
...@@ -40,6 +41,7 @@ void main() { ...@@ -40,6 +41,7 @@ void main() {
logger: testLogger, logger: testLogger,
processManager: mockProcessManager, processManager: mockProcessManager,
artifacts: Artifacts.test(), artifacts: Artifacts.test(),
platform: FakePlatform(operatingSystem: 'linux'),
); );
when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn); when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn);
......
...@@ -34,4 +34,13 @@ void main() { ...@@ -34,4 +34,13 @@ void main() {
expect(() => TargetModel('foobar'), throwsAssertionError); expect(() => TargetModel('foobar'), throwsAssertionError);
}); });
testWithoutContext('toMultiRootPath maps different URIs', () async {
expect(toMultiRootPath(Uri.parse('file:///a/b/c'), 'scheme', <String>['/a/b'], false), 'scheme:///c');
expect(toMultiRootPath(Uri.parse('file:///d/b/c'), 'scheme', <String>['/a/b'], false), 'file:///d/b/c');
expect(toMultiRootPath(Uri.parse('file:///a/b/c'), 'scheme', <String>['/d/b', '/a/b'], false), 'scheme:///c');
expect(toMultiRootPath(Uri.parse('file:///a/b/c'), null, <String>[], false), 'file:///a/b/c');
expect(toMultiRootPath(Uri.parse('org-dartlang-app:///a/b/c'), null, <String>[], false), 'org-dartlang-app:///a/b/c');
expect(toMultiRootPath(Uri.parse('org-dartlang-app:///a/b/c'), 'scheme', <String>['/d/b'], false), 'org-dartlang-app:///a/b/c');
});
} }
...@@ -2059,6 +2059,7 @@ void main() { ...@@ -2059,6 +2059,7 @@ void main() {
), ),
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.current(),
target: null, target: null,
platform: FakePlatform(operatingSystem: 'linux'),
)).generator as DefaultResidentCompiler; )).generator as DefaultResidentCompiler;
expect(residentCompiler.initializeFromDill, expect(residentCompiler.initializeFromDill,
...@@ -2093,6 +2094,7 @@ void main() { ...@@ -2093,6 +2094,7 @@ void main() {
), ),
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.current(),
target: null, target: null,
platform: FakePlatform(operatingSystem: 'linux'),
)).generator as DefaultResidentCompiler; )).generator as DefaultResidentCompiler;
expect(residentCompiler.initializeFromDill, expect(residentCompiler.initializeFromDill,
...@@ -2126,7 +2128,7 @@ void main() { ...@@ -2126,7 +2128,7 @@ void main() {
extraFrontEndOptions: <String>[], extraFrontEndOptions: <String>[],
), ),
flutterProject: FlutterProject.current(), flutterProject: FlutterProject.current(),
target: null, target: null, platform: null,
)).generator as DefaultResidentCompiler; )).generator as DefaultResidentCompiler;
expect(residentCompiler.extraFrontEndOptions, expect(residentCompiler.extraFrontEndOptions,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment