mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fix broken Flutter module with plugins (#20496)
This commit is contained in:
parent
ba723b6038
commit
e69b434602
@ -31,6 +31,17 @@ Future<Null> main() async {
|
||||
);
|
||||
});
|
||||
|
||||
section('Add plugins');
|
||||
|
||||
final File pubspec = new File(path.join(directory.path, 'hello', 'pubspec.yaml'));
|
||||
String content = await pubspec.readAsString();
|
||||
content = content.replaceFirst(
|
||||
'\ndependencies:\n',
|
||||
'\ndependencies:\n battery:\n package_info:\n',
|
||||
);
|
||||
await pubspec.writeAsString(content, flush: true);
|
||||
|
||||
|
||||
section('Build Flutter module library archive');
|
||||
|
||||
await inDirectory(new Directory(path.join(directory.path, 'hello', '.android')), () async {
|
||||
|
@ -148,7 +148,7 @@ class CocoaPods {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Ensures the `ios` sub-project of the Flutter project at [appDirectory]
|
||||
/// Ensures the given iOS sub-project of a parent Flutter project
|
||||
/// contains a suitable `Podfile` and that its `Flutter/Xxx.xcconfig` files
|
||||
/// include pods configuration.
|
||||
void setupPodfile(IosProject iosProject) {
|
||||
@ -156,13 +156,14 @@ class CocoaPods {
|
||||
// Don't do anything for iOS when host platform doesn't support it.
|
||||
return;
|
||||
}
|
||||
if (!iosProject.directory.existsSync()) {
|
||||
final Directory runnerProject = iosProject.directory.childDirectory('Runner.xcodeproj');
|
||||
if (!runnerProject.existsSync()) {
|
||||
return;
|
||||
}
|
||||
final File podfile = iosProject.podfile;
|
||||
if (!podfile.existsSync()) {
|
||||
final bool isSwift = xcodeProjectInterpreter.getBuildSettings(
|
||||
iosProject.directory.childFile('Runner.xcodeproj').path,
|
||||
runnerProject.path,
|
||||
'Runner',
|
||||
).containsKey('SWIFT_VERSION');
|
||||
final File podfileTemplate = fs.file(fs.path.join(
|
||||
|
@ -12,6 +12,7 @@ import io.flutter.plugin.common.BasicMessageChannel;
|
||||
import io.flutter.plugin.common.StringCodec;
|
||||
import io.flutter.view.FlutterMain;
|
||||
import io.flutter.view.FlutterNativeView;
|
||||
import io.flutter.view.FlutterRunArguments;
|
||||
import io.flutter.view.FlutterView;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
|
||||
@ -91,8 +92,10 @@ public final class Flutter {
|
||||
lifecycle.addObserver(new LifecycleObserver() {
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
|
||||
public void onCreate() {
|
||||
final String appBundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
|
||||
flutterView.runFromBundle(appBundlePath, null, "main", true);
|
||||
final FlutterRunArguments arguments = new FlutterRunArguments();
|
||||
arguments.bundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
|
||||
arguments.entrypoint = "main";
|
||||
flutterView.runFromBundle(arguments);
|
||||
GeneratedPluginRegistrant.registerWith(flutterView.getPluginRegistry());
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ void main() {
|
||||
mockProcessManager = new MockProcessManager();
|
||||
mockXcodeProjectInterpreter = new MockXcodeProjectInterpreter();
|
||||
projectUnderTest = await FlutterProject.fromDirectory(fs.directory('project'));
|
||||
projectUnderTest.ios.directory.createSync(recursive: true);
|
||||
projectUnderTest.ios.directory.childDirectory('Runner.xcodeproj').createSync(recursive: true);
|
||||
cocoaPodsUnderTest = new CocoaPods();
|
||||
pretendPodVersionIs('1.5.0');
|
||||
fs.file(fs.path.join(
|
||||
|
Loading…
Reference in New Issue
Block a user