Move Flutter.podspec to add-to-app project template (#71103)

This commit is contained in:
Jenn Magder 2020-11-24 10:16:09 -08:00 committed by GitHub
parent e5c43848a7
commit 9bbc2177ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 12 deletions

View file

@ -116,7 +116,6 @@ is set to release or run \"flutter build ios --release\", then re-run Archive fr
local flutter_engine_flag=""
local local_engine_flag=""
local flutter_framework="${framework_path}/Flutter.framework"
local flutter_podspec="${framework_path}/Flutter.podspec"
if [[ -n "$FLUTTER_ENGINE" ]]; then
flutter_engine_flag="--local-engine-src-path=${FLUTTER_ENGINE}"
@ -137,7 +136,6 @@ is set to release or run \"flutter build ios --release\", then re-run Archive fr
fi
local_engine_flag="--local-engine=${LOCAL_ENGINE}"
flutter_framework="${FLUTTER_ENGINE}/out/${LOCAL_ENGINE}/Flutter.framework"
flutter_podspec="${FLUTTER_ENGINE}/out/${LOCAL_ENGINE}/Flutter.podspec"
fi
local bitcode_flag=""
@ -147,9 +145,7 @@ is set to release or run \"flutter build ios --release\", then re-run Archive fr
# TODO(jmagman): use assemble copied engine in add-to-app.
if [[ -e "${project_path}/.ios" ]]; then
RunCommand rm -rf -- "${derived_dir}/engine"
mkdir "${derived_dir}/engine"
RunCommand cp -r -- "${flutter_podspec}" "${derived_dir}/engine"
RunCommand rm -rf -- "${derived_dir}/engine/Flutter.framework"
RunCommand cp -r -- "${flutter_framework}" "${derived_dir}/engine"
fi

View file

@ -653,7 +653,7 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
}
void copyEngineArtifactToProject(BuildMode mode) {
// Copy podspec and framework from engine cache. The actual build mode
// Copy framework from engine cache. The actual build mode
// doesn't actually matter as it will be overwritten by xcode_backend.sh.
// However, cocoapods will run before that script and requires something
// to be in this location.
@ -665,12 +665,10 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
)
);
if (framework.existsSync()) {
final File podspec = framework.parent.childFile('Flutter.podspec');
globals.fsUtils.copyDirectorySync(
framework,
engineCopyDirectory.childDirectory('Flutter.framework'),
);
podspec.copySync(engineCopyDirectory.childFile('Flutter.podspec').path);
}
}

View file

@ -0,0 +1,18 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
#
Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.description = <<-DESC
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
DESC
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.vendored_frameworks = 'Flutter.framework'
end

View file

@ -30,13 +30,13 @@ end
def install_flutter_engine_pod
current_directory = File.expand_path('..', __FILE__)
engine_dir = File.expand_path('engine', current_directory)
if !File.exist?(engine_dir)
framework_name = 'Flutter.framework'
copied_engine = File.expand_path(framework_name, engine_dir)
if !File.exist?(copied_engine)
# Copy the debug engine to have something to link against if the xcode backend script has not run yet.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
debug_framework_dir = File.join(flutter_root, 'bin', 'cache', 'artifacts', 'engine', 'ios')
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)
FileUtils.cp_r(File.join(debug_framework_dir, framework_name), engine_dir)
end
# Keep pod path relative so it can be checked into Podfile.lock.

View file

@ -176,6 +176,7 @@
"templates/module/ios/host_app_ephemeral/Config.tmpl/Debug.xcconfig",
"templates/module/ios/host_app_ephemeral/Config.tmpl/Flutter.xcconfig",
"templates/module/ios/host_app_ephemeral/Config.tmpl/Release.xcconfig",
"templates/module/ios/host_app_ephemeral/Flutter/engine/Flutter.podspec.tmpl",
"templates/module/ios/host_app_ephemeral/Runner.tmpl/AppDelegate.h",
"templates/module/ios/host_app_ephemeral/Runner.tmpl/AppDelegate.m",
"templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Contents.json",

View file

@ -134,6 +134,7 @@ void main() {
'.gitignore',
'.ios/Flutter',
'.ios/Flutter/flutter_project.podspec',
'.ios/Flutter/engine/Flutter.podspec',
'.metadata',
'lib/main.dart',
'pubspec.yaml',