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
ea918cd9
Commit
ea918cd9
authored
Mar 05, 2012
by
Luke Redpath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -fobjc-arc to OTHER_LD_FLAGS if any pods require ARC (closes #142)
parent
5384e9f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+10
-1
local_pod.rb
lib/cocoapods/local_pod.rb
+4
-0
target_installer_spec.rb
spec/unit/target_installer_spec.rb
+6
-1
No files found.
lib/cocoapods/installer/target_installer.rb
View file @
ea918cd9
...
@@ -4,6 +4,7 @@ module Pod
...
@@ -4,6 +4,7 @@ module Pod
include
Config
::
Mixin
include
Config
::
Mixin
attr_reader
:podfile
,
:project
,
:target_definition
,
:target
attr_reader
:podfile
,
:project
,
:target_definition
,
:target
attr_accessor
:requires_arc
def
initialize
(
podfile
,
project
,
target_definition
)
def
initialize
(
podfile
,
project
,
target_definition
)
@podfile
,
@project
,
@target_definition
=
podfile
,
project
,
target_definition
@podfile
,
@project
,
@target_definition
=
podfile
,
project
,
target_definition
...
@@ -16,7 +17,7 @@ module Pod
...
@@ -16,7 +17,7 @@ module Pod
'ALWAYS_SEARCH_USER_PATHS'
=>
'YES'
,
# needed to make EmbedReader build
'ALWAYS_SEARCH_USER_PATHS'
=>
'YES'
,
# needed to make EmbedReader build
# This makes categories from static libraries work, which many libraries
# This makes categories from static libraries work, which many libraries
# require, so we add these by default.
# require, so we add these by default.
'OTHER_LDFLAGS'
=>
'-ObjC -all_load'
,
'OTHER_LDFLAGS'
=>
default_ld_flags
,
})
})
end
end
...
@@ -61,6 +62,8 @@ module Pod
...
@@ -61,6 +62,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?
}
# First add the target to the project
# First add the target to the project
@target
=
@project
.
targets
.
new_static_library
(
@target_definition
.
lib_name
)
@target
=
@project
.
targets
.
new_static_library
(
@target_definition
.
lib_name
)
...
@@ -112,6 +115,12 @@ module Pod
...
@@ -112,6 +115,12 @@ module Pod
def
quoted
(
strings
)
def
quoted
(
strings
)
strings
.
map
{
|
s
|
"
\"
#{
s
}
\"
"
}
strings
.
map
{
|
s
|
"
\"
#{
s
}
\"
"
}
end
end
def
default_ld_flags
flags
=
%w{-ObjC -all_load}
flags
<<
'-fobjc-arc'
if
self
.
requires_arc
flags
.
join
(
" "
)
end
end
end
end
end
end
end
...
...
lib/cocoapods/local_pod.rb
View file @
ea918cd9
...
@@ -75,6 +75,10 @@ module Pod
...
@@ -75,6 +75,10 @@ module Pod
end
end
end
end
def
requires_arc?
specification
.
requires_arc
end
private
private
def
implementation_files
def
implementation_files
...
...
spec/unit/target_installer_spec.rb
View file @
ea918cd9
...
@@ -44,5 +44,10 @@ describe Pod::Installer::TargetInstaller do
...
@@ -44,5 +44,10 @@ describe Pod::Installer::TargetInstaller do
do_install!
do_install!
@installer
.
xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
.
include
(
"
\"
#{
@sandbox
.
header_search_paths
.
join
(
" "
)
}
\"
"
)
@installer
.
xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
.
include
(
"
\"
#{
@sandbox
.
header_search_paths
.
join
(
" "
)
}
\"
"
)
end
end
it
'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc (to support non-ARC projects on iOS 4.0)'
do
@specification
.
stubs
(
:requires_arc
).
returns
(
true
)
do_install!
@installer
.
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
split
(
" "
).
should
.
include
(
"-fobjc-arc"
)
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