Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
5b58d5c5
Unverified
Commit
5b58d5c5
authored
Apr 15, 2022
by
Jenn Magder
Committed by
GitHub
Apr 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude armv7 from iOS add-to-app plugins (#101943)
parent
607db54a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
156 additions
and
19 deletions
+156
-19
module_test_ios.dart
dev/devicelab/bin/tasks/module_test_ios.dart
+109
-2
Podfile
dev/integration_tests/ios_add2app_life_cycle/Podfile
+4
-0
Podfile
dev/integration_tests/ios_host_app_swift/Podfile
+4
-0
podhelper.rb.tmpl
...mplates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl
+39
-17
No files found.
dev/devicelab/bin/tasks/module_test_ios.dart
View file @
5b58d5c5
...
...
@@ -265,11 +265,36 @@ dependencies:
final
File
objectiveCAnalyticsOutputFile
=
File
(
path
.
join
(
tempDir
.
path
,
'analytics-objc.log'
));
final
Directory
objectiveCBuildDirectory
=
Directory
(
path
.
join
(
tempDir
.
path
,
'build-objc'
));
section
(
'Build iOS Objective-C host app'
);
final
File
dummyAppFramework
=
File
(
path
.
join
(
projectDir
.
path
,
'.ios'
,
'Flutter'
,
'App.framework'
,
'App'
));
checkFileNotExists
(
dummyAppFramework
.
path
);
await
inDirectory
(
objectiveCHostApp
,
()
async
{
section
(
'Validate iOS Objective-C host app Podfile'
);
final
File
podfile
=
File
(
path
.
join
(
objectiveCHostApp
.
path
,
'Podfile'
));
String
podfileContent
=
await
podfile
.
readAsString
();
final
String
podFailure
=
await
eval
(
'pod'
,
<
String
>[
'install'
],
environment:
<
String
,
String
>{
'LANG'
:
'en_US.UTF-8'
,
},
canFail:
true
,
);
if
(!
podFailure
.
contains
(
'Missing `flutter_post_install(installer)` in Podfile `post_install` block'
)
||
!
podFailure
.
contains
(
'Add `flutter_post_install(installer)` to your Podfile `post_install` block to build Flutter plugins'
))
{
print
(
podfileContent
);
throw
TaskResult
.
failure
(
'pod install unexpectedly succeed without "flutter_post_install" post_install block'
);
}
podfileContent
=
'''
$podfileContent
post_install do |installer|
flutter_post_install(installer)
end
'''
;
await
podfile
.
writeAsString
(
podfileContent
,
flush:
true
);
await
exec
(
'pod'
,
<
String
>[
'install'
],
...
...
@@ -298,6 +323,8 @@ dependencies:
throw
TaskResult
.
failure
(
'Minimum version set to
$version
, expected 9.0'
);
}
section
(
'Build iOS Objective-C host app'
);
await
exec
(
'xcodebuild'
,
<
String
>[
...
...
@@ -378,6 +405,86 @@ dependencies:
);
}
section
(
'Archive iOS Objective-C host app'
);
await
inDirectory
(
objectiveCHostApp
,
()
async
{
final
Directory
objectiveCBuildArchiveDirectory
=
Directory
(
path
.
join
(
tempDir
.
path
,
'build-objc-archive'
));
await
exec
(
'xcodebuild'
,
<
String
>[
'-workspace'
,
'Host.xcworkspace'
,
'-scheme'
,
'Host'
,
'-configuration'
,
'Release'
,
'CODE_SIGNING_ALLOWED=NO'
,
'CODE_SIGNING_REQUIRED=NO'
,
'CODE_SIGN_IDENTITY=-'
,
'EXPANDED_CODE_SIGN_IDENTITY=-'
,
'-archivePath'
,
objectiveCBuildArchiveDirectory
.
path
,
'COMPILER_INDEX_STORE_ENABLE=NO'
,
'archive'
],
environment:
<
String
,
String
>
{
'FLUTTER_ANALYTICS_LOG_FILE'
:
objectiveCAnalyticsOutputFile
.
path
,
},
);
final
String
archivedAppPath
=
path
.
join
(
'
${objectiveCBuildArchiveDirectory.path}
.xcarchive'
,
'Products'
,
'Applications'
,
'Host.app'
,
);
checkFileExists
(
path
.
join
(
archivedAppPath
,
'Host'
,
));
checkFileNotExists
(
path
.
join
(
archivedAppPath
,
'Frameworks'
,
'App.framework'
,
'flutter_assets'
,
'isolate_snapshot_data'
,
));
final
String
builtFlutterBinary
=
path
.
join
(
archivedAppPath
,
'Frameworks'
,
'Flutter.framework'
,
'Flutter'
,
);
checkFileExists
(
builtFlutterBinary
);
if
((
await
fileType
(
builtFlutterBinary
)).
contains
(
'armv7'
))
{
throw
TaskResult
.
failure
(
'Unexpected armv7 architecture slice in
$builtFlutterBinary
'
);
}
await
containsBitcode
(
builtFlutterBinary
);
final
String
builtAppBinary
=
path
.
join
(
archivedAppPath
,
'Frameworks'
,
'App.framework'
,
'App'
,
);
checkFileExists
(
builtAppBinary
);
if
((
await
fileType
(
builtAppBinary
)).
contains
(
'armv7'
))
{
throw
TaskResult
.
failure
(
'Unexpected armv7 architecture slice in
$builtAppBinary
'
);
}
await
containsBitcode
(
builtAppBinary
);
// The host app example builds plugins statically, url_launcher_ios.framework
// should not exist.
checkDirectoryNotExists
(
path
.
join
(
archivedAppPath
,
'Frameworks'
,
'url_launcher_ios.framework'
,
));
});
section
(
'Run platform unit tests'
);
final
String
resultBundleTemp
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_module_test_ios_xcresult.'
).
path
;
...
...
dev/integration_tests/ios_add2app_life_cycle/Podfile
View file @
5b58d5c5
...
...
@@ -13,3 +13,7 @@ target 'ios_add2appTests' do
install_flutter_engine_pod
pod
'EarlGreyTest'
end
post_install
do
|
installer
|
flutter_post_install
(
installer
)
end
dev/integration_tests/ios_host_app_swift/Podfile
View file @
5b58d5c5
...
...
@@ -6,3 +6,7 @@ load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target
'Host'
do
install_all_flutter_pods
flutter_application_path
end
post_install
do
|
installer
|
flutter_post_install
(
installer
)
end
packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl
View file @
5b58d5c5
...
...
@@ -15,6 +15,21 @@ require 'json'
# Optional, defaults to two levels up from the directory of this script.
# MyApp/my_flutter/.ios/Flutter/../..
def install_all_flutter_pods(flutter_application_path = nil)
# defined_in_file is a Pathname to the Podfile set by CocoaPods.
pod_contents = File.read(defined_in_file)
unless pod_contents.include? 'flutter_post_install'
puts <<~POSTINSTALL
Add `flutter_post_install(installer)` to your Podfile `post_install` block to build Flutter plugins:
post_install do |installer|
flutter_post_install(installer)
end
POSTINSTALL
raise 'Missing `flutter_post_install(installer)` in Podfile `post_install` block'
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_application_path ||= File.join('..', '..')
install_flutter_engine_pod
install_flutter_plugin_pods(flutter_application_path)
...
...
@@ -46,7 +61,7 @@ def install_flutter_engine_pod
# Keep pod path relative so it can be checked into Podfile.lock.
# Process will be run from project directory.
engine_pathname = Pathname.new engine_dir
# defined_in_file is
set by CocoaPods and is a Pathname to the Podfile
.
# defined_in_file is
a Pathname to the Podfile set by CocoaPods
.
project_directory_pathname = defined_in_file.dirname
relative = engine_pathname.relative_path_from project_directory_pathname
...
...
@@ -77,7 +92,9 @@ def install_flutter_plugin_pods(flutter_application_path)
FileUtils.mkdir_p(symlinks_dir)
plugins_file = File.expand_path('.flutter-plugins-dependencies', flutter_application_path)
plugin_pods = flutter_parse_dependencies_file_for_ios_plugin(plugins_file)
# flutter_parse_plugins_file is in Flutter root podhelper.rb
plugin_pods = flutter_parse_plugins_file(plugins_file, 'ios')
plugin_pods.each do |plugin_hash|
plugin_name = plugin_hash['name']
plugin_path = plugin_hash['path']
...
...
@@ -127,21 +144,6 @@ def install_flutter_application_pod(flutter_application_path)
:execution_position => :before_compile
end
# .flutter-plugins-dependencies format documented at
# https://flutter.dev/go/plugins-list-migration
def flutter_parse_dependencies_file_for_ios_plugin(file)
file_path = File.expand_path(file)
return [] unless File.exists? file_path
dependencies_file = File.read(file)
dependencies_hash = JSON.parse(dependencies_file)
# dependencies_hash.dig('plugins', 'ios') not available until Ruby 2.3
return [] unless dependencies_hash.has_key?('plugins')
return [] unless dependencies_hash['plugins'].has_key?('ios')
dependencies_hash['plugins']['ios'] || []
end
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', '..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
...
...
@@ -155,3 +157,23 @@ def flutter_root
# This should never happen...
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
# Run the post-install script to set build settings on Flutter plugins.
#
# @example
# post_install do |installer|
# flutter_post_install(installer)
# end
# @param [Pod::Installer] installer Passed to the `post_install` block.
# @param [boolean] skip Do not change any build configurations. Set to suppress
# "Missing `flutter_post_install" exception.
def flutter_post_install(installer, skip: false)
return if skip
installer.pods_project.targets.each do |target|
target.build_configurations.each do |build_configuration|
# flutter_additional_ios_build_settings is in Flutter root podhelper.rb
flutter_additional_ios_build_settings(target)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment