[flutter_tools] remove unused JSON schema (#70480)

This commit is contained in:
Jonah Williams
2020-11-13 13:02:40 -08:00
committed by GitHub
parent 477a4241ea
commit f98c468317
9 changed files with 0 additions and 218 deletions

View File

@@ -29,7 +29,6 @@ import 'package:process/process.dart';
import '../../src/common.dart';
import '../../src/context.dart';
import '../../src/mocks.dart';
import '../../src/pubspec_schema.dart';
void main() {
Cache.flutterRoot = getFlutterRoot();
@@ -553,8 +552,6 @@ include ':app'
manifestFile.createSync(recursive: true);
manifestFile.writeAsStringSync(manifest);
// write schemaData otherwise pubspec.yaml file can't be loaded
writeEmptySchemaFile(fs);
updateLocalProperties(
project: FlutterProject.fromPath('path/to/project'),

View File

@@ -14,7 +14,6 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import '../src/common.dart';
import '../src/context.dart';
import '../src/pubspec_schema.dart';
void main() {
String fixPath(String path) {
@@ -106,8 +105,6 @@ $fontsSection
});
testUsingContext('App includes neither font manifest nor fonts when no defines fonts', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
writePubspecFile('p/p/pubspec.yaml', 'test_package');
@@ -122,8 +119,6 @@ $fontsSection
});
testUsingContext('App font uses font file from package', () async {
writeEmptySchemaFile(globals.fs);
const String fontsSection = '''
- family: foo
fonts:
@@ -150,8 +145,6 @@ $fontsSection
});
testUsingContext('App font uses local font file and package font file', () async {
writeEmptySchemaFile(globals.fs);
const String fontsSection = '''
- family: foo
fonts:
@@ -182,8 +175,6 @@ $fontsSection
});
testUsingContext('App uses package font with own font file', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
const String fontsSection = '''
@@ -215,8 +206,6 @@ $fontsSection
});
testUsingContext('App uses package font with font file from another package', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/\ntest_package2:p2/p/lib/');
const String fontsSection = '''
@@ -249,8 +238,6 @@ $fontsSection
});
testUsingContext('App uses package font with properties and own font file', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -284,8 +271,6 @@ $fontsSection
});
testUsingContext('App uses local font and package font with own font file.', () async {
writeEmptySchemaFile(globals.fs);
const String fontsSection = '''
- family: foo
fonts:

View File

@@ -14,7 +14,6 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import '../src/common.dart';
import '../src/context.dart';
import '../src/pubspec_schema.dart';
void main() {
String fixPath(String path) {
@@ -115,8 +114,6 @@ $assetsSection
group('AssetBundle assets from packages', () {
testUsingContext('No assets are bundled when the package has no assets', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
writePubspecFile('p/p/pubspec.yaml', 'test_package');
@@ -139,8 +136,6 @@ $assetsSection
});
testUsingContext('No assets are bundled when the package has an asset that is not listed', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
writePubspecFile('p/p/pubspec.yaml', 'test_package');
@@ -167,8 +162,6 @@ $assetsSection
testUsingContext('One asset is bundled when the package has and lists one '
'asset its pubspec', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -195,8 +188,6 @@ $assetsSection
testUsingContext('One asset is bundled when the package has one asset, '
"listed in the app's pubspec", () async {
writeEmptySchemaFile(globals.fs);
final List<String> assetEntries = <String>['packages/test_package/a/foo'];
writePubspecFile(
'pubspec.yaml',
@@ -223,8 +214,6 @@ $assetsSection
testUsingContext('One asset and its variant are bundled when the package '
'has an asset and a variant, and lists the asset in its pubspec', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
writePubspecFile(
@@ -251,8 +240,6 @@ $assetsSection
testUsingContext('One asset and its variant are bundled when the package '
'has an asset and a variant, and the app lists the asset in its pubspec', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile(
'pubspec.yaml',
'test',
@@ -282,8 +269,6 @@ $assetsSection
testUsingContext('Two assets are bundled when the package has and lists '
'two assets in its pubspec', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -310,8 +295,6 @@ $assetsSection
});
testUsingContext("Two assets are bundled when the package has two assets, listed in the app's pubspec", () async {
writeEmptySchemaFile(globals.fs);
final List<String> assetEntries = <String>[
'packages/test_package/a/foo',
'packages/test_package/a/bar',
@@ -345,8 +328,6 @@ $assetsSection
});
testUsingContext('Two assets are bundled when two packages each have and list an asset their pubspec', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile(
'pubspec.yaml',
'test',
@@ -384,8 +365,6 @@ $assetsSection
});
testUsingContext("Two assets are bundled when two packages each have an asset, listed in the app's pubspec", () async {
writeEmptySchemaFile(globals.fs);
final List<String> assetEntries = <String>[
'packages/test_package/a/foo',
'packages/test_package2/a/foo',
@@ -427,7 +406,6 @@ $assetsSection
testUsingContext('One asset is bundled when the app depends on a package, '
'listing in its pubspec an asset from another package', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile(
'pubspec.yaml',
'test',
@@ -462,8 +440,6 @@ $assetsSection
});
testUsingContext('Asset paths can contain URL reserved characters', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -491,8 +467,6 @@ $assetsSection
group('AssetBundle assets from scanned paths', () {
testUsingContext('Two assets are bundled when scanning their directory', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -521,8 +495,6 @@ $assetsSection
});
testUsingContext('Two assets are bundled when listing one and scanning second directory', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -551,8 +523,6 @@ $assetsSection
});
testUsingContext('One asset is bundled with variant, scanning wrong directory', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -580,8 +550,6 @@ $assetsSection
group('AssetBundle assets from scanned paths with MemoryFileSystem', () {
testUsingContext('One asset is bundled with variant, scanning directory', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -609,8 +577,6 @@ $assetsSection
});
testUsingContext('No asset is bundled with variant, no assets or directories are listed', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
@@ -637,8 +603,6 @@ $assetsSection
});
testUsingContext('Expect error generating manifest, wrong non-existing directory is listed', () async {
writeEmptySchemaFile(globals.fs);
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');

View File

@@ -14,7 +14,6 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import '../src/common.dart';
import '../src/context.dart';
import '../src/pubspec_schema.dart';
void main() {
String fixPath(String path) {
@@ -38,10 +37,6 @@ void main() {
});
testUsingContext('main asset and variants', () async {
// Setting flutterRoot here so that it picks up the MemoryFileSystem's
// path separator.
writeEmptySchemaFile(globals.fs);
globals.fs.file('pubspec.yaml')
..createSync()
..writeAsStringSync(

View File

@@ -19,7 +19,6 @@ import 'package:process/process.dart';
import '../../src/common.dart';
import '../../src/context.dart';
import '../../src/mocks.dart' as mocks;
import '../../src/pubspec_schema.dart';
const String xcodebuild = '/usr/bin/xcodebuild';
@@ -803,9 +802,6 @@ Information about project "Runner":
manifestFile.createSync(recursive: true);
manifestFile.writeAsStringSync(manifestString);
// write schemaData otherwise pubspec.yaml file can't be loaded
writeEmptySchemaFile(fs);
await updateGeneratedXcodeProperties(
project: FlutterProject.fromPath('path/to/project'),
buildInfo: buildInfo,

View File

@@ -792,10 +792,6 @@ void _testInMemory(String description, Future<void> testMethod()) {
.childDirectory('packages')
.childDirectory('flutter_tools')
.childDirectory('templates'), testFileSystem);
transfer(globals.fs.directory(Cache.flutterRoot)
.childDirectory('packages')
.childDirectory('flutter_tools')
.childDirectory('schema'), testFileSystem);
// Set up enough of the packages to satisfy the templating code.
final File packagesFile = testFileSystem.directory(Cache.flutterRoot)
.childDirectory('packages')

View File

@@ -2,31 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/flutter_manifest.dart';
import 'package:meta/meta.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:yaml/yaml.dart';
import 'common.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, '{}');
}
/// Check if the pubspec.yaml file under the `projectDir` is valid for a plugin project.
void validatePubspecForPlugin({@required String projectDir, @required String pluginClass, @required List<String> expectedPlatforms, List<String> unexpectedPlatforms = const <String>[], String androidIdentifier, String webFileName}) {
final FlutterManifest manifest = FlutterManifest.createFromPath(projectDir+'/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger);