Make the template plugin example depend on the plugin as a real dependency (#50485)
This commit is contained in:
@@ -25,6 +25,11 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
{{#withPluginHook}}
|
||||
{{pluginProjectName}}:
|
||||
path: ../
|
||||
{{/withPluginHook}}
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^0.1.2
|
||||
@@ -38,11 +43,6 @@ dev_dependencies:
|
||||
test: 1.9.4
|
||||
{{/withDriverTest}}
|
||||
|
||||
{{#withPluginHook}}
|
||||
{{pluginProjectName}}:
|
||||
path: ../
|
||||
{{/withPluginHook}}
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:process/process.dart';
|
||||
import 'package:pubspec_parse/pubspec_parse.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
import '../../src/context.dart';
|
||||
@@ -325,6 +326,25 @@ void main() {
|
||||
Pub: () => const Pub(),
|
||||
});
|
||||
|
||||
testUsingContext('plugin example app depends on plugin', () async {
|
||||
await _createProject(
|
||||
projectDir,
|
||||
<String>['--template=plugin', '-i', 'objc', '-a', 'java'],
|
||||
<String>[
|
||||
'example/pubspec.yaml',
|
||||
],
|
||||
);
|
||||
final String rawPubspec = await projectDir.childDirectory('example').childFile('pubspec.yaml').readAsString();
|
||||
final Pubspec pubspec = Pubspec.parse(rawPubspec);
|
||||
final String pluginName = projectDir.basename;
|
||||
expect(pubspec.dependencies, contains(pluginName));
|
||||
expect(pubspec.dependencies[pluginName] is PathDependency, isTrue);
|
||||
final PathDependency pathDependency = pubspec.dependencies[pluginName] as PathDependency;
|
||||
expect(pathDependency.path, '../');
|
||||
}, overrides: <Type, Generator>{
|
||||
Pub: () => const Pub(),
|
||||
});
|
||||
|
||||
testUsingContext('kotlin/swift plugin project', () async {
|
||||
return _createProject(
|
||||
projectDir,
|
||||
|
||||
Reference in New Issue
Block a user