Unverified Commit 0f3eada0 authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Revert "Reland pass filesystem options (#15622)" (#15651)

This reverts commit bbcf55a5 as it breaks hot reload on Windows.
parent bbcf55a5
...@@ -260,14 +260,6 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -260,14 +260,6 @@ class FlutterPlugin implements Plugin<Project> {
if (project.hasProperty('preview-dart-2')) { if (project.hasProperty('preview-dart-2')) {
previewDart2Value = project.property('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 Boolean trackWidgetCreationValue = false
if (project.hasProperty('track-widget-creation')) { if (project.hasProperty('track-widget-creation')) {
trackWidgetCreationValue = project.property('track-widget-creation') trackWidgetCreationValue = project.property('track-widget-creation')
...@@ -310,8 +302,6 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -310,8 +302,6 @@ class FlutterPlugin implements Plugin<Project> {
localEngineSrcPath this.localEngineSrcPath localEngineSrcPath this.localEngineSrcPath
targetPath target targetPath target
previewDart2 previewDart2Value previewDart2 previewDart2Value
fileSystemRoots fileSystemRootsValue
fileSystemScheme fileSystemSchemeValue
trackWidgetCreation trackWidgetCreationValue trackWidgetCreation trackWidgetCreationValue
preferSharedLibrary preferSharedLibraryValue preferSharedLibrary preferSharedLibraryValue
targetPlatform targetPlatformValue targetPlatform targetPlatformValue
...@@ -330,8 +320,6 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -330,8 +320,6 @@ class FlutterPlugin implements Plugin<Project> {
localEngineSrcPath this.localEngineSrcPath localEngineSrcPath this.localEngineSrcPath
targetPath target targetPath target
previewDart2 previewDart2Value previewDart2 previewDart2Value
fileSystemRoots fileSystemRootsValue
fileSystemScheme fileSystemSchemeValue
trackWidgetCreation trackWidgetCreationValue trackWidgetCreation trackWidgetCreationValue
preferSharedLibrary preferSharedLibraryValue preferSharedLibrary preferSharedLibraryValue
targetPlatform targetPlatformValue targetPlatform targetPlatformValue
...@@ -369,10 +357,6 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -369,10 +357,6 @@ abstract class BaseFlutterTask extends DefaultTask {
@Optional @Input @Optional @Input
Boolean previewDart2 Boolean previewDart2
@Optional @Input @Optional @Input
String[] fileSystemRoots
@Optional @Input
String fileSystemScheme
@Optional @Input
Boolean trackWidgetCreation Boolean trackWidgetCreation
@Optional @Input @Optional @Input
Boolean preferSharedLibrary Boolean preferSharedLibrary
...@@ -417,8 +401,8 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -417,8 +401,8 @@ abstract class BaseFlutterTask extends DefaultTask {
if (previewDart2) { if (previewDart2) {
args "--preview-dart-2" args "--preview-dart-2"
} else { } else {
args "--no-preview-dart-2" args "--no-preview-dart-2"
} }
if (trackWidgetCreation) { if (trackWidgetCreation) {
args "--track-widget-creation" args "--track-widget-creation"
} }
...@@ -452,15 +436,7 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -452,15 +436,7 @@ abstract class BaseFlutterTask extends DefaultTask {
args "--preview-dart-2" args "--preview-dart-2"
} else { } else {
args "--no-preview-dart-2" args "--no-preview-dart-2"
} }
if (fileSystemRoots != null) {
for (root in fileSystemRoots) {
args "--filesystem-root", root
}
}
if (fileSystemScheme != null) {
args "--filesystem-scheme", fileSystemScheme
}
if (trackWidgetCreation) { if (trackWidgetCreation) {
args "--track-widget-creation" args "--track-widget-creation"
} }
......
...@@ -303,10 +303,6 @@ Future<Null> _buildGradleProjectV2(String gradle, BuildInfo buildInfo, String ta ...@@ -303,10 +303,6 @@ Future<Null> _buildGradleProjectV2(String gradle, BuildInfo buildInfo, String ta
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}'); command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}');
if (buildInfo.extraGenSnapshotOptions != null) if (buildInfo.extraGenSnapshotOptions != null)
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}'); 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) { if (buildInfo.preferSharedLibrary && androidSdk.ndkCompiler != null) {
command.add('-Pprefer-shared-library=true'); command.add('-Pprefer-shared-library=true');
......
...@@ -17,8 +17,6 @@ class BuildInfo { ...@@ -17,8 +17,6 @@ class BuildInfo {
this.extraGenSnapshotOptions, this.extraGenSnapshotOptions,
this.preferSharedLibrary, this.preferSharedLibrary,
this.targetPlatform, this.targetPlatform,
this.fileSystemRoots,
this.fileSystemScheme,
}); });
final BuildMode mode; final BuildMode mode;
...@@ -34,9 +32,6 @@ class BuildInfo { ...@@ -34,9 +32,6 @@ class BuildInfo {
/// Whether build should be done using Dart2 Frontend parser. /// Whether build should be done using Dart2 Frontend parser.
final bool previewDart2; final bool previewDart2;
final List<String> fileSystemRoots;
final String fileSystemScheme;
/// Whether the build should track widget creation locations. /// Whether the build should track widget creation locations.
final bool trackWidgetCreation; final bool trackWidgetCreation;
......
...@@ -35,18 +35,7 @@ class BuildFlxCommand extends BuildSubCommand { ...@@ -35,18 +35,7 @@ class BuildFlxCommand extends BuildSubCommand {
..addFlag('report-licensed-packages', ..addFlag('report-licensed-packages',
help: 'Whether to report the names of all the packages that are included ' help: 'Whether to report the names of all the packages that are included '
'in the application\'s LICENSE file.', 'in the application\'s LICENSE file.',
defaultsTo: false) defaultsTo: false);
..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')
..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(); usesPubOption();
} }
...@@ -78,8 +67,6 @@ class BuildFlxCommand extends BuildSubCommand { ...@@ -78,8 +67,6 @@ class BuildFlxCommand extends BuildSubCommand {
precompiledSnapshot: argResults['precompiled'], precompiledSnapshot: argResults['precompiled'],
reportLicensedPackages: argResults['report-licensed-packages'], reportLicensedPackages: argResults['report-licensed-packages'],
trackWidgetCreation: argResults['track-widget-creation'], trackWidgetCreation: argResults['track-widget-creation'],
fileSystemScheme: argResults['filesystem-scheme'],
fileSystemRoots: argResults['filesystem-root'],
); );
} }
} }
...@@ -172,18 +172,7 @@ class RunCommand extends RunCommandBase { ...@@ -172,18 +172,7 @@ class RunCommand extends RunCommandBase {
help: 'Specify the path to frontend server output kernel file.', help: 'Specify the path to frontend server output kernel file.',
) )
..addOption(FlutterOptions.kExtraFrontEndOptions, hide: true) ..addOption(FlutterOptions.kExtraFrontEndOptions, hide: true)
..addOption(FlutterOptions.kExtraGenSnapshotOptions, hide: true) ..addOption(FlutterOptions.kExtraGenSnapshotOptions, hide: true);
..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')
..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');
} }
List<Device> devices; List<Device> devices;
...@@ -356,8 +345,6 @@ class RunCommand extends RunCommandBase { ...@@ -356,8 +345,6 @@ class RunCommand extends RunCommandBase {
previewDart2: argResults['preview-dart-2'], previewDart2: argResults['preview-dart-2'],
trackWidgetCreation: argResults['track-widget-creation'], trackWidgetCreation: argResults['track-widget-creation'],
dillOutputPath: argResults['output-dill'], dillOutputPath: argResults['output-dill'],
fileSystemRoots: argResults['filesystem-root'],
fileSystemScheme: argResults['filesystem-scheme'],
); );
}).toList(); }).toList();
......
...@@ -55,9 +55,7 @@ Future<String> compile( ...@@ -55,9 +55,7 @@ Future<String> compile(
bool trackWidgetCreation: false, bool trackWidgetCreation: false,
List<String> extraFrontEndOptions, List<String> extraFrontEndOptions,
String incrementalCompilerByteStorePath, String incrementalCompilerByteStorePath,
String packagesPath, String packagesPath}) async {
List<String> fileSystemRoots,
String fileSystemScheme}) async {
final String frontendServer = artifacts.getArtifactPath( final String frontendServer = artifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk Artifact.frontendServerSnapshotForEngineDartSdk
); );
...@@ -95,17 +93,9 @@ Future<String> compile( ...@@ -95,17 +93,9 @@ Future<String> compile(
if (outputFilePath != null) { if (outputFilePath != null) {
command.addAll(<String>['--output-dill', outputFilePath]); command.addAll(<String>['--output-dill', outputFilePath]);
} }
if (depFilePath != null && (fileSystemRoots == null || fileSystemRoots.isEmpty)) { if (depFilePath != null) {
command.addAll(<String>['--depfile', depFilePath]); 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) if (extraFrontEndOptions != null)
command.addAll(extraFrontEndOptions); command.addAll(extraFrontEndOptions);
...@@ -137,13 +127,10 @@ Future<String> compile( ...@@ -137,13 +127,10 @@ Future<String> compile(
/// restarts the Flutter app. /// restarts the Flutter app.
class ResidentCompiler { class ResidentCompiler {
ResidentCompiler(this._sdkRoot, {bool trackWidgetCreation: false, ResidentCompiler(this._sdkRoot, {bool trackWidgetCreation: false,
String packagesPath, List<String> fileSystemRoots, String fileSystemScheme , String packagesPath, CompilerMessageConsumer compilerMessageConsumer: printError})
CompilerMessageConsumer compilerMessageConsumer: printError})
: assert(_sdkRoot != null), : assert(_sdkRoot != null),
_trackWidgetCreation = trackWidgetCreation, _trackWidgetCreation = trackWidgetCreation,
_packagesPath = packagesPath, _packagesPath = packagesPath,
_fileSystemRoots = fileSystemRoots,
_fileSystemScheme = fileSystemScheme,
stdoutHandler = new _StdoutHandler(consumer: compilerMessageConsumer) { stdoutHandler = new _StdoutHandler(consumer: compilerMessageConsumer) {
// 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.
if (!_sdkRoot.endsWith('/')) if (!_sdkRoot.endsWith('/'))
...@@ -152,8 +139,6 @@ class ResidentCompiler { ...@@ -152,8 +139,6 @@ class ResidentCompiler {
final bool _trackWidgetCreation; final bool _trackWidgetCreation;
final String _packagesPath; final String _packagesPath;
final List<String> _fileSystemRoots;
final String _fileSystemScheme;
String _sdkRoot; String _sdkRoot;
Process _server; Process _server;
final _StdoutHandler stdoutHandler; final _StdoutHandler stdoutHandler;
...@@ -172,13 +157,11 @@ class ResidentCompiler { ...@@ -172,13 +157,11 @@ class ResidentCompiler {
// First time recompile is called we actually have to compile the app from // First time recompile is called we actually have to compile the app from
// scratch ignoring list of invalidated files. // scratch ignoring list of invalidated files.
if (_server == null) if (_server == null)
return _compile(_mapFilename(mainPath), outputPath, _mapFilename(packagesFilePath)); return _compile(mainPath, outputPath, packagesFilePath);
final String inputKey = new Uuid().generateV4(); final String inputKey = new Uuid().generateV4();
_server.stdin.writeln('recompile ${mainPath != null ? _mapFilename(mainPath) + " ": ""}$inputKey'); _server.stdin.writeln('recompile ${mainPath != null ? mainPath + " ": ""}$inputKey');
for (String filePath in invalidatedFiles) { invalidatedFiles.forEach(_server.stdin.writeln);
_server.stdin.writeln(_mapFilename(filePath));
}
_server.stdin.writeln(inputKey); _server.stdin.writeln(inputKey);
return stdoutHandler.outputFilename.future; return stdoutHandler.outputFilename.future;
...@@ -209,14 +192,6 @@ class ResidentCompiler { ...@@ -209,14 +192,6 @@ class ResidentCompiler {
if (_packagesPath != null) { if (_packagesPath != null) {
args.addAll(<String>['--packages', _packagesPath]); 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 = await processManager.start(args);
_server.stdout _server.stdout
.transform(utf8.decoder) .transform(utf8.decoder)
...@@ -263,19 +238,6 @@ class ResidentCompiler { ...@@ -263,19 +238,6 @@ class ResidentCompiler {
_server.stdin.writeln('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;
}
Future<dynamic> shutdown() { Future<dynamic> shutdown() {
_server.kill(); _server.kill();
return _server.exitCode; return _server.exitCode;
......
...@@ -487,7 +487,7 @@ class DevFS { ...@@ -487,7 +487,7 @@ class DevFS {
final DevFSContent content = dirtyEntries[uri]; final DevFSContent content = dirtyEntries[uri];
if (content is DevFSFileContent) { if (content is DevFSFileContent) {
filesUris.add(uri); filesUris.add(uri);
invalidatedFiles.add(content.file.path); invalidatedFiles.add(content.file.uri.toString());
numBytes -= content.size; numBytes -= content.size;
} }
} }
......
...@@ -44,8 +44,6 @@ Future<Null> build({ ...@@ -44,8 +44,6 @@ Future<Null> build({
bool precompiledSnapshot: false, bool precompiledSnapshot: false,
bool reportLicensedPackages: false, bool reportLicensedPackages: false,
bool trackWidgetCreation: false, bool trackWidgetCreation: false,
List<String> fileSystemRoots,
String fileSystemScheme,
}) async { }) async {
outputPath ??= defaultFlxOutputPath; outputPath ??= defaultFlxOutputPath;
snapshotPath ??= defaultSnapshotPath; snapshotPath ??= defaultSnapshotPath;
...@@ -84,9 +82,6 @@ Future<Null> build({ ...@@ -84,9 +82,6 @@ Future<Null> build({
outputFilePath: applicationKernelFilePath, outputFilePath: applicationKernelFilePath,
depFilePath: depfilePath, depFilePath: depfilePath,
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
fileSystemRoots: fileSystemRoots,
fileSystemScheme: fileSystemScheme,
packagesPath: packagesPath,
); );
if (kernelBinaryFilename == null) { if (kernelBinaryFilename == null) {
throwToolExit('Compiler terminated unexpectedly on $mainPath'); throwToolExit('Compiler terminated unexpectedly on $mainPath');
......
...@@ -36,8 +36,6 @@ class FlutterDevice { ...@@ -36,8 +36,6 @@ class FlutterDevice {
ApplicationPackage package; ApplicationPackage package;
ResidentCompiler generator; ResidentCompiler generator;
String dillOutputPath; String dillOutputPath;
List<String> fileSystemRoots;
String fileSystemScheme;
StreamSubscription<String> _loggingSubscription; StreamSubscription<String> _loggingSubscription;
...@@ -45,14 +43,11 @@ class FlutterDevice { ...@@ -45,14 +43,11 @@ class FlutterDevice {
@required bool previewDart2, @required bool previewDart2,
@required bool trackWidgetCreation, @required bool trackWidgetCreation,
this.dillOutputPath, this.dillOutputPath,
this.fileSystemRoots,
this.fileSystemScheme,
}) { }) {
if (previewDart2) { if (previewDart2) {
generator = new ResidentCompiler( generator = new ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
fileSystemRoots: fileSystemRoots, fileSystemScheme: fileSystemScheme
); );
} }
} }
......
...@@ -392,7 +392,7 @@ class HotRunner extends ResidentRunner { ...@@ -392,7 +392,7 @@ class HotRunner extends ResidentRunner {
// We are now running from source. // We are now running from source.
_runningFromSnapshot = false; _runningFromSnapshot = false;
final String launchPath = debuggingOptions.buildInfo.previewDart2 final String launchPath = debuggingOptions.buildInfo.previewDart2
? mainPath + '.dill' ? dillOutputPath ?? mainPath + '.dill'
: mainPath; : mainPath;
await _launchFromDevFS(launchPath); await _launchFromDevFS(launchPath);
restartTimer.stop(); restartTimer.stop();
......
...@@ -61,8 +61,6 @@ class FlutterCommandResult { ...@@ -61,8 +61,6 @@ class FlutterCommandResult {
class FlutterOptions { class FlutterOptions {
static const String kExtraFrontEndOptions = 'extra-front-end-options'; static const String kExtraFrontEndOptions = 'extra-front-end-options';
static const String kExtraGenSnapshotOptions = 'extra-gen-snapshot-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> { abstract class FlutterCommand extends Command<Null> {
...@@ -196,12 +194,7 @@ abstract class FlutterCommand extends Command<Null> { ...@@ -196,12 +194,7 @@ abstract class FlutterCommand extends Command<Null> {
preferSharedLibrary: argParser.options.containsKey('prefer-shared-library') preferSharedLibrary: argParser.options.containsKey('prefer-shared-library')
? argResults['prefer-shared-library'] ? argResults['prefer-shared-library']
: false, : false,
targetPlatform: targetPlatform, targetPlatform: targetPlatform);
fileSystemRoots: argParser.options.containsKey(FlutterOptions.kFileSystemRoot)
? argResults[FlutterOptions.kFileSystemRoot] : null,
fileSystemScheme: argParser.options.containsKey(FlutterOptions.kFileSystemScheme)
? argResults[FlutterOptions.kFileSystemScheme] : null,
);
} }
void setupApplicationPackages() { void setupApplicationPackages() {
......
...@@ -227,7 +227,7 @@ Future<Null> _recompile(StreamController<List<int>> streamController, ...@@ -227,7 +227,7 @@ Future<Null> _recompile(StreamController<List<int>> streamController,
final String output = await generator.recompile(null /* mainPath */, <String>['/path/to/main.dart']); final String output = await generator.recompile(null /* mainPath */, <String>['/path/to/main.dart']);
expect(output, equals('/path/to/main.dart.dill')); expect(output, equals('/path/to/main.dart.dill'));
final String commands = mockFrontendServerStdIn.getAndClear(); final String commands = mockFrontendServerStdIn.getAndClear();
final RegExp re = new RegExp('^recompile (.*)\\n/path/to/main.dart\\n(.*)\\n\$'); final RegExp re = new RegExp(r'^recompile (.*)\n/path/to/main.dart\n(.*)\n$');
expect(commands, matches(re)); expect(commands, matches(re));
final Match match = re.firstMatch(commands); final Match match = re.firstMatch(commands);
expect(match[1] == match[2], isTrue); expect(match[1] == match[2], isTrue);
......
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