Revert "Pass filesystem-root, filesystem-scheme options through `flutter run, build` and gradle. (#15592)" (#15621)
This reverts commit 0f659fb10b84fc0192c06ce351b00f6900b3408a as it
breaks bin/tasks/gradle_plugin_test.dart.
diff --git a/packages/flutter_tools/gradle/flutter.gradle b/packages/flutter_tools/gradle/flutter.gradle
index 96a6b5e..c421a64 100644
--- a/packages/flutter_tools/gradle/flutter.gradle
+++ b/packages/flutter_tools/gradle/flutter.gradle
@@ -260,14 +260,6 @@
if (project.hasProperty('preview-dart-2')) {
previewDart2Value = project.property('preview-dart-2')
}
- String[] fileSystemRootsValue = null
- if (project.hasProperty('filesystem-roots')) {
- fileSystemRootsValue = project.property('filesystem-roots').split('\\|')
- }
- String fileSystemSchemeValue = null
- if (project.hasProperty('filesystem-scheme')) {
- fileSystemSchemeValue = project.property('filesystem-scheme')
- }
Boolean trackWidgetCreationValue = false
if (project.hasProperty('track-widget-creation')) {
trackWidgetCreationValue = project.property('track-widget-creation')
@@ -310,8 +302,6 @@
localEngineSrcPath this.localEngineSrcPath
targetPath target
previewDart2 previewDart2Value
- fileSystemRoots fileSystemRootsValue
- fileSystemScheme fileSystemSchemeValue
trackWidgetCreation trackWidgetCreationValue
preferSharedLibrary preferSharedLibraryValue
targetPlatform targetPlatformValue
@@ -330,8 +320,6 @@
localEngineSrcPath this.localEngineSrcPath
targetPath target
previewDart2 previewDart2Value
- fileSystemRoots fileSystemRootsValue
- fileSystemScheme fileSystemSchemeValue
trackWidgetCreation trackWidgetCreationValue
preferSharedLibrary preferSharedLibraryValue
targetPlatform targetPlatformValue
@@ -369,10 +357,6 @@
@Optional @Input
Boolean previewDart2
@Optional @Input
- String[] fileSystemRoots
- @Optional @Input
- String fileSystemScheme
- @Optional @Input
Boolean trackWidgetCreation
@Optional @Input
Boolean preferSharedLibrary
@@ -449,14 +433,6 @@
if (previewDart2) {
args "--preview-dart-2"
}
- if (fileSystemRoots != null) {
- for (root in fileSystemRoots) {
- args "--filesystem-root", root
- }
- }
- if (fileSystemScheme != null) {
- args "--filesystem-scheme", fileSystemScheme
- }
if (trackWidgetCreation) {
args "--track-widget-creation"
}
diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart
index 95ee4de..4d2d883 100644
--- a/packages/flutter_tools/lib/src/android/gradle.dart
+++ b/packages/flutter_tools/lib/src/android/gradle.dart
@@ -303,10 +303,6 @@
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}');
if (buildInfo.extraGenSnapshotOptions != null)
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}');
- if (buildInfo.fileSystemRoots != null)
- command.add('-Pfilesystem-roots=${buildInfo.fileSystemRoots.join('|')}');
- if (buildInfo.fileSystemScheme != null)
- command.add('-Pfilesystem-scheme=${buildInfo.fileSystemScheme}');
}
if (buildInfo.preferSharedLibrary && androidSdk.ndkCompiler != null) {
command.add('-Pprefer-shared-library=true');
diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart
index 2f9cabf..c86d5b7 100644
--- a/packages/flutter_tools/lib/src/build_info.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -17,8 +17,6 @@
this.extraGenSnapshotOptions,
this.preferSharedLibrary,
this.targetPlatform,
- this.fileSystemRoots,
- this.fileSystemScheme,
});
final BuildMode mode;
@@ -34,9 +32,6 @@
/// Whether build should be done using Dart2 Frontend parser.
final bool previewDart2;
- final List<String> fileSystemRoots;
- final String fileSystemScheme;
-
/// Whether the build should track widget creation locations.
final bool trackWidgetCreation;
diff --git a/packages/flutter_tools/lib/src/commands/build_flx.dart b/packages/flutter_tools/lib/src/commands/build_flx.dart
index 40a6cff..b7fbfdc 100644
--- a/packages/flutter_tools/lib/src/commands/build_flx.dart
+++ b/packages/flutter_tools/lib/src/commands/build_flx.dart
@@ -29,18 +29,6 @@
);
argParser.addOption('working-dir', defaultsTo: getAssetBuildDirectory());
argParser.addFlag('report-licensed-packages', help: 'Whether to report the names of all the packages that are included in the application\'s LICENSE file.', defaultsTo: false);
- argParser.addMultiOption('filesystem-root',
- hide: !verboseHelp,
- help: 'Specify the path, that is used as root in a virtual file system\n'
- 'for compilation. Input file name should be specified as Uri in\n'
- 'filesystem-scheme scheme. Use only in Dart 2 mode.\n'
- 'Requires --output-dill option to be explicitly specified.\n');
-
- argParser.addOption('filesystem-scheme',
- defaultsTo: 'org-dartlang-root',
- hide: !verboseHelp,
- help: 'Specify the scheme that is used for virtual file system used in\n'
- 'compilation. See more details on filesystem-root option.\n');
usesPubOption();
}
@@ -72,8 +60,6 @@
precompiledSnapshot: argResults['precompiled'],
reportLicensedPackages: argResults['report-licensed-packages'],
trackWidgetCreation: argResults['track-widget-creation'],
- fileSystemScheme: argResults['filesystem-scheme'],
- fileSystemRoots: argResults['filesystem-root'],
);
}
}
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index 68713fb..ac697c0 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -151,19 +151,6 @@
hide: !verboseHelp,
help: 'Specify the path to frontend server output kernel file.');
- argParser.addMultiOption('filesystem-root',
- hide: !verboseHelp,
- help: 'Specify the path, that is used as root in a virtual file system\n'
- 'for compilation. Input file name should be specified as Uri in\n'
- 'filesystem-scheme scheme. Use only in Dart 2 mode.\n'
- 'Requires --output-dill option to be explicitly specified.\n');
-
- argParser.addOption('filesystem-scheme',
- defaultsTo: 'org-dartlang-root',
- hide: !verboseHelp,
- help: 'Specify the scheme that is used for virtual file system used in\n'
- 'compilation. See more details on filesystem-root option.\n');
-
argParser.addOption(FlutterOptions.kExtraFrontEndOptions, hide: true);
argParser.addOption(FlutterOptions.kExtraGenSnapshotOptions, hide: true);
}
@@ -338,8 +325,6 @@
previewDart2: argResults['preview-dart-2'],
trackWidgetCreation: argResults['track-widget-creation'],
dillOutputPath: argResults['output-dill'],
- fileSystemRoots: argResults['filesystem-root'],
- fileSystemScheme: argResults['filesystem-scheme'],
);
}).toList();
diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart
index 1ee9b3b..70a3304 100644
--- a/packages/flutter_tools/lib/src/compile.dart
+++ b/packages/flutter_tools/lib/src/compile.dart
@@ -52,9 +52,7 @@
bool trackWidgetCreation: false,
List<String> extraFrontEndOptions,
String incrementalCompilerByteStorePath,
- String packagesPath,
- List<String> fileSystemRoots,
- String fileSystemScheme}) async {
+ String packagesPath}) async {
final String frontendServer = artifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk
);
@@ -92,17 +90,9 @@
if (outputFilePath != null) {
command.addAll(<String>['--output-dill', outputFilePath]);
}
- if (depFilePath != null && fileSystemRoots == null) {
+ if (depFilePath != null) {
command.addAll(<String>['--depfile', depFilePath]);
}
- if (fileSystemRoots != null) {
- for (String root in fileSystemRoots) {
- command.addAll(<String>['--filesystem-root', root]);
- }
- }
- if (fileSystemScheme != null) {
- command.addAll(<String>['--filesystem-scheme', fileSystemScheme]);
- }
if (extraFrontEndOptions != null)
command.addAll(extraFrontEndOptions);
@@ -134,12 +124,10 @@
/// restarts the Flutter app.
class ResidentCompiler {
ResidentCompiler(this._sdkRoot, {bool trackWidgetCreation: false,
- String packagesPath, List<String> fileSystemRoots, String fileSystemScheme })
+ String packagesPath})
: assert(_sdkRoot != null),
_trackWidgetCreation = trackWidgetCreation,
- _packagesPath = packagesPath,
- _fileSystemRoots = fileSystemRoots,
- _fileSystemScheme = fileSystemScheme {
+ _packagesPath = packagesPath {
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if (!_sdkRoot.endsWith('/'))
_sdkRoot = '$_sdkRoot/';
@@ -147,8 +135,6 @@
final bool _trackWidgetCreation;
final String _packagesPath;
- final List<String> _fileSystemRoots;
- final String _fileSystemScheme;
String _sdkRoot;
Process _server;
final _StdoutHandler stdoutHandler = new _StdoutHandler();
@@ -167,13 +153,11 @@
// First time recompile is called we actually have to compile the app from
// scratch ignoring list of invalidated files.
if (_server == null)
- return _compile(_mapFilename(mainPath), outputPath, _mapFilename(packagesFilePath));
+ return _compile(mainPath, outputPath, packagesFilePath);
final String inputKey = new Uuid().generateV4();
- _server.stdin.writeln('recompile ${mainPath != null ? _mapFilename(mainPath) + " ": ""}$inputKey');
- for (String uri in invalidatedFiles) {
- _server.stdin.writeln(_mapFilename(Uri.parse(uri).toFilePath()));
- }
+ _server.stdin.writeln('recompile ${mainPath != null ? mainPath + " ": ""}$inputKey');
+ invalidatedFiles.forEach(_server.stdin.writeln);
_server.stdin.writeln(inputKey);
return stdoutHandler.outputFilename.future;
@@ -204,14 +188,6 @@
if (_packagesPath != null) {
args.addAll(<String>['--packages', _packagesPath]);
}
- if (_fileSystemRoots != null) {
- for (String root in _fileSystemRoots) {
- args.addAll(<String>['--filesystem-root', root]);
- }
- }
- if (_fileSystemScheme != null) {
- args.addAll(<String>['--filesystem-scheme', _fileSystemScheme]);
- }
_server = await processManager.start(args);
_server.stdout
.transform(utf8.decoder)
@@ -257,15 +233,4 @@
void reset() {
_server.stdin.writeln('reset');
}
-
- String _mapFilename(String filename) {
- if (_fileSystemRoots != null) {
- for (String root in _fileSystemRoots) {
- if (filename.startsWith(root)) {
- return new Uri(scheme: _fileSystemScheme, path: filename.substring(root.length)).toString();
- }
- }
- }
- return filename;
- }
}
diff --git a/packages/flutter_tools/lib/src/flx.dart b/packages/flutter_tools/lib/src/flx.dart
index f02ad9a..b7b8236 100644
--- a/packages/flutter_tools/lib/src/flx.dart
+++ b/packages/flutter_tools/lib/src/flx.dart
@@ -44,8 +44,6 @@
bool precompiledSnapshot: false,
bool reportLicensedPackages: false,
bool trackWidgetCreation: false,
- List<String> fileSystemRoots,
- String fileSystemScheme,
}) async {
outputPath ??= defaultFlxOutputPath;
snapshotPath ??= defaultSnapshotPath;
@@ -84,9 +82,6 @@
outputFilePath: applicationKernelFilePath,
depFilePath: depfilePath,
trackWidgetCreation: trackWidgetCreation,
- fileSystemRoots: fileSystemRoots,
- fileSystemScheme: fileSystemScheme,
- packagesPath: packagesPath,
);
if (kernelBinaryFilename == null) {
throwToolExit('Compiler terminated unexpectedly on $mainPath');
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 835fe22..3abc152 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -36,8 +36,6 @@
ApplicationPackage package;
ResidentCompiler generator;
String dillOutputPath;
- List<String> fileSystemRoots;
- String fileSystemScheme;
StreamSubscription<String> _loggingSubscription;
@@ -45,14 +43,11 @@
@required bool previewDart2,
@required bool trackWidgetCreation,
this.dillOutputPath,
- this.fileSystemRoots,
- this.fileSystemScheme,
}) {
if (previewDart2) {
generator = new ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
trackWidgetCreation: trackWidgetCreation,
- fileSystemRoots: fileSystemRoots, fileSystemScheme: fileSystemScheme
);
}
}
diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart
index a84708c..db0e119 100644
--- a/packages/flutter_tools/lib/src/run_hot.dart
+++ b/packages/flutter_tools/lib/src/run_hot.dart
@@ -392,7 +392,7 @@
// We are now running from source.
_runningFromSnapshot = false;
final String launchPath = debuggingOptions.buildInfo.previewDart2
- ? mainPath + '.dill'
+ ? dillOutputPath ?? mainPath + '.dill'
: mainPath;
await _launchFromDevFS(launchPath);
restartTimer.stop();
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index 2a01761..ca48a1a 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -61,8 +61,6 @@
class FlutterOptions {
static const String kExtraFrontEndOptions = 'extra-front-end-options';
static const String kExtraGenSnapshotOptions = 'extra-gen-snapshot-options';
- static const String kFileSystemRoot = 'filesystem-root';
- static const String kFileSystemScheme = 'filesystem-scheme';
}
abstract class FlutterCommand extends Command<Null> {
@@ -196,12 +194,7 @@
preferSharedLibrary: argParser.options.containsKey('prefer-shared-library')
? argResults['prefer-shared-library']
: false,
- targetPlatform: targetPlatform,
- fileSystemRoots: argParser.options.containsKey(FlutterOptions.kFileSystemRoot)
- ? argResults[FlutterOptions.kFileSystemRoot] : null,
- fileSystemScheme: argParser.options.containsKey(FlutterOptions.kFileSystemScheme)
- ? argResults[FlutterOptions.kFileSystemScheme] : null,
- );
+ targetPlatform: targetPlatform);
}
void setupApplicationPackages() {
diff --git a/packages/flutter_tools/test/compile_test.dart b/packages/flutter_tools/test/compile_test.dart
index 084342e..45e0bb9 100644
--- a/packages/flutter_tools/test/compile_test.dart
+++ b/packages/flutter_tools/test/compile_test.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'dart:convert';
-import 'package:flutter_tools/src/base/file_system.dart' show fs;
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/context.dart';
import 'package:flutter_tools/src/base/logger.dart';
@@ -228,8 +227,7 @@
final String output = await generator.recompile(null /* mainPath */, <String>['/path/to/main.dart']);
expect(output, equals('/path/to/main.dart.dill'));
final String commands = mockFrontendServerStdIn.getAndClear();
- final String sep = fs.path.separator;
- final RegExp re = new RegExp('^recompile (.*)\\n\\${sep}path\\${sep}to\\${sep}main.dart\\n(.*)\\n\$');
+ final RegExp re = new RegExp(r'^recompile (.*)\n/path/to/main.dart\n(.*)\n$');
expect(commands, matches(re));
final Match match = re.firstMatch(commands);
expect(match[1] == match[2], isTrue);