mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Change assert_bundle_package_font_test to memory file system This is to work towards being able to run the tests without `-j1` (#21113). These tests were using the real filesystem and setting/relying on fs.currentDirectory. There was a comment about this being because the memory provider didnt' support POSIX and Windows, however that seems to have changed since (and many other asset tests already do something similar to this). * Trim trailing whitespace * Add a workaround for Windows path slash directions Strictly this is correct, but the real FS can tolerate either path. The in-memory file system is more strict (see https://github.com/google/file.dart/issues/112). * Extract a helper for writing schema files in tests * Missed file when saving! * Remove redundant comment * Rename writeBasicSchema -> writeEmptySchema * Use the file we already have to write contents * Make comments more descriptive * Remove another dupe of writeSchema to use the shared one * Rename schema -> pubspec_schema * Trim whitespace
21 lines
756 B
Dart
21 lines
756 B
Dart
import 'package:file/file.dart';
|
|
import 'package:flutter_tools/src/base/file_system.dart';
|
|
import 'package:flutter_tools/src/flutter_manifest.dart';
|
|
|
|
/// Writes a schemaData used for validating pubspec.yaml files when parsing
|
|
/// asset information.
|
|
void writeSchemaFile(FileSystem filesystem, String schemaData) {
|
|
final String schemaPath = buildSchemaPath(filesystem);
|
|
final File schemaFile = filesystem.file(schemaPath);
|
|
|
|
final String schemaDir = buildSchemaDir(filesystem);
|
|
|
|
filesystem.directory(schemaDir).createSync(recursive: true);
|
|
schemaFile.writeAsStringSync(schemaData);
|
|
}
|
|
|
|
/// Writes an empty schemaData that will validate any pubspec.yaml file.
|
|
void writeEmptySchemaFile(FileSystem filesystem) {
|
|
writeSchemaFile(filesystem, '{}');
|
|
}
|