Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
513a1672
Commit
513a1672
authored
Jan 05, 2016
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[InfoPlist] Generate properly for bundles
parent
72911f4c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
36 deletions
+65
-36
info_plist_file.rb
lib/cocoapods/generator/info_plist_file.rb
+48
-35
pod_target_installer.rb
...oapods/installer/target_installer/pod_target_installer.rb
+1
-1
info_plist_file_spec.rb
spec/unit/generator/info_plist_file_spec.rb
+16
-0
No files found.
lib/cocoapods/generator/info_plist_file.rb
View file @
513a1672
...
...
@@ -9,12 +9,20 @@ module Pod
#
attr_reader
:target
# @return [Symbol] the CFBundlePackageType of the target this Info.plist
# file is for.
#
attr_reader
:bundle_package_type
# Initialize a new instance
#
# @param [Target] target @see target
#
def
initialize
(
target
)
# @param [Symbol] bundle_package_type @see bundle_package_type
#
def
initialize
(
target
,
bundle_package_type: :fmwk
)
@target
=
target
@bundle_package_type
=
bundle_package_type
end
# Generates and saves the Info.plist to the given path.
...
...
@@ -51,7 +59,7 @@ module Pod
# @return [String]
#
def
generate
header
+
dict
+
footer
to_plist
(
info
)
end
private
...
...
@@ -61,51 +69,56 @@ module Pod
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
PLIST
end
def
footer
<<-
PLIST
</dict>
</plist>
PLIST
end
def
dict
dict
=
<<-
PLIST
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>
#{
target_version
}
</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
PLIST
def
to_plist
(
root
)
serialize
(
root
,
header
)
<<
footer
end
if
target
.
platform
.
name
==
:tvos
dict
<<
<<-
PLIST
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
PLIST
def
serialize
(
value
,
output
,
indentation
=
0
)
indent
=
' '
*
indentation
case
value
when
Array
output
<<
indent
<<
"<array>
\n
"
value
.
each
{
|
v
|
serialize
(
v
,
output
,
indentation
+
2
)
}
output
<<
indent
<<
'</array>'
when
Hash
output
<<
indent
<<
"<dict>
\n
"
value
.
to_a
.
sort_by
(
&
:first
).
each
do
|
key
,
v
|
output
<<
indent
<<
' '
<<
"<key>
#{
key
}
</key>
\n
"
serialize
(
v
,
output
,
indentation
+
2
)
end
output
<<
indent
<<
"</dict>
\n
"
when
String
output
<<
indent
<<
"<string>
#{
value
}
</string>
\n
"
end
output
end
dict
def
info
info
=
{
'CFBundleIdentifier'
=>
'${PRODUCT_BUNDLE_IDENTIFIER}'
,
'CFBundleInfoDictionaryVersion'
=>
'6.0'
,
'CFBundleName'
=>
'${PRODUCT_NAME}'
,
'CFBundlePackageType'
=>
bundle_package_type
.
to_s
.
upcase
,
'CFBundleShortVersionString'
=>
target_version
,
'CFBundleSignature'
=>
'????'
,
'CFBundleVersion'
=>
'${CURRENT_PROJECT_VERSION}'
,
'NSPrincipalClass'
=>
''
,
'CFBundleDevelopmentRegion'
=>
'en'
,
}
info
[
'CFBundleExecutable'
]
=
'${EXECUTABLE_NAME}'
if
bundle_package_type
!=
:bndl
info
[
'UIRequiredDeviceCapabilities'
]
=
%w(arm64)
if
target
.
platform
.
name
==
:tvos
info
end
end
end
...
...
lib/cocoapods/installer/target_installer/pod_target_installer.rb
View file @
513a1672
...
...
@@ -169,7 +169,7 @@ module Pod
path
=
target
.
info_plist_path
path
.
dirname
.
mkdir
unless
path
.
dirname
.
exist?
info_plist_path
=
path
.
dirname
+
"ResourceBundle-
#{
bundle_name
}
-
#{
path
.
basename
}
"
generator
=
Generator
::
InfoPlistFile
.
new
(
target
)
generator
=
Generator
::
InfoPlistFile
.
new
(
target
,
:bundle_package_type
=>
:bndl
)
generator
.
save_as
(
info_plist_path
)
add_file_to_support_group
(
info_plist_path
)
...
...
spec/unit/generator/info_plist_file_spec.rb
View file @
513a1672
...
...
@@ -84,5 +84,21 @@ module Pod
generator
.
save_as
(
file
)
Xcodeproj
::
Plist
.
read_from_path
(
file
)[
'UIRequiredDeviceCapabilities'
].
should
==
%w(arm64)
end
it
'uses the specified bundle_package_type'
do
target
=
mock
(
'Target'
,
:platform
=>
stub
(
:name
=>
:ios
))
generator
=
Generator
::
InfoPlistFile
.
new
(
target
,
:bundle_package_type
=>
:bndl
)
file
=
temporary_directory
+
'Info.plist'
generator
.
save_as
(
file
)
Xcodeproj
::
Plist
.
read_from_path
(
file
)[
'CFBundlePackageType'
].
should
==
'BNDL'
end
it
'does not include a CFBundleExecutable for bundles'
do
target
=
mock
(
'Target'
,
:platform
=>
stub
(
:name
=>
:ios
))
generator
=
Generator
::
InfoPlistFile
.
new
(
target
,
:bundle_package_type
=>
:bndl
)
file
=
temporary_directory
+
'Info.plist'
generator
.
save_as
(
file
)
Xcodeproj
::
Plist
.
read_from_path
(
file
).
should
.
not
.
key
(
'CFBundleExecutable'
)
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