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
cb05af48
Commit
cb05af48
authored
Apr 01, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make platform specific build settings specs work again.
parent
4e4fc7fb
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
50 deletions
+49
-50
installer.rb
lib/cocoapods/installer.rb
+1
-1
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+1
-2
project.rb
lib/cocoapods/project.rb
+17
-9
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+1
-1
project_spec.rb
spec/unit/project_spec.rb
+29
-37
No files found.
lib/cocoapods/installer.rb
View file @
cb05af48
...
...
@@ -21,7 +21,7 @@ module Pod
def
project
return
@project
if
@project
# TODO this should not init with platform
@project
=
Pod
::
Project
.
for_platform
(
@podfile
.
target_definitions
[
:default
].
platform
)
@project
=
Pod
::
Project
.
new
activated_pods
.
each
do
|
pod
|
# Add all source files to the project grouped by pod
group
=
@project
.
add_pod_group
(
pod
.
name
)
...
...
lib/cocoapods/installer/target_installer.rb
View file @
cb05af48
...
...
@@ -51,8 +51,7 @@ module Pod
def
install!
(
pods
,
sandbox
)
self
.
requires_arc
=
pods
.
any?
{
|
pod
|
pod
.
requires_arc?
}
# First add the target to the project
@target
=
@project
.
targets
.
new_static_library
(
@target_definition
.
platform
.
name
,
@target_definition
.
label
)
@target
=
@project
.
add_pod_target
(
@target_definition
.
label
,
@target_definition
.
platform
)
pods
.
each
do
|
pod
|
# TODO add methods like xcconfig to LocalPod as well? (which returns the correct platform)
...
...
lib/cocoapods/project.rb
View file @
cb05af48
...
...
@@ -12,6 +12,10 @@ end
module
Pod
class
Project
<
Xcodeproj
::
Project
def
initialize
(
*
)
super
main_group
<<
groups
.
new
(
'name'
=>
'Pods'
)
end
# Shortcut access to the `Pods' PBXGroup.
def
pods
...
...
@@ -23,17 +27,21 @@ module Pod
pods
.
groups
.
new
(
'name'
=>
name
)
end
# TODO do we need this?
def
build_configuration
(
name
)
build_configurations
.
find
{
|
c
|
c
.
name
==
name
}
end
def
add_pod_target
(
name
,
platform
)
target
=
targets
.
new_static_library
(
platform
.
name
,
name
)
def
self
.
for_platform
(
platform
)
Pod
::
Project
.
new
.
tap
do
|
project
|
project
.
main_group
<<
project
.
groups
.
new
(
'name'
=>
'Pods'
)
project
.
build_settings
(
'Debug'
).
merge!
(
build_settings
(
platform
))
project
.
build_settings
(
'Release'
).
merge!
(
build_settings
(
platform
))
settings
=
{}
if
platform
.
requires_legacy_ios_archs?
settings
[
'ARCHS'
]
=
"armv6 armv7"
end
if
platform
==
:ios
&&
platform
.
deployment_target
settings
[
'IPHONEOS_DEPLOYMENT_TARGET'
]
=
platform
.
deployment_target
.
to_s
end
target
.
build_settings
(
'Debug'
).
merge!
(
settings
)
target
.
build_settings
(
'Release'
).
merge!
(
settings
)
target
end
private
...
...
spec/unit/installer/target_installer_spec.rb
View file @
cb05af48
...
...
@@ -11,7 +11,7 @@ describe Pod::Installer::TargetInstaller do
:generate_bridge_support?
=>
false
,
:set_arc_compatibility_flag?
=>
false
)
@project
=
Pod
::
Project
.
for_platform
(
platform
)
@project
=
Pod
::
Project
.
new
@project
.
main_group
.
groups
.
new
(
'name'
=>
'Targets Support Files'
)
@installer
=
Pod
::
Installer
::
TargetInstaller
.
new
(
@podfile
,
@project
,
@target_definition
)
...
...
spec/unit/project_spec.rb
View file @
cb05af48
...
...
@@ -33,58 +33,50 @@ describe 'Pod::Project' do
@project
.
targets
.
first
.
build_phases
.
should
.
include
phase
end
shared
"for any platform
"
do
it
"
adds a Debug and Release build
configuration"
do
@project
.
build_configurations
.
count
.
should
==
2
@project
.
build_configurations
.
map
(
&
:name
).
sort
.
should
==
%w{Debug Release}
.
sort
describe
"concerning its :ios targets
"
do
it
"
sets VALIDATE_PRODUCT to YES for the Release
configuration"
do
target
=
Pod
::
Project
.
new
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
ios
)
target
.
build_settings
(
'Release'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
end
describe
"
for the :ios platform
"
do
describe
"
concerning its :ios targets with a deployment target
"
do
before
do
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
))
end
behaves_like
"for any platform"
xit
"sets VALIDATE_PRODUCT to YES for the Release configuration"
do
@project
.
build_configuration
(
"Release"
).
build_settings
[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
@project
=
Pod
::
Project
.
new
end
describe
"for the :ios platform with a deployment target"
do
it
"sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3"
do
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.0"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.0"
))
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.1"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.1"
))
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.2"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.2"
))
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
end
x
it
"uses standard ARCHs if deployment target is 4.3 or above"
do
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.3"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
it
"uses standard ARCHs if deployment target is 4.3 or above"
do
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.3"
))
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'Release'
)
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.4"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.4"
))
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'Release'
)
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
end
x
it
"sets IPHONEOS_DEPLOYMENT_TARGET for both configurations"
do
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.3"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.3"
it
"sets IPHONEOS_DEPLOYMENT_TARGET for both configurations"
do
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
))
target
.
build_settings
(
'Debug'
)
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.3"
target
.
build_settings
(
'Release'
)
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.3"
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.0"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.0"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.0"
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.0"
))
target
.
build_settings
(
'Debug'
)
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.0"
target
.
build_settings
(
'Release'
)
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.0"
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