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
357d02c8
Unverified
Commit
357d02c8
authored
Oct 15, 2019
by
Jenn Magder
Committed by
GitHub
Oct 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always embed Flutter.framework build mode version from Xcode configuration (#42029)
parent
ad1d67e0
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
424 additions
and
210 deletions
+424
-210
.gitignore
.gitignore
+1
-0
deploy_gallery.sh
dev/bots/deploy_gallery.sh
+30
-0
.gitignore
...roid_splash_screens/splash_screen_kitchen_sink/.gitignore
+1
-0
.gitignore
...droid_splash_screens/splash_screen_load_rotate/.gitignore
+1
-0
.gitignore
...roid_splash_screens/splash_screen_trans_rotate/.gitignore
+1
-0
.gitignore
dev/integration_tests/android_views/ios/.gitignore
+1
-0
Podfile
dev/integration_tests/android_views/ios/Podfile
+49
-34
.gitignore
dev/integration_tests/release_smoke_test/.gitignore
+1
-0
Podfile
dev/integration_tests/release_smoke_test/ios/Podfile
+49
-34
Podfile
examples/flutter_gallery/ios/Podfile
+61
-23
Podfile
examples/platform_view/ios/Podfile
+55
-36
Podfile.lock
examples/platform_view/ios/Podfile.lock
+5
-12
xcode_backend.sh
packages/flutter_tools/bin/xcode_backend.sh
+1
-0
cocoapods.dart
packages/flutter_tools/lib/src/macos/cocoapods.dart
+38
-3
project.dart
packages/flutter_tools/lib/src/project.dart
+9
-0
.gitignore
packages/flutter_tools/templates/app/ios.tmpl/.gitignore
+1
-0
Podfile-ios-objc
packages/flutter_tools/templates/cocoapods/Podfile-ios-objc
+49
-34
Podfile-ios-swift
packages/flutter_tools/templates/cocoapods/Podfile-ios-swift
+49
-34
.gitignore.tmpl
packages/flutter_tools/templates/package/.gitignore.tmpl
+1
-0
cocoapods_test.dart
...lutter_tools/test/general.shard/macos/cocoapods_test.dart
+21
-0
No files found.
.gitignore
View file @
357d02c8
...
@@ -80,6 +80,7 @@ unlinked_spec.ds
...
@@ -80,6 +80,7 @@ unlinked_spec.ds
**/ios/.generated/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/app.zip
...
...
dev/bots/deploy_gallery.sh
View file @
357d02c8
...
@@ -54,6 +54,36 @@ if [[ "$SHARD" = "deploy_gallery" ]]; then
...
@@ -54,6 +54,36 @@ if [[ "$SHARD" = "deploy_gallery" ]]; then
(
(
cd
examples/flutter_gallery
cd
examples/flutter_gallery
flutter build ios
--release
--no-codesign
-t
lib/main_publish.dart
flutter build ios
--release
--no-codesign
-t
lib/main_publish.dart
# flutter build ios will run CocoaPods script. Check generated locations.
if
[[
!
-d
"ios/Pods"
]]
;
then
echo
"Error: pod install failed to setup plugins"
exit
1
fi
if
[[
!
-d
"ios/.symlinks/plugins"
]]
;
then
echo
"Error: pod install failed to setup plugin symlinks"
exit
1
fi
if
[[
-d
"ios/.symlinks/flutter"
]]
;
then
echo
"Error: pod install created flutter symlink"
exit
1
fi
if
[[
!
-d
"build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets"
]]
;
then
echo
"Error: flutter_assets not assembled"
exit
1
fi
if
[[
-d
"build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/isolate_snapshot_data"
||
-d
"build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin"
||
-d
"build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/vm_snapshot_data"
]]
;
then
echo
"Error: compiled debug version of app with --release flag"
exit
1
fi
)
)
echo
"iOS Flutter Gallery built"
echo
"iOS Flutter Gallery built"
if
[[
-z
"
$CIRRUS_PR
"
]]
;
then
if
[[
-z
"
$CIRRUS_PR
"
]]
;
then
...
...
dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/.gitignore
View file @
357d02c8
...
@@ -60,6 +60,7 @@
...
@@ -60,6 +60,7 @@
**/ios/.generated/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/app.zip
...
...
dev/integration_tests/android_splash_screens/splash_screen_load_rotate/.gitignore
View file @
357d02c8
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
**/ios/.generated/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/app.zip
...
...
dev/integration_tests/android_splash_screens/splash_screen_trans_rotate/.gitignore
View file @
357d02c8
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
**/ios/.generated/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/app.zip
...
...
dev/integration_tests/android_views/ios/.gitignore
View file @
357d02c8
...
@@ -38,6 +38,7 @@ Icon?
...
@@ -38,6 +38,7 @@ Icon?
/Flutter/flutter_assets/
/Flutter/flutter_assets/
/Flutter/App.framework
/Flutter/App.framework
/Flutter/Flutter.framework
/Flutter/Flutter.framework
/Flutter/Flutter.podspec
/Flutter/Generated.xcconfig
/Flutter/Generated.xcconfig
/Flutter/flutter_export_environment.sh
/Flutter/flutter_export_environment.sh
/ServiceDefinitions.json
/ServiceDefinitions.json
...
...
dev/integration_tests/android_views/ios/Podfile
View file @
357d02c8
...
@@ -15,51 +15,66 @@ def parse_KV_file(file, separator='=')
...
@@ -15,51 +15,66 @@ def parse_KV_file(file, separator='=')
if
!
File
.
exists?
file_abs_path
if
!
File
.
exists?
file_abs_path
return
[];
return
[];
end
end
pods_ary
=
[]
generated_key_values
=
{}
skip_line_start_symbols
=
[
"#"
,
"/"
]
skip_line_start_symbols
=
[
"#"
,
"/"
]
File
.
foreach
(
file_abs_path
)
{
|
line
|
File
.
foreach
(
file_abs_path
)
do
|
line
|
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
plugin
=
line
.
split
(
pattern
=
separator
)
plugin
=
line
.
split
(
pattern
=
separator
)
if
plugin
.
length
==
2
if
plugin
.
length
==
2
podname
=
plugin
[
0
].
strip
()
podname
=
plugin
[
0
].
strip
()
path
=
plugin
[
1
].
strip
()
path
=
plugin
[
1
].
strip
()
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
pods_ary
.
push
({
:name
=>
podname
,
:path
=>
podpath
});
generated_key_values
[
podname
]
=
podpath
else
else
puts
"Invalid plugin specification:
#{
line
}
"
puts
"Invalid plugin specification:
#{
line
}
"
end
end
}
end
return
pods_ary
generated_key_values
end
end
target
'Runner'
do
target
'Runner'
do
use_modular_headers!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# Flutter Pod
# referring to absolute paths on developers' machines.
system
(
'rm -rf .symlinks'
)
copied_flutter_dir
=
File
.
join
(
__dir__
,
'Flutter'
)
system
(
'mkdir -p .symlinks/plugins'
)
copied_framework_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.framework'
)
copied_podspec_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.podspec'
)
unless
File
.
exist?
(
copied_framework_path
)
&&
File
.
exist?
(
copied_podspec_path
)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path
=
File
.
join
(
copied_flutter_dir
,
'Generated.xcconfig'
)
unless
File
.
exist?
(
generated_xcode_build_settings_path
)
raise
"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings
=
parse_KV_file
(
generated_xcode_build_settings_path
)
cached_framework_dir
=
generated_xcode_build_settings
[
'FLUTTER_FRAMEWORK_DIR'
];
# Flutter Pods
unless
File
.
exist?
(
copied_framework_path
)
generated_xcode_build_settings
=
parse_KV_file
(
'./Flutter/Generated.xcconfig'
)
FileUtils
.
cp_r
(
File
.
join
(
cached_framework_dir
,
'Flutter.framework'
),
copied_flutter_dir
)
if
generated_xcode_build_settings
.
empty?
puts
"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end
end
generated_xcode_build_settings
.
map
{
|
p
|
unless
File
.
exist?
(
copied_podspec_path
)
if
p
[
:name
]
==
'FLUTTER_FRAMEWORK_DIR'
FileUtils
.
cp
(
File
.
join
(
cached_framework_dir
,
'Flutter.podspec'
),
copied_flutter_dir
)
symlink
=
File
.
join
(
'.symlinks'
,
'flutter'
)
File
.
symlink
(
File
.
dirname
(
p
[
:path
]),
symlink
)
pod
'Flutter'
,
:path
=>
File
.
join
(
symlink
,
File
.
basename
(
p
[
:path
]))
end
end
}
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod
'Flutter'
,
:path
=>
'Flutter'
# Plugin Pods
# Plugin Pods
# 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'
)
plugin_pods
=
parse_KV_file
(
'../.flutter-plugins'
)
plugin_pods
=
parse_KV_file
(
'../.flutter-plugins'
)
plugin_pods
.
map
{
|
p
|
plugin_pods
.
each
do
|
name
,
path
|
symlink
=
File
.
join
(
'.symlinks'
,
'plugins'
,
p
[
:name
]
)
symlink
=
File
.
join
(
'.symlinks'
,
'plugins'
,
name
)
File
.
symlink
(
p
[
:path
]
,
symlink
)
File
.
symlink
(
p
ath
,
symlink
)
pod
p
[
:name
]
,
:path
=>
File
.
join
(
symlink
,
'ios'
)
pod
name
,
:path
=>
File
.
join
(
symlink
,
'ios'
)
}
end
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
...
...
dev/integration_tests/release_smoke_test/.gitignore
View file @
357d02c8
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
**/ios/.generated/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/app.zip
...
...
dev/integration_tests/release_smoke_test/ios/Podfile
View file @
357d02c8
...
@@ -15,51 +15,66 @@ def parse_KV_file(file, separator='=')
...
@@ -15,51 +15,66 @@ def parse_KV_file(file, separator='=')
if
!
File
.
exists?
file_abs_path
if
!
File
.
exists?
file_abs_path
return
[];
return
[];
end
end
pods_ary
=
[]
generated_key_values
=
{}
skip_line_start_symbols
=
[
"#"
,
"/"
]
skip_line_start_symbols
=
[
"#"
,
"/"
]
File
.
foreach
(
file_abs_path
)
{
|
line
|
File
.
foreach
(
file_abs_path
)
do
|
line
|
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
plugin
=
line
.
split
(
pattern
=
separator
)
plugin
=
line
.
split
(
pattern
=
separator
)
if
plugin
.
length
==
2
if
plugin
.
length
==
2
podname
=
plugin
[
0
].
strip
()
podname
=
plugin
[
0
].
strip
()
path
=
plugin
[
1
].
strip
()
path
=
plugin
[
1
].
strip
()
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
pods_ary
.
push
({
:name
=>
podname
,
:path
=>
podpath
});
generated_key_values
[
podname
]
=
podpath
else
else
puts
"Invalid plugin specification:
#{
line
}
"
puts
"Invalid plugin specification:
#{
line
}
"
end
end
}
end
return
pods_ary
generated_key_values
end
end
target
'Runner'
do
target
'Runner'
do
use_modular_headers!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# Flutter Pod
# referring to absolute paths on developers' machines.
system
(
'rm -rf .symlinks'
)
copied_flutter_dir
=
File
.
join
(
__dir__
,
'Flutter'
)
system
(
'mkdir -p .symlinks/plugins'
)
copied_framework_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.framework'
)
copied_podspec_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.podspec'
)
unless
File
.
exist?
(
copied_framework_path
)
&&
File
.
exist?
(
copied_podspec_path
)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path
=
File
.
join
(
copied_flutter_dir
,
'Generated.xcconfig'
)
unless
File
.
exist?
(
generated_xcode_build_settings_path
)
raise
"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings
=
parse_KV_file
(
generated_xcode_build_settings_path
)
cached_framework_dir
=
generated_xcode_build_settings
[
'FLUTTER_FRAMEWORK_DIR'
];
# Flutter Pods
unless
File
.
exist?
(
copied_framework_path
)
generated_xcode_build_settings
=
parse_KV_file
(
'./Flutter/Generated.xcconfig'
)
FileUtils
.
cp_r
(
File
.
join
(
cached_framework_dir
,
'Flutter.framework'
),
copied_flutter_dir
)
if
generated_xcode_build_settings
.
empty?
puts
"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end
end
generated_xcode_build_settings
.
map
{
|
p
|
unless
File
.
exist?
(
copied_podspec_path
)
if
p
[
:name
]
==
'FLUTTER_FRAMEWORK_DIR'
FileUtils
.
cp
(
File
.
join
(
cached_framework_dir
,
'Flutter.podspec'
),
copied_flutter_dir
)
symlink
=
File
.
join
(
'.symlinks'
,
'flutter'
)
File
.
symlink
(
File
.
dirname
(
p
[
:path
]),
symlink
)
pod
'Flutter'
,
:path
=>
File
.
join
(
symlink
,
File
.
basename
(
p
[
:path
]))
end
end
}
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod
'Flutter'
,
:path
=>
'Flutter'
# Plugin Pods
# Plugin Pods
# 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'
)
plugin_pods
=
parse_KV_file
(
'../.flutter-plugins'
)
plugin_pods
=
parse_KV_file
(
'../.flutter-plugins'
)
plugin_pods
.
map
{
|
p
|
plugin_pods
.
each
do
|
name
,
path
|
symlink
=
File
.
join
(
'.symlinks'
,
'plugins'
,
p
[
:name
]
)
symlink
=
File
.
join
(
'.symlinks'
,
'plugins'
,
name
)
File
.
symlink
(
p
[
:path
]
,
symlink
)
File
.
symlink
(
p
ath
,
symlink
)
pod
p
[
:name
]
,
:path
=>
File
.
join
(
symlink
,
'ios'
)
pod
name
,
:path
=>
File
.
join
(
symlink
,
'ios'
)
}
end
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
...
...
examples/flutter_gallery/ios/Podfile
View file @
357d02c8
...
@@ -4,39 +4,77 @@
...
@@ -4,39 +4,77 @@
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV
[
'COCOAPODS_DISABLE_STATS'
]
=
'true'
ENV
[
'COCOAPODS_DISABLE_STATS'
]
=
'true'
def
parse_KV_file
(
file
,
separator
=
'='
)
project
'Runner'
,
{
'Debug'
=>
:debug
,
'Profile'
=>
:release
,
'Release'
=>
:release
,
}
def
parse_KV_file
(
file
,
separator
=
'='
)
file_abs_path
=
File
.
expand_path
(
file
)
file_abs_path
=
File
.
expand_path
(
file
)
if
!
File
.
exists?
file_abs_path
if
!
File
.
exists?
file_abs_path
return
[];
return
[];
end
end
pods_ary
=
[]
generated_key_values
=
{}
skip_line_start_symbols
=
[
"#"
,
"/"
]
skip_line_start_symbols
=
[
"#"
,
"/"
]
File
.
foreach
(
file_abs_path
)
{
|
line
|
File
.
foreach
(
file_abs_path
)
do
|
line
|
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
plugin
=
line
.
split
(
pattern
=
separator
)
plugin
=
line
.
split
(
pattern
=
separator
)
if
plugin
.
length
==
2
if
plugin
.
length
==
2
podname
=
plugin
[
0
].
strip
()
podname
=
plugin
[
0
].
strip
()
path
=
plugin
[
1
].
strip
()
path
=
plugin
[
1
].
strip
()
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
pods_ary
.
push
({
:name
=>
podname
,
:path
=>
podpath
});
generated_key_values
[
podname
]
=
podpath
else
else
puts
"Invalid plugin specification:
#{
line
}
"
puts
"Invalid plugin specification:
#{
line
}
"
end
end
}
end
return
pods_ary
generated_key_values
end
end
target
'Runner'
do
target
'Runner'
do
use_modular_headers!
use_modular_headers!
# Flutter Pods
# Flutter Pod
pod
'Flutter'
,
:path
=>
ENV
[
'FLUTTER_FRAMEWORK_DIR'
]
copied_flutter_dir
=
File
.
join
(
__dir__
,
'Flutter'
)
copied_framework_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.framework'
)
copied_podspec_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.podspec'
)
unless
File
.
exist?
(
copied_framework_path
)
&&
File
.
exist?
(
copied_podspec_path
)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path
=
File
.
join
(
copied_flutter_dir
,
'Generated.xcconfig'
)
unless
File
.
exist?
(
generated_xcode_build_settings_path
)
raise
"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings
=
parse_KV_file
(
generated_xcode_build_settings_path
)
cached_framework_dir
=
generated_xcode_build_settings
[
'FLUTTER_FRAMEWORK_DIR'
];
unless
File
.
exist?
(
copied_framework_path
)
FileUtils
.
cp_r
(
File
.
join
(
cached_framework_dir
,
'Flutter.framework'
),
copied_flutter_dir
)
end
unless
File
.
exist?
(
copied_podspec_path
)
FileUtils
.
cp
(
File
.
join
(
cached_framework_dir
,
'Flutter.podspec'
),
copied_flutter_dir
)
end
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod
'Flutter'
,
:path
=>
'Flutter'
# Plugin Pods
# Plugin Pods
plugin_pods
=
parse_KV_file
(
"../.flutter-plugins"
)
plugin_pods
.
map
{
|
p
|
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
pod
p
[
:name
],
:path
=>
File
.
expand_path
(
"ios"
,
p
[
:path
])
# referring to absolute paths on developers' machines.
}
system
(
'rm -rf .symlinks'
)
system
(
'mkdir -p .symlinks/plugins'
)
plugin_pods
=
parse_KV_file
(
'../.flutter-plugins'
)
plugin_pods
.
each
do
|
name
,
path
|
symlink
=
File
.
join
(
'.symlinks'
,
'plugins'
,
name
)
File
.
symlink
(
path
,
symlink
)
pod
name
,
:path
=>
File
.
join
(
symlink
,
'ios'
)
end
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
...
...
examples/platform_view/ios/Podfile
View file @
357d02c8
...
@@ -4,58 +4,77 @@
...
@@ -4,58 +4,77 @@
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV
[
'COCOAPODS_DISABLE_STATS'
]
=
'true'
ENV
[
'COCOAPODS_DISABLE_STATS'
]
=
'true'
project
'Runner'
,
{
'Debug'
=>
:debug
,
'Profile'
=>
:release
,
'Release'
=>
:release
,
}
def
parse_KV_file
(
file
,
separator
=
'='
)
def
parse_KV_file
(
file
,
separator
=
'='
)
file_abs_path
=
File
.
expand_path
(
file
)
file_abs_path
=
File
.
expand_path
(
file
)
if
!
File
.
exists?
file_abs_path
if
!
File
.
exists?
file_abs_path
return
[];
return
[];
end
end
pods_ary
=
[]
generated_key_values
=
{}
skip_line_start_symbols
=
[
"#"
,
"/"
]
skip_line_start_symbols
=
[
"#"
,
"/"
]
File
.
foreach
(
file_abs_path
)
{
|
line
|
File
.
foreach
(
file_abs_path
)
do
|
line
|
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
next
if
skip_line_start_symbols
.
any?
{
|
symbol
|
line
=~
/^\s*
#{
symbol
}
/
}
plugin
=
line
.
split
(
pattern
=
separator
)
plugin
=
line
.
split
(
pattern
=
separator
)
if
plugin
.
length
==
2
if
plugin
.
length
==
2
podname
=
plugin
[
0
].
strip
()
podname
=
plugin
[
0
].
strip
()
path
=
plugin
[
1
].
strip
()
path
=
plugin
[
1
].
strip
()
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
podpath
=
File
.
expand_path
(
"
#{
path
}
"
,
file_abs_path
)
pods_ary
.
push
({
:name
=>
podname
,
:path
=>
podpath
});
generated_key_values
[
podname
]
=
podpath
else
else
puts
"Invalid plugin specification:
#{
line
}
"
puts
"Invalid plugin specification:
#{
line
}
"
end
end
}
end
return
pods_ary
generated_key_values
end
end
target
'Runner'
do
target
'Runner'
do
use_modular_headers!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# Flutter Pod
# referring to absolute paths on developers' machines.
system
(
'rm -rf .symlinks'
)
copied_flutter_dir
=
File
.
join
(
__dir__
,
'Flutter'
)
system
(
'mkdir -p .symlinks/plugins'
)
copied_framework_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.framework'
)
copied_podspec_path
=
File
.
join
(
copied_flutter_dir
,
'Flutter.podspec'
)
unless
File
.
exist?
(
copied_framework_path
)
&&
File
.
exist?
(
copied_podspec_path
)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path
=
File
.
join
(
copied_flutter_dir
,
'Generated.xcconfig'
)
unless
File
.
exist?
(
generated_xcode_build_settings_path
)
raise
"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings
=
parse_KV_file
(
generated_xcode_build_settings_path
)
cached_framework_dir
=
generated_xcode_build_settings
[
'FLUTTER_FRAMEWORK_DIR'
];
# Flutter Pods
unless
File
.
exist?
(
copied_framework_path
)
generated_xcode_build_settings
=
parse_KV_file
(
'./Flutter/Generated.xcconfig'
)
FileUtils
.
cp_r
(
File
.
join
(
cached_framework_dir
,
'Flutter.framework'
),
copied_flutter_dir
)
if
generated_xcode_build_settings
.
empty?
puts
"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end
end
generated_xcode_build_settings
.
map
{
|
p
|
unless
File
.
exist?
(
copied_podspec_path
)
if
p
[
:name
]
==
'FLUTTER_FRAMEWORK_DIR'
FileUtils
.
cp
(
File
.
join
(
cached_framework_dir
,
'Flutter.podspec'
),
copied_flutter_dir
)
symlink
=
File
.
join
(
'.symlinks'
,
'flutter'
)
File
.
symlink
(
File
.
dirname
(
p
[
:path
]),
symlink
)
pod
'Flutter'
,
:path
=>
File
.
join
(
symlink
,
File
.
basename
(
p
[
:path
]))
end
end
}
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod
'Flutter'
,
:path
=>
'Flutter'
# Plugin Pods
# Plugin Pods
plugin_pods
=
parse_KV_file
(
'../.flutter-plugins'
)
plugin_pods
.
map
{
|
p
|
symlink
=
File
.
join
(
'.symlinks'
,
'plugins'
,
p
[
:name
])
File
.
symlink
(
p
[
:path
],
symlink
)
pod
p
[
:name
],
:path
=>
File
.
join
(
symlink
,
'ios'
)
}
pod
'MaterialControls'
# 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'
)
plugin_pods
=
parse_KV_file
(
'../.flutter-plugins'
)
plugin_pods
.
each
do
|
name
,
path
|
symlink
=
File
.
join
(
'.symlinks'
,
'plugins'
,
name
)
File
.
symlink
(
path
,
symlink
)
pod
name
,
:path
=>
File
.
join
(
symlink
,
'ios'
)
end
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
...
...
examples/platform_view/ios/Podfile.lock
View file @
357d02c8
PODS:
PODS:
- Flutter (1.0.0)
- Flutter (1.0.0)
- MaterialControls (1.2.2)
DEPENDENCIES:
DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios`)
- Flutter (from `Flutter`)
- MaterialControls
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- MaterialControls
EXTERNAL SOURCES:
EXTERNAL SOURCES:
Flutter:
Flutter:
:path:
".symlinks/flutter/ios"
:path:
Flutter
SPEC CHECKSUMS:
SPEC CHECKSUMS:
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
MaterialControls: 1c6b29e78d3a13d8dd6a67ed31b6d26eb5de8f72
PODFILE CHECKSUM:
80af51c01ee3f0969ddbf2d1f0dcd6f44fad2c52
PODFILE CHECKSUM:
3dbe063e9c90a5d7c9e4e76e70a821b9e2c1d271
COCOAPODS: 1.
7.1
COCOAPODS: 1.
8.3
packages/flutter_tools/bin/xcode_backend.sh
View file @
357d02c8
...
@@ -146,6 +146,7 @@ BuildApp() {
...
@@ -146,6 +146,7 @@ BuildApp() {
RunCommand find
"
${
derived_dir
}
/engine/Flutter.framework"
-type
f
\(
-name
'*.h'
-o
-name
'*.modulemap'
-o
-name
'*.plist'
\)
-exec
chmod
a-w
"{}"
\;
RunCommand find
"
${
derived_dir
}
/engine/Flutter.framework"
-type
f
\(
-name
'*.h'
-o
-name
'*.modulemap'
-o
-name
'*.plist'
\)
-exec
chmod
a-w
"{}"
\;
else
else
RunCommand
rm
-rf
--
"
${
derived_dir
}
/Flutter.framework"
RunCommand
rm
-rf
--
"
${
derived_dir
}
/Flutter.framework"
RunCommand
cp
--
"
${
flutter_podspec
}
"
"
${
derived_dir
}
"
RunCommand
cp
-r
--
"
${
flutter_framework
}
"
"
${
derived_dir
}
"
RunCommand
cp
-r
--
"
${
flutter_framework
}
"
"
${
derived_dir
}
"
# Make headers, plists, and modulemap files read-only to discourage editing.
# Make headers, plists, and modulemap files read-only to discourage editing.
RunCommand find
"
${
derived_dir
}
/Flutter.framework"
-type
f
\(
-name
'*.h'
-o
-name
'*.modulemap'
-o
-name
'*.plist'
\)
-exec
chmod
a-w
"{}"
\;
RunCommand find
"
${
derived_dir
}
/Flutter.framework"
-type
f
\(
-name
'*.h'
-o
-name
'*.modulemap'
-o
-name
'*.plist'
\)
-exec
chmod
a-w
"{}"
\;
...
...
packages/flutter_tools/lib/src/macos/cocoapods.dart
View file @
357d02c8
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:file/file.dart'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
...
@@ -34,12 +35,19 @@ const String brokenCocoaPodsConsequence = '''
...
@@ -34,12 +35,19 @@ const String brokenCocoaPodsConsequence = '''
This
can
happen
if
the
version
of
Ruby
that
CocoaPods
was
installed
with
is
different
from
the
one
being
used
to
invoke
it
.
This
can
happen
if
the
version
of
Ruby
that
CocoaPods
was
installed
with
is
different
from
the
one
being
used
to
invoke
it
.
This
can
usually
be
fixed
by
re
-
installing
CocoaPods
.
For
more
info
,
see
https:
//github.com/flutter/flutter/issues/14293.''';
This
can
usually
be
fixed
by
re
-
installing
CocoaPods
.
For
more
info
,
see
https:
//github.com/flutter/flutter/issues/14293.''';
const
String
outOfDatePodfileConsequence
=
'''
This can cause a mismatched version of Flutter to be embedded in your app, which may result in App Store submission rejection or crashes.
If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/24641 for instructions.'''
;
const
String
cocoaPodsInstallInstructions
=
'''
const
String
cocoaPodsInstallInstructions
=
'''
sudo gem install cocoapods'''
;
sudo gem install cocoapods'''
;
const
String
cocoaPodsUpgradeInstructions
=
'''
const
String
cocoaPodsUpgradeInstructions
=
'''
sudo gem install cocoapods'''
;
sudo gem install cocoapods'''
;
const
String
podfileMigrationInstructions
=
'''
rm ios/Podfile'''
;
CocoaPods
get
cocoaPods
=>
context
.
get
<
CocoaPods
>();
CocoaPods
get
cocoaPods
=>
context
.
get
<
CocoaPods
>();
/// Result of evaluating the CocoaPods installation.
/// Result of evaluating the CocoaPods installation.
...
@@ -131,13 +139,15 @@ class CocoaPods {
...
@@ -131,13 +139,15 @@ class CocoaPods {
if
(!
xcodeProject
.
podfile
.
existsSync
())
{
if
(!
xcodeProject
.
podfile
.
existsSync
())
{
throwToolExit
(
'Podfile missing'
);
throwToolExit
(
'Podfile missing'
);
}
}
bool
podsProcessed
=
false
;
if
(
await
_checkPodCondition
())
{
if
(
await
_checkPodCondition
())
{
if
(
_shouldRunPodInstall
(
xcodeProject
,
dependenciesChanged
))
{
if
(
_shouldRunPodInstall
(
xcodeProject
,
dependenciesChanged
))
{
await
_runPodInstall
(
xcodeProject
,
engineDir
);
await
_runPodInstall
(
xcodeProject
,
engineDir
);
return
true
;
podsProcessed
=
true
;
}
}
_warnIfPodfileOutOfDate
(
xcodeProject
);
}
}
return
false
;
return
podsProcessed
;
}
}
/// Make sure the CocoaPods tools are in the right states.
/// Make sure the CocoaPods tools are in the right states.
...
@@ -291,7 +301,6 @@ class CocoaPods {
...
@@ -291,7 +301,6 @@ class CocoaPods {
<
String
>[
'pod'
,
'install'
,
'--verbose'
],
<
String
>[
'pod'
,
'install'
,
'--verbose'
],
workingDirectory:
fs
.
path
.
dirname
(
xcodeProject
.
podfile
.
path
),
workingDirectory:
fs
.
path
.
dirname
(
xcodeProject
.
podfile
.
path
),
environment:
<
String
,
String
>{
environment:
<
String
,
String
>{
// For backward compatibility with previously created Podfile only.
'FLUTTER_FRAMEWORK_DIR'
:
engineDirectory
,
'FLUTTER_FRAMEWORK_DIR'
:
engineDirectory
,
// See https://github.com/flutter/flutter/issues/10873.
// See https://github.com/flutter/flutter/issues/10873.
// CocoaPods analytics adds a lot of latency.
// CocoaPods analytics adds a lot of latency.
...
@@ -326,4 +335,30 @@ class CocoaPods {
...
@@ -326,4 +335,30 @@ class CocoaPods {
);
);
}
}
}
}
// Previously, the Podfile created a symlink to the cached artifacts engine framework
// and installed the Flutter pod from that path. This could get out of sync with the copy
// of the Flutter engine that was copied to ios/Flutter by the xcode_backend script.
// It was possible for the symlink to point to a Debug version of the engine when the
// Xcode build configuration was Release, which caused App Store submission rejections.
//
// Warn the user if they are still symlinking to the framework.
void
_warnIfPodfileOutOfDate
(
XcodeBasedProject
xcodeProject
)
{
if
(
xcodeProject
is
!
IosProject
)
{
return
;
}
final
Link
flutterSymlink
=
fs
.
link
(
fs
.
path
.
join
(
xcodeProject
.
symlinks
.
path
,
'flutter'
,
));
if
(
flutterSymlink
.
existsSync
())
{
printError
(
'Warning: Podfile is out of date
\n
'
'
$outOfDatePodfileConsequence
\n
'
'To regenerate the Podfile, run:
\n
'
'
$podfileMigrationInstructions
\n
'
,
emphasis:
true
,
);
}
}
}
}
packages/flutter_tools/lib/src/project.dart
View file @
357d02c8
...
@@ -288,6 +288,9 @@ abstract class XcodeBasedProject {
...
@@ -288,6 +288,9 @@ abstract class XcodeBasedProject {
/// True if the host app project is using Swift.
/// True if the host app project is using Swift.
Future
<
bool
>
get
isSwift
;
Future
<
bool
>
get
isSwift
;
/// Directory containing symlinks to pub cache plugins source generated on `pod install`.
Directory
get
symlinks
;
}
}
/// Represents the iOS sub-project of a Flutter project.
/// Represents the iOS sub-project of a Flutter project.
...
@@ -350,6 +353,9 @@ class IosProject implements XcodeBasedProject {
...
@@ -350,6 +353,9 @@ class IosProject implements XcodeBasedProject {
/// The '
Info
.
plist
' file of the host app.
/// The '
Info
.
plist
' file of the host app.
File get hostInfoPlist => hostAppRoot.childDirectory(_hostAppBundleName).childFile('
Info
.
plist
');
File get hostInfoPlist => hostAppRoot.childDirectory(_hostAppBundleName).childFile('
Info
.
plist
');
@override
Directory get symlinks => _flutterLibRoot.childDirectory('
.
symlinks
');
@override
@override
Directory get xcodeProject => hostAppRoot.childDirectory('
$_hostAppBundleName
.
xcodeproj
');
Directory get xcodeProject => hostAppRoot.childDirectory('
$_hostAppBundleName
.
xcodeproj
');
...
@@ -742,6 +748,9 @@ class MacOSProject implements XcodeBasedProject {
...
@@ -742,6 +748,9 @@ class MacOSProject implements XcodeBasedProject {
@override
@override
Directory
get
xcodeWorkspace
=>
_macOSDirectory
.
childDirectory
(
'
$_hostAppBundleName
.xcworkspace'
);
Directory
get
xcodeWorkspace
=>
_macOSDirectory
.
childDirectory
(
'
$_hostAppBundleName
.xcworkspace'
);
@override
Directory
get
symlinks
=>
ephemeralDirectory
.
childDirectory
(
'.symlinks'
);
@override
@override
Future
<
bool
>
get
isSwift
async
=>
true
;
Future
<
bool
>
get
isSwift
async
=>
true
;
...
...
packages/flutter_tools/templates/app/ios.tmpl/.gitignore
View file @
357d02c8
...
@@ -16,6 +16,7 @@ xcuserdata
...
@@ -16,6 +16,7 @@ xcuserdata
**/.generated/
**/.generated/
Flutter/App.framework
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/Generated.xcconfig
Flutter/app.flx
Flutter/app.flx
Flutter/app.zip
Flutter/app.zip
...
...
packages/flutter_tools/templates/cocoapods/Podfile-ios-objc
View file @
357d02c8
...
@@ -15,51 +15,66 @@ def parse_KV_file(file, separator='=')
...
@@ -15,51 +15,66 @@ def parse_KV_file(file, separator='=')
if !File.exists? file_abs_path
if !File.exists? file_abs_path
return [];
return [];
end
end
pods_ary = []
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path)
{
|line|
File.foreach(file_abs_path)
do
|line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
plugin = line.split(pattern=separator)
if plugin.length == 2
if plugin.length == 2
podname = plugin[0].strip()
podname = plugin[0].strip()
path = plugin[1].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
generated_key_values[podname] = podpath
else
else
puts "Invalid plugin specification: #{line}"
puts "Invalid plugin specification: #{line}"
end
end
}
end
return pods_ary
generated_key_values
end
end
target 'Runner' do
target 'Runner' do
use_modular_headers!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# Flutter Pod
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
copied_flutter_dir = File.join(__dir__, 'Flutter')
system('mkdir -p .symlinks/plugins')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
# Flutter Pods
unless File.exist?(copied_framework_path)
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end
end
generated_xcode_build_settings.map { |p|
unless File.exist?(copied_podspec_path)
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
end
}
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Plugin Pods
# 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')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.
map { |p
|
plugin_pods.
each do |name, path
|
symlink = File.join('.symlinks', 'plugins',
p[:name]
)
symlink = File.join('.symlinks', 'plugins',
name
)
File.symlink(p
[:path]
, symlink)
File.symlink(p
ath
, symlink)
pod
p[:name]
, :path => File.join(symlink, 'ios')
pod
name
, :path => File.join(symlink, 'ios')
}
end
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
...
...
packages/flutter_tools/templates/cocoapods/Podfile-ios-swift
View file @
357d02c8
...
@@ -15,52 +15,67 @@ def parse_KV_file(file, separator='=')
...
@@ -15,52 +15,67 @@ def parse_KV_file(file, separator='=')
if !File.exists? file_abs_path
if !File.exists? file_abs_path
return [];
return [];
end
end
pods_ary = []
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path)
{
|line|
File.foreach(file_abs_path)
do
|line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
plugin = line.split(pattern=separator)
if plugin.length == 2
if plugin.length == 2
podname = plugin[0].strip()
podname = plugin[0].strip()
path = plugin[1].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
generated_key_values[podname] = podpath
else
else
puts "Invalid plugin specification: #{line}"
puts "Invalid plugin specification: #{line}"
end
end
}
end
return pods_ary
generated_key_values
end
end
target 'Runner' do
target 'Runner' do
use_frameworks!
use_frameworks!
use_modular_headers!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# Flutter Pod
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
copied_flutter_dir = File.join(__dir__, 'Flutter')
system('mkdir -p .symlinks/plugins')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
# Flutter Pods
unless File.exist?(copied_framework_path)
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end
end
generated_xcode_build_settings.map { |p|
unless File.exist?(copied_podspec_path)
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
end
}
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Plugin Pods
# 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')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.
map { |p
|
plugin_pods.
each do |name, path
|
symlink = File.join('.symlinks', 'plugins',
p[:name]
)
symlink = File.join('.symlinks', 'plugins',
name
)
File.symlink(p
[:path]
, symlink)
File.symlink(p
ath
, symlink)
pod
p[:name]
, :path => File.join(symlink, 'ios')
pod
name
, :path => File.join(symlink, 'ios')
}
end
end
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
...
...
packages/flutter_tools/templates/package/.gitignore.tmpl
View file @
357d02c8
...
@@ -57,6 +57,7 @@ build/
...
@@ -57,6 +57,7 @@ build/
**/ios/.generated/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/app.zip
...
...
packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
View file @
357d02c8
...
@@ -314,6 +314,27 @@ void main() {
...
@@ -314,6 +314,27 @@ void main() {
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
});
});
testUsingContext
(
'prints warning, if Podfile is out of date'
,
()
async
{
pretendPodIsInstalled
();
fs
.
file
(
fs
.
path
.
join
(
'project'
,
'ios'
,
'Podfile'
))
..
createSync
()
..
writeAsStringSync
(
'Existing Podfile'
);
final
Directory
symlinks
=
projectUnderTest
.
ios
.
symlinks
..
createSync
(
recursive:
true
);
symlinks
.
childLink
(
'flutter'
).
createSync
(
'cache'
);
await
cocoaPodsUnderTest
.
processPods
(
xcodeProject:
projectUnderTest
.
ios
,
engineDir:
'engine/path'
,
);
expect
(
testLogger
.
errorText
,
contains
(
'Warning: Podfile is out of date'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
mockProcessManager
,
});
testUsingContext
(
'throws, if Podfile is missing.'
,
()
async
{
testUsingContext
(
'throws, if Podfile is missing.'
,
()
async
{
pretendPodIsInstalled
();
pretendPodIsInstalled
();
try
{
try
{
...
...
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