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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
60 deletions
+59
-60
installer.rb
lib/cocoapods/installer.rb
+1
-1
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+2
-3
project.rb
lib/cocoapods/project.rb
+18
-10
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+1
-1
project_spec.rb
spec/unit/project_spec.rb
+37
-45
No files found.
lib/cocoapods/installer.rb
View file @
cb05af48
...
@@ -21,7 +21,7 @@ module Pod
...
@@ -21,7 +21,7 @@ module Pod
def
project
def
project
return
@project
if
@project
return
@project
if
@project
# TODO this should not init with platform
# 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
|
activated_pods
.
each
do
|
pod
|
# Add all source files to the project grouped by pod
# Add all source files to the project grouped by pod
group
=
@project
.
add_pod_group
(
pod
.
name
)
group
=
@project
.
add_pod_group
(
pod
.
name
)
...
...
lib/cocoapods/installer/target_installer.rb
View file @
cb05af48
...
@@ -50,9 +50,8 @@ module Pod
...
@@ -50,9 +50,8 @@ module Pod
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
def
install!
(
pods
,
sandbox
)
def
install!
(
pods
,
sandbox
)
self
.
requires_arc
=
pods
.
any?
{
|
pod
|
pod
.
requires_arc?
}
self
.
requires_arc
=
pods
.
any?
{
|
pod
|
pod
.
requires_arc?
}
# First add the target to the project
@target
=
@project
.
add_pod_target
(
@target_definition
.
label
,
@target_definition
.
platform
)
@target
=
@project
.
targets
.
new_static_library
(
@target_definition
.
platform
.
name
,
@target_definition
.
label
)
pods
.
each
do
|
pod
|
pods
.
each
do
|
pod
|
# TODO add methods like xcconfig to LocalPod as well? (which returns the correct platform)
# 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
...
@@ -12,6 +12,10 @@ end
module
Pod
module
Pod
class
Project
<
Xcodeproj
::
Project
class
Project
<
Xcodeproj
::
Project
def
initialize
(
*
)
super
main_group
<<
groups
.
new
(
'name'
=>
'Pods'
)
end
# Shortcut access to the `Pods' PBXGroup.
# Shortcut access to the `Pods' PBXGroup.
def
pods
def
pods
...
@@ -22,18 +26,22 @@ module Pod
...
@@ -22,18 +26,22 @@ module Pod
def
add_pod_group
(
name
)
def
add_pod_group
(
name
)
pods
.
groups
.
new
(
'name'
=>
name
)
pods
.
groups
.
new
(
'name'
=>
name
)
end
end
# TODO do we need this?
def
build_configuration
(
name
)
build_configurations
.
find
{
|
c
|
c
.
name
==
name
}
end
def
self
.
for_platform
(
platform
)
def
add_pod_target
(
name
,
platform
)
Pod
::
Project
.
new
.
tap
do
|
project
|
target
=
targets
.
new_static_library
(
platform
.
name
,
name
)
project
.
main_group
<<
project
.
groups
.
new
(
'name'
=>
'Pods'
)
project
.
build_settings
(
'Debug'
).
merge!
(
build_settings
(
platform
))
settings
=
{}
project
.
build_settings
(
'Release'
).
merge!
(
build_settings
(
platform
))
if
platform
.
requires_legacy_ios_archs?
settings
[
'ARCHS'
]
=
"armv6 armv7"
end
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
end
private
private
...
...
spec/unit/installer/target_installer_spec.rb
View file @
cb05af48
...
@@ -11,7 +11,7 @@ describe Pod::Installer::TargetInstaller do
...
@@ -11,7 +11,7 @@ describe Pod::Installer::TargetInstaller do
:generate_bridge_support?
=>
false
,
:generate_bridge_support?
=>
false
,
:set_arc_compatibility_flag?
=>
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'
)
@project
.
main_group
.
groups
.
new
(
'name'
=>
'Targets Support Files'
)
@installer
=
Pod
::
Installer
::
TargetInstaller
.
new
(
@podfile
,
@project
,
@target_definition
)
@installer
=
Pod
::
Installer
::
TargetInstaller
.
new
(
@podfile
,
@project
,
@target_definition
)
...
...
spec/unit/project_spec.rb
View file @
cb05af48
...
@@ -32,59 +32,51 @@ describe 'Pod::Project' do
...
@@ -32,59 +32,51 @@ describe 'Pod::Project' do
}).
should
.
not
==
nil
}).
should
.
not
==
nil
@project
.
targets
.
first
.
build_phases
.
should
.
include
phase
@project
.
targets
.
first
.
build_phases
.
should
.
include
phase
end
end
shared
"for any platform
"
do
describe
"concerning its :ios targets
"
do
it
"
adds a Debug and Release build
configuration"
do
it
"
sets VALIDATE_PRODUCT to YES for the Release
configuration"
do
@project
.
build_configurations
.
count
.
should
==
2
target
=
Pod
::
Project
.
new
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
ios
)
@project
.
build_configurations
.
map
(
&
:name
).
sort
.
should
==
%w{Debug Release}
.
sort
target
.
build_settings
(
'Release'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
end
end
end
describe
"
for the :ios platform
"
do
describe
"
concerning its :ios targets with a deployment target
"
do
before
do
before
do
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
))
@project
=
Pod
::
Project
.
new
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
end
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
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"
))
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.0"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"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"
))
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.1"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"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"
))
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.2"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)
[
"ARCHS"
].
should
==
"armv6 armv7"
end
end
x
it
"uses standard ARCHs if deployment target is 4.3 or above"
do
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"
))
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.3"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"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"
))
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.4"
))
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'Debug'
)
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
@project
.
build_configuration
(
"Release"
).
build_settings
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'Release'
)
[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
end
end
xit
"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"
@project
=
Pod
::
Project
.
for_platform
(
Pod
::
Platform
.
new
(
:ios
,
:deployment_target
=>
"4.0"
))
it
"sets IPHONEOS_DEPLOYMENT_TARGET for both configurations"
do
@project
.
build_configuration
(
"Debug"
).
build_settings
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.0"
target
=
@project
.
add_pod_target
(
'Pods'
,
Pod
::
Platform
.
new
(
:ios
))
@project
.
build_configuration
(
"Release"
).
build_settings
[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.0"
target
.
build_settings
(
'Debug'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.3"
target
.
build_settings
(
'Release'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"4.3"
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
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