mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:10:22 +00:00
Rename PhysicalFileSystem to StandardFileSystem.
Preparation for data URI support. For clarity, this is just a rename. Change-Id: Ibbd8da05d1a7106b5ec7c0ea9c1e13a95a89d1bd Reviewed-on: https://dart-review.googlesource.com/33460 Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
95d9ca4776
commit
9bdcc40f69
|
@ -8,7 +8,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:args/args.dart';
|
||||
import 'package:dev_compiler/src/kernel/target.dart';
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
import 'package:front_end/src/api_unstable/ddc.dart' as fe;
|
||||
import 'package:front_end/src/multi_root_file_system.dart';
|
||||
import 'package:kernel/core_types.dart';
|
||||
|
@ -176,7 +176,7 @@ Future<CompilerResult> _compile(List<String> args,
|
|||
// the correct location and keeps the real file location hidden from the
|
||||
// front end.
|
||||
var fileSystem = new MultiRootFileSystem(
|
||||
customScheme, multiRoots, PhysicalFileSystem.instance);
|
||||
customScheme, multiRoots, StandardFileSystem.instance);
|
||||
|
||||
compilerState = await fe.initializeCompiler(
|
||||
compilerState,
|
||||
|
|
|
@ -13,7 +13,7 @@ import '../fasta/severity.dart' show Severity;
|
|||
|
||||
import 'compilation_message.dart';
|
||||
import 'file_system.dart';
|
||||
import 'physical_file_system.dart';
|
||||
import 'standard_file_system.dart';
|
||||
|
||||
/// Callback used to report errors encountered during compilation.
|
||||
typedef void ErrorHandler(CompilationMessage error);
|
||||
|
@ -115,7 +115,7 @@ class CompilerOptions {
|
|||
/// mechanism, with one exception: if no value is specified for
|
||||
/// [packagesFileUri], the packages file is located using the actual physical
|
||||
/// file system. TODO(paulberry): fix this.
|
||||
FileSystem fileSystem = PhysicalFileSystem.instance;
|
||||
FileSystem fileSystem = StandardFileSystem.instance;
|
||||
|
||||
/// The byte storage to access serialized data.
|
||||
ByteStore byteStore = new NullByteStore();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
library front_end.physical_file_system;
|
||||
library front_end.standard_file_system;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io' as io;
|
||||
|
@ -13,35 +13,35 @@ import 'file_system.dart';
|
|||
/// I/O.
|
||||
///
|
||||
/// Not intended to be implemented or extended by clients.
|
||||
class PhysicalFileSystem implements FileSystem {
|
||||
static final PhysicalFileSystem instance = new PhysicalFileSystem._();
|
||||
class StandardFileSystem implements FileSystem {
|
||||
static final StandardFileSystem instance = new StandardFileSystem._();
|
||||
|
||||
PhysicalFileSystem._();
|
||||
StandardFileSystem._();
|
||||
|
||||
@override
|
||||
FileSystemEntity entityForUri(Uri uri) {
|
||||
if (uri.scheme != 'file' && uri.scheme != '') {
|
||||
throw new FileSystemException(
|
||||
uri, 'PhysicalFileSystem only supports file:* URIs');
|
||||
uri, 'StandardFileSystem only supports file:* URIs');
|
||||
}
|
||||
return new _PhysicalFileSystemEntity(Uri.base.resolveUri(uri));
|
||||
return new _StandardFileSystemEntity(Uri.base.resolveUri(uri));
|
||||
}
|
||||
}
|
||||
|
||||
/// Concrete implementation of [FileSystemEntity] for use by
|
||||
/// [PhysicalFileSystem].
|
||||
class _PhysicalFileSystemEntity implements FileSystemEntity {
|
||||
/// [StandardFileSystem].
|
||||
class _StandardFileSystemEntity implements FileSystemEntity {
|
||||
@override
|
||||
final Uri uri;
|
||||
|
||||
_PhysicalFileSystemEntity(this.uri);
|
||||
_StandardFileSystemEntity(this.uri);
|
||||
|
||||
@override
|
||||
int get hashCode => uri.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
other is _PhysicalFileSystemEntity && other.uri == uri;
|
||||
other is _StandardFileSystemEntity && other.uri == uri;
|
||||
|
||||
@override
|
||||
Future<bool> exists() async {
|
|
@ -5,7 +5,7 @@
|
|||
import 'dart:async' show Future;
|
||||
|
||||
import 'package:front_end/src/api_prototype/file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
import 'package:front_end/src/base/processed_options.dart';
|
||||
import 'package:front_end/src/kernel_generator_impl.dart';
|
||||
import 'package:kernel/kernel.dart' show Program;
|
||||
|
@ -65,7 +65,7 @@ Future<InitializedCompilerState> initializeCompiler(
|
|||
..packagesFileUri = packagesFile
|
||||
..inputSummaries = inputSummaries
|
||||
..target = target
|
||||
..fileSystem = fileSystem ?? PhysicalFileSystem.instance
|
||||
..fileSystem = fileSystem ?? StandardFileSystem.instance
|
||||
..chaseDependencies = true
|
||||
..reportMessages = true;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import 'compiler_state.dart';
|
|||
|
||||
export 'compiler_state.dart';
|
||||
|
||||
export '../api_prototype/physical_file_system.dart' show PhysicalFileSystem;
|
||||
export '../api_prototype/standard_file_system.dart' show StandardFileSystem;
|
||||
export '../fasta/fasta_codes.dart' show LocatedMessage;
|
||||
export '../fasta/severity.dart' show Severity;
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ import 'dart:async';
|
|||
|
||||
import 'package:front_end/src/api_prototype/file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/memory_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
|
||||
/// A file system that mixes files from memory and a physical file system. All
|
||||
/// memory entities take priotity over file system entities.
|
||||
class HybridFileSystem implements FileSystem {
|
||||
final MemoryFileSystem memory;
|
||||
final PhysicalFileSystem physical = PhysicalFileSystem.instance;
|
||||
final StandardFileSystem physical = StandardFileSystem.instance;
|
||||
|
||||
HybridFileSystem(this.memory);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
library fasta.analyzer_loader;
|
||||
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
import 'package:kernel/ast.dart' show Program;
|
||||
|
||||
import 'package:front_end/src/fasta/builder/builder.dart' show LibraryBuilder;
|
||||
|
@ -25,7 +25,7 @@ import 'package:kernel/src/incremental_class_hierarchy.dart';
|
|||
|
||||
class AnalyzerLoader<L> extends SourceLoader<L> {
|
||||
AnalyzerLoader(TargetImplementation target)
|
||||
: super(PhysicalFileSystem.instance, false, target);
|
||||
: super(StandardFileSystem.instance, false, target);
|
||||
|
||||
@override
|
||||
void computeHierarchy(Program program) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
library fasta.analyzer_target;
|
||||
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
import 'package:kernel/ast.dart' show Library, Source;
|
||||
|
||||
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
|
||||
|
@ -20,7 +20,7 @@ class AnalyzerTarget extends KernelTarget {
|
|||
AnalyzerTarget(
|
||||
DillTarget dillTarget, UriTranslator uriTranslator, bool strongMode,
|
||||
[Map<Uri, Source> uriToSource])
|
||||
: super(PhysicalFileSystem.instance, false, dillTarget, uriTranslator,
|
||||
: super(StandardFileSystem.instance, false, dillTarget, uriTranslator,
|
||||
uriToSource: uriToSource);
|
||||
|
||||
@override
|
||||
|
|
|
@ -10,8 +10,8 @@ import 'dart:io' show File, Platform;
|
|||
|
||||
import 'dart:convert' show JSON;
|
||||
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart'
|
||||
show PhysicalFileSystem;
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart'
|
||||
show StandardFileSystem;
|
||||
|
||||
import 'package:front_end/src/base/libraries_specification.dart'
|
||||
show TargetLibrariesSpecification;
|
||||
|
@ -294,7 +294,7 @@ class Outline extends Step<TestDescription, Program, FastaContext> {
|
|||
KernelTarget sourceTarget = astKind == AstKind.Analyzer
|
||||
? new AnalyzerTarget(dillTarget, uriTranslator, strongMode)
|
||||
: new KernelTarget(
|
||||
PhysicalFileSystem.instance, false, dillTarget, uriTranslator);
|
||||
StandardFileSystem.instance, false, dillTarget, uriTranslator);
|
||||
|
||||
Program p;
|
||||
try {
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
// SharedOptions=--supermixin
|
||||
|
||||
library front_end.test.physical_file_system_test;
|
||||
library front_end.test.standard_file_system_test;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:front_end/src/api_prototype/file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(PhysicalFileSystemTest);
|
||||
defineReflectiveTests(StandardFileSystemTest);
|
||||
defineReflectiveTests(FileTest);
|
||||
defineReflectiveTests(DirectoryTest);
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ class DirectoryTest extends _BaseTest {
|
|||
setUp() {
|
||||
super.setUp();
|
||||
path = p.join(tempPath, 'dir');
|
||||
dir = PhysicalFileSystem.instance.entityForUri(p.toUri(path));
|
||||
dir = StandardFileSystem.instance.entityForUri(p.toUri(path));
|
||||
}
|
||||
|
||||
test_equals_differentPaths() {
|
||||
|
@ -72,7 +72,7 @@ class FileTest extends _BaseTest {
|
|||
setUp() {
|
||||
super.setUp();
|
||||
path = p.join(tempPath, 'file.txt');
|
||||
file = PhysicalFileSystem.instance.entityForUri(p.toUri(path));
|
||||
file = StandardFileSystem.instance.entityForUri(p.toUri(path));
|
||||
}
|
||||
|
||||
test_equals_differentPaths() {
|
||||
|
@ -140,7 +140,7 @@ class FileTest extends _BaseTest {
|
|||
}
|
||||
|
||||
@reflectiveTest
|
||||
class PhysicalFileSystemTest extends _BaseTest {
|
||||
class StandardFileSystemTest extends _BaseTest {
|
||||
Uri tempUri;
|
||||
|
||||
setUp() {
|
||||
|
@ -170,14 +170,14 @@ class PhysicalFileSystemTest extends _BaseTest {
|
|||
|
||||
test_entityForUri() {
|
||||
expect(
|
||||
PhysicalFileSystem.instance
|
||||
StandardFileSystem.instance
|
||||
.entityForUri(Uri.parse('${tempUri}file.txt'))
|
||||
.uri,
|
||||
p.toUri(p.join(tempPath, 'file.txt')));
|
||||
}
|
||||
|
||||
test_entityForUri_bareUri_absolute() {
|
||||
expect(PhysicalFileSystem.instance.entityForUri(Uri.parse('/file.txt')).uri,
|
||||
expect(StandardFileSystem.instance.entityForUri(Uri.parse('/file.txt')).uri,
|
||||
Uri.parse('file:///file.txt'));
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ class PhysicalFileSystemTest extends _BaseTest {
|
|||
Uri.parse('file:///file.txt')
|
||||
]) {
|
||||
if (!uri.path.startsWith('/')) {
|
||||
expect(() => PhysicalFileSystem.instance.entityForUri(uri),
|
||||
expect(() => StandardFileSystem.instance.entityForUri(uri),
|
||||
throwsA(new isInstanceOf<Error>()));
|
||||
}
|
||||
}
|
||||
|
@ -202,14 +202,14 @@ class PhysicalFileSystemTest extends _BaseTest {
|
|||
|
||||
test_entityForUri_nonFileUri() {
|
||||
expect(
|
||||
() => PhysicalFileSystem.instance
|
||||
() => StandardFileSystem.instance
|
||||
.entityForUri(Uri.parse('package:foo/bar.dart')),
|
||||
_throwsFileSystemException);
|
||||
}
|
||||
|
||||
test_entityForUri_normalize_dot() {
|
||||
expect(
|
||||
PhysicalFileSystem.instance
|
||||
StandardFileSystem.instance
|
||||
.entityForUri(Uri.parse('${tempUri}./file.txt'))
|
||||
.uri,
|
||||
p.toUri(p.join(tempPath, 'file.txt')));
|
||||
|
@ -217,7 +217,7 @@ class PhysicalFileSystemTest extends _BaseTest {
|
|||
|
||||
test_entityForUri_normalize_dotDot() {
|
||||
expect(
|
||||
PhysicalFileSystem.instance
|
||||
StandardFileSystem.instance
|
||||
.entityForUri(Uri.parse('${tempUri}foo/../file.txt'))
|
||||
.uri,
|
||||
p.toUri(p.join(tempPath, 'file.txt')));
|
||||
|
@ -229,7 +229,7 @@ class _BaseTest {
|
|||
String tempPath;
|
||||
|
||||
FileSystemEntity entityForPath(String path) =>
|
||||
PhysicalFileSystem.instance.entityForUri(p.toUri(path));
|
||||
StandardFileSystem.instance.entityForUri(p.toUri(path));
|
||||
|
||||
setUp() {
|
||||
tempDirectory = io.Directory.systemTemp.createTempSync('test_file_system');
|
|
@ -12,8 +12,8 @@ import 'package:front_end/src/api_prototype/compiler_options.dart'
|
|||
import 'package:front_end/src/api_prototype/file_system.dart'
|
||||
show FileSystem, FileSystemEntity, FileSystemException;
|
||||
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart'
|
||||
show PhysicalFileSystem;
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart'
|
||||
show StandardFileSystem;
|
||||
|
||||
import 'package:front_end/src/base/processed_options.dart'
|
||||
show ProcessedOptions;
|
||||
|
@ -80,7 +80,7 @@ class FileBackedMemoryFileSystem implements FileSystem {
|
|||
}
|
||||
return entity;
|
||||
} else {
|
||||
return PhysicalFileSystem.instance.entityForUri(uri);
|
||||
return StandardFileSystem.instance.entityForUri(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ import 'package:front_end/src/api_prototype/file_system.dart'
|
|||
import 'package:front_end/src/api_prototype/front_end.dart';
|
||||
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart';
|
||||
import 'package:front_end/src/api_prototype/memory_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
import 'package:front_end/src/base/processed_options.dart';
|
||||
import 'package:front_end/src/byte_store/protected_file_byte_store.dart';
|
||||
import 'package:front_end/src/fasta/uri_translator.dart';
|
||||
|
@ -218,7 +218,7 @@ List<ChangeSet> parse(List json) {
|
|||
class OverlayFileSystem implements FileSystem {
|
||||
final MemoryFileSystem memory =
|
||||
new MemoryFileSystem(Uri.parse('org-dartlang-overlay:///'));
|
||||
final PhysicalFileSystem physical = PhysicalFileSystem.instance;
|
||||
final StandardFileSystem physical = StandardFileSystem.instance;
|
||||
|
||||
@override
|
||||
FileSystemEntity entityForUri(Uri uri) {
|
||||
|
|
|
@ -160,7 +160,7 @@ front_end/test/incremental_kernel_generator_test: SkipByDesign # Uses dart:io
|
|||
front_end/test/incremental_resolved_ast_generator_test: SkipByDesign # Uses dart:io
|
||||
front_end/test/memory_file_system_test: CompileTimeError # Issue 23773
|
||||
front_end/test/dependency_grapher_test: SkipByDesign # Uses dart:io
|
||||
front_end/test/physical_file_system_test: SkipByDesign # Uses dart:io
|
||||
front_end/test/standard_file_system_test: SkipByDesign # Uses dart:io
|
||||
front_end/test/src/base/file_repository_test: SkipByDesign # Uses dart:io
|
||||
front_end/test/src/base/libraries_reader_test: SkipByDesign # Uses dart:io
|
||||
front_end/test/src/base/processed_options_test: SkipByDesign # Uses dart:io
|
||||
|
|
|
@ -29,7 +29,7 @@ import 'package:front_end/src/api_prototype/file_system.dart';
|
|||
import 'package:front_end/src/api_prototype/front_end.dart';
|
||||
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart';
|
||||
import 'package:front_end/src/api_prototype/memory_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/physical_file_system.dart';
|
||||
import 'package:front_end/src/api_prototype/standard_file_system.dart';
|
||||
import 'package:front_end/src/compute_platform_binaries_location.dart'
|
||||
show computePlatformBinariesLocation;
|
||||
import 'package:front_end/src/fasta/kernel/utils.dart';
|
||||
|
@ -157,7 +157,7 @@ Future<Compiler> lookupOrBuildNewIncrementalCompiler(
|
|||
}
|
||||
} else {
|
||||
final FileSystem fileSystem = sourceFiles == null
|
||||
? PhysicalFileSystem.instance
|
||||
? StandardFileSystem.instance
|
||||
: _buildFileSystem(sourceFiles);
|
||||
|
||||
// TODO(aam): IncrementalCompiler instance created below have to be
|
||||
|
@ -204,7 +204,7 @@ Future _processLoadRequest(request) async {
|
|||
suppressWarnings: suppressWarnings);
|
||||
} else {
|
||||
final FileSystem fileSystem = sourceFiles == null
|
||||
? PhysicalFileSystem.instance
|
||||
? StandardFileSystem.instance
|
||||
: _buildFileSystem(sourceFiles);
|
||||
compiler = new SingleShotCompiler(fileSystem, platformKernel,
|
||||
requireMain: sourceFiles == null,
|
||||
|
@ -257,7 +257,7 @@ Future _processLoadRequest(request) async {
|
|||
/// The [namedSources] list interleaves file name string and
|
||||
/// raw file content Uint8List.
|
||||
///
|
||||
/// The result can be used instead of PhysicalFileSystem.instance by the
|
||||
/// The result can be used instead of StandardFileSystem.instance by the
|
||||
/// frontend.
|
||||
FileSystem _buildFileSystem(List namedSources) {
|
||||
MemoryFileSystem fileSystem = new MemoryFileSystem(Uri.parse('file:///'));
|
||||
|
|
|
@ -119,7 +119,7 @@ Future<bool> computeSummary(List<String> args,
|
|||
var multiRoots = parsedArgs['multi-root'].map(Uri.base.resolve).toList();
|
||||
if (multiRoots.isEmpty) multiRoots.add(Uri.base);
|
||||
var fileSystem = new MultiRootFileSystem(parsedArgs['multi-root-scheme'],
|
||||
multiRoots, fe.PhysicalFileSystem.instance);
|
||||
multiRoots, fe.StandardFileSystem.instance);
|
||||
var sources = parsedArgs['source'].map(Uri.parse).toList();
|
||||
var state = await fe.initializeCompiler(
|
||||
// TODO(sigmund): pass an old state once we can make use of it.
|
||||
|
|
Loading…
Reference in a new issue