Commit 313ffd35 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4539 from CocoaPods/seg-tvos-info-plist

[InfoPlistFile] Include UIRequiredDeviceCapabilities for tvOS pods
parents d6604327 b60e1b65
...@@ -131,6 +131,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -131,6 +131,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[#4420](https://github.com/CocoaPods/CocoaPods/issues/4420) [#4420](https://github.com/CocoaPods/CocoaPods/issues/4420)
* The `UIRequiredDeviceCapabilities` key is now specified in the `Info.plist`
file for tvOS pods built as frameworks.
[Samuel Giddins](https://github.com/segiddins)
[#4514](https://github.com/CocoaPods/CocoaPods/issues/4514)
## 0.39.0 (2015-10-09) ## 0.39.0 (2015-10-09)
......
...@@ -51,14 +51,29 @@ module Pod ...@@ -51,14 +51,29 @@ module Pod
# @return [String] # @return [String]
# #
def generate def generate
FILE_CONTENTS.sub('${CURRENT_PROJECT_VERSION_STRING}', target_version) header + dict + footer
end end
FILE_CONTENTS = <<-EOS private
def header
<<-PLIST
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
PLIST
end
def footer
<<-PLIST
</dict>
</plist>
PLIST
end
def dict
dict = <<-PLIST
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
...@@ -72,16 +87,26 @@ module Pod ...@@ -72,16 +87,26 @@ module Pod
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>${CURRENT_PROJECT_VERSION_STRING}</string> <string>#{target_version}</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string> <string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string></string> <string></string>
</dict> PLIST
</plist>
EOS if target.platform.name == :tvos
dict << <<-PLIST
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
PLIST
end
dict
end
end end
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Generator::InfoPlistFile do module Pod
describe Generator::InfoPlistFile do
describe '#target_version' do describe '#target_version' do
it 'returns 1.0.0 for the aggregate target' do it 'returns 1.0.0 for the aggregate target' do
generator = Pod::Generator::InfoPlistFile.new(fixture_aggregate_target) generator = Generator::InfoPlistFile.new(fixture_aggregate_target)
generator.target_version.should == '1.0.0' generator.target_version.should == '1.0.0'
end end
describe 'sanitization' do describe 'sanitization' do
before do before do
@root_spec = mock('RootSpec') @root_spec = mock('RootSpec')
pod_target = stub('PodTarget', :root_spec => @root_spec) @platform = stub('Platform', :name => :ios)
@generator = Pod::Generator::InfoPlistFile.new(pod_target) pod_target = stub('PodTarget', :root_spec => @root_spec, :platform => @platform)
@generator = Generator::InfoPlistFile.new(pod_target)
end end
it 'handles when the version is HEAD' do it 'handles when the version is HEAD' do
version = Pod::Version.new('0.2.0') version = Version.new('0.2.0')
version.head = true version.head = true
@root_spec.stubs(:version).returns(version) @root_spec.stubs(:version).returns(version)
@generator.target_version.should == '0.2.0' @generator.target_version.should == '0.2.0'
end end
it 'handles when the version is more than 3 numeric parts' do it 'handles when the version is more than 3 numeric parts' do
version = Pod::Version.new('0.2.0.1') version = Version.new('0.2.0.1')
@root_spec.stubs(:version).returns(version) @root_spec.stubs(:version).returns(version)
@generator.target_version.should == '0.2.0' @generator.target_version.should == '0.2.0'
end end
it 'handles when the version is less than 3 numeric parts' do it 'handles when the version is less than 3 numeric parts' do
version = Pod::Version.new('0.2') version = Version.new('0.2')
@root_spec.stubs(:version).returns(version) @root_spec.stubs(:version).returns(version)
@generator.target_version.should == '0.2.0' @generator.target_version.should == '0.2.0'
end end
it 'handles when the version is a pre-release' do it 'handles when the version is a pre-release' do
version = Pod::Version.new('1.0.0-beta.1') version = Version.new('1.0.0-beta.1')
@root_spec.stubs(:version).returns(version) @root_spec.stubs(:version).returns(version)
@generator.target_version.should == '1.0.0' @generator.target_version.should == '1.0.0'
version = Pod::Version.new('1.0-beta.5') version = Version.new('1.0-beta.5')
@root_spec.stubs(:version).returns(version) @root_spec.stubs(:version).returns(version)
@generator.target_version.should == '1.0.0' @generator.target_version.should == '1.0.0'
end end
end end
it 'returns the specification\'s version for the pod target' do it 'returns the specification\'s version for the pod target' do
generator = Pod::Generator::InfoPlistFile.new(fixture_pod_target('orange-framework/OrangeFramework.podspec')) generator = Generator::InfoPlistFile.new(fixture_pod_target('orange-framework/OrangeFramework.podspec'))
generator.target_version.should == '0.1.0' generator.target_version.should == '0.1.0'
end end
end end
it 'replaces the version in the generated plist' do it 'replaces the version in the generated plist' do
generator = Pod::Generator::InfoPlistFile.new(fixture_pod_target('orange-framework/OrangeFramework.podspec')) generator = Generator::InfoPlistFile.new(fixture_pod_target('orange-framework/OrangeFramework.podspec'))
generator.generate.should.include "<key>CFBundleShortVersionString</key>\n <string>0.1.0</string>" generator.generate.should.include "<key>CFBundleShortVersionString</key>\n <string>0.1.0</string>"
end end
it 'generates a valid Info.plist file' do it 'generates a valid Info.plist file' do
generator = Pod::Generator::InfoPlistFile.new(mock('Target')) generator = Generator::InfoPlistFile.new(fixture_pod_target('orange-framework/OrangeFramework.podspec'))
file = temporary_directory + 'Info.plist' file = temporary_directory + 'Info.plist'
generator.save_as(file) generator.save_as(file)
`plutil -lint #{file}` `plutil -lint #{file}`
...@@ -64,7 +66,7 @@ describe Pod::Generator::InfoPlistFile do ...@@ -64,7 +66,7 @@ describe Pod::Generator::InfoPlistFile do
end end
it 'generates a correct Info.plist file' do it 'generates a correct Info.plist file' do
generator = Pod::Generator::InfoPlistFile.new(mock('Target')) generator = Generator::InfoPlistFile.new(mock('Target', :platform => stub(:name => :ios)))
file = temporary_directory + 'Info.plist' file = temporary_directory + 'Info.plist'
generator.save_as(file) generator.save_as(file)
Xcodeproj::PlistHelper.read(file).should == { Xcodeproj::PlistHelper.read(file).should == {
...@@ -80,4 +82,14 @@ describe Pod::Generator::InfoPlistFile do ...@@ -80,4 +82,14 @@ describe Pod::Generator::InfoPlistFile do
'NSPrincipalClass' => '', 'NSPrincipalClass' => '',
} }
end end
it 'adds UIRequiredDeviceCapabilities for tvOS targets' do
pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec')
pod_target.stubs(:platform).returns(Platform.new(:tvos, '9.0'))
generator = Generator::InfoPlistFile.new(pod_target)
file = temporary_directory + 'Info.plist'
generator.save_as(file)
Xcodeproj::PlistHelper.read(file)['UIRequiredDeviceCapabilities'].should == %w(arm64)
end
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment