Support materializing Flutter module host app on iOS (#21276)
* Prototype * Fix paths to Flutter library resources * Invoke pod install as necessary for materialized modules * Add devicelab test for module use on iOS * Remove debug output * Rebase, reame materialize editable * Add devicelab test editable iOS host app * Removed add2app test section
This commit is contained in:
committed by
Dan Field
parent
5c07e6dff7
commit
a600fe7f13
@@ -0,0 +1,2 @@
|
||||
#include "../../.ios/Flutter/Generated.xcconfig"
|
||||
ENABLE_BITCODE=NO
|
||||
@@ -36,15 +36,15 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
|
||||
741F495E21355F27001E2961 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/engine/Flutter.framework; sourceTree = "<group>"; };
|
||||
741F496521356807001E2961 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = ../.ios/Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
|
||||
741F495E21355F27001E2961 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = ../.ios/Flutter/engine/Flutter.framework; sourceTree = "<group>"; };
|
||||
741F496521356807001E2961 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = ../.ios/Flutter/App.framework; sourceTree = "<group>"; };
|
||||
74974046213559DB008C567A /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
74974047213559DB008C567A /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
7497404A213559E7008C567A /* Flutter.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Flutter.xcconfig; sourceTree = "<group>"; };
|
||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = ../.ios/Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
|
||||
@@ -2,5 +2,5 @@ platform :ios, '8.0'
|
||||
|
||||
target 'Runner' do
|
||||
flutter_application_path = '../'
|
||||
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')))
|
||||
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
|
||||
end
|
||||
|
||||
@@ -20,11 +20,6 @@ def parse_KV_file(file, separator='=')
|
||||
return pods_array
|
||||
end
|
||||
|
||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
||||
# referring to absolute paths on developers' machines.
|
||||
system('rm -rf .symlinks')
|
||||
system('mkdir -p .symlinks/plugins')
|
||||
|
||||
def flutter_root(f)
|
||||
generated_xcode_build_settings = parse_KV_file(File.join(f, File.join('.ios', 'Flutter', 'Generated.xcconfig')))
|
||||
if generated_xcode_build_settings.empty?
|
||||
@@ -38,32 +33,26 @@ def flutter_root(f)
|
||||
}
|
||||
end
|
||||
|
||||
framework_dir = File.join(File.expand_path(File.dirname(__FILE__)), 'Flutter')
|
||||
framework_dir = File.join(flutter_application_path, '.ios', 'Flutter')
|
||||
|
||||
engine_dir = File.join(framework_dir, 'engine')
|
||||
if !File.exist?(engine_dir)
|
||||
# Copy the debug engine to have something to link against if the xcode backend script has not run yet.
|
||||
debug_framework_dir = File.join(flutter_root(flutter_application_path), 'bin', 'cache', 'artifacts', 'engine', 'ios')
|
||||
FileUtils.mkdir(engine_dir)
|
||||
FileUtils.mkdir_p(engine_dir)
|
||||
FileUtils.cp_r(File.join(debug_framework_dir, 'Flutter.framework'), engine_dir)
|
||||
FileUtils.cp(File.join(debug_framework_dir, 'Flutter.podspec'), engine_dir)
|
||||
end
|
||||
|
||||
symlink = File.join('.symlinks', 'flutter')
|
||||
|
||||
File.symlink(framework_dir, symlink)
|
||||
pod 'Flutter', :path => File.join(symlink, 'engine')
|
||||
|
||||
pod 'Flutter', :path => engine_dir
|
||||
pod 'FlutterPluginRegistrant', :path => File.join(framework_dir, 'FlutterPluginRegistrant')
|
||||
|
||||
symlinks_dir = File.join(framework_dir, '.symlinks')
|
||||
FileUtils.mkdir_p(symlinks_dir)
|
||||
plugin_pods = parse_KV_file(File.join(flutter_application_path, '.flutter-plugins'))
|
||||
|
||||
plugin_pods.map { |r|
|
||||
symlink = File.join('.symlinks', 'plugins', r[:name])
|
||||
|
||||
symlink = File.join(symlinks_dir, r[:name])
|
||||
FileUtils.rm_f(symlink)
|
||||
File.symlink(r[:path], symlink)
|
||||
pod r[:name], :path => File.join(symlink, 'ios')
|
||||
}
|
||||
|
||||
symlink = File.join('.symlinks', 'FlutterApp')
|
||||
File.symlink(File.absolute_path(flutter_application_path), symlink)
|
||||
|
||||
pod 'FlutterPluginRegistrant', :path => File.join(symlink, '.ios', 'Flutter','FlutterPluginRegistrant')
|
||||
|
||||
Reference in New Issue
Block a user