Migrate pubspec_schema to null safety (#83441)
This commit is contained in:
parent
e905dd2d67
commit
883cb3e830
@ -2,19 +2,24 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:flutter_tools/src/flutter_manifest.dart';
|
import 'package:flutter_tools/src/flutter_manifest.dart';
|
||||||
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:yaml/yaml.dart';
|
import 'package:yaml/yaml.dart';
|
||||||
|
|
||||||
import 'common.dart';
|
import 'common.dart';
|
||||||
|
|
||||||
/// Check if the pubspec.yaml file under the `projectDir` is valid for a plugin project.
|
/// 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}) {
|
void validatePubspecForPlugin({
|
||||||
final FlutterManifest manifest = FlutterManifest.createFromPath(projectDir+'/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger);
|
required String projectDir,
|
||||||
final YamlMap platformsMap = YamlMap.wrap(manifest.supportedPlatforms);
|
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)!;
|
||||||
|
final YamlMap platformsMap = YamlMap.wrap(manifest.supportedPlatforms!);
|
||||||
for (final String platform in expectedPlatforms) {
|
for (final String platform in expectedPlatforms) {
|
||||||
expect(platformsMap[platform], isNotNull);
|
expect(platformsMap[platform], isNotNull);
|
||||||
expect(platformsMap[platform]['pluginClass'], pluginClass);
|
expect(platformsMap[platform]['pluginClass'], pluginClass);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user