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
58dce641
Commit
58dce641
authored
Jan 30, 2013
by
Eloy Durán
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'disable-libSystem-objects'
parents
76b5b7f9
1f1c9496
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
8 deletions
+86
-8
specification.rb
lib/cocoapods/specification.rb
+41
-1
specification_spec.rb
spec/unit/specification_spec.rb
+45
-7
No files found.
lib/cocoapods/specification.rb
View file @
58dce641
...
@@ -319,9 +319,49 @@ module Pod
...
@@ -319,9 +319,49 @@ module Pod
@parent
?
@parent
.
recursive_compiler_flags
|
@compiler_flags
[
active_platform
]
:
@compiler_flags
[
active_platform
]
@parent
?
@parent
.
recursive_compiler_flags
|
@compiler_flags
[
active_platform
]
:
@compiler_flags
[
active_platform
]
end
end
ENABLE_OBJECT_USE_OBJC_FROM
=
{
:ios
=>
Version
.
new
(
'6'
),
:osx
=>
Version
.
new
(
'10.8'
)
}
# The following behavior is regarding the `OS_OBJECT_USE_OBJC` flag. When
# set to `0`, it will allow code to use `dispatch_release()` on >= iOS 6.0
# and OS X 10.8.
#
# * New libraries that do *not* require ARC don’t need to care about this
# issue at all.
#
# * New libraries that *do* require ARC _and_ have a deployment target of
# >= iOS 6.0 or OS X 10.8:
#
# These no longer use `dispatch_release()` and should *not* have the
# `OS_OBJECT_USE_OBJC` flag set to `0`.
#
# **Note:** this means that these libraries *have* to specify the
# deployment target in order to function well.
#
# * New libraries that *do* require ARC, but have a deployment target of
# < iOS 6.0 or OS X 10.8:
#
# These contain `dispatch_release()` calls and as such need the
# `OS_OBJECT_USE_OBJC` flag set to `1`.
#
# **Note:** libraries that do *not* specify a platform version are
# assumed to have a deployment target of < iOS 6.0 or OS X 10.8.
#
# For more information, see: http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
#
def
compiler_flags
def
compiler_flags
flags
=
recursive_compiler_flags
.
dup
flags
=
recursive_compiler_flags
.
dup
flags
<<
'-fobjc-arc'
if
requires_arc
if
requires_arc
flags
<<
'-fobjc-arc'
ios_target
,
osx_target
=
deployment_target
(
:ios
),
deployment_target
(
:osx
)
if
(
ios_target
.
nil?
&&
osx_target
.
nil?
)
||
(
ios_target
&&
Version
.
new
(
ios_target
)
<
ENABLE_OBJECT_USE_OBJC_FROM
[
:ios
])
||
(
osx_target
&&
Version
.
new
(
osx_target
)
<
ENABLE_OBJECT_USE_OBJC_FROM
[
:osx
])
flags
<<
'-DOS_OBJECT_USE_OBJC=0'
end
end
flags
.
join
(
' '
)
flags
.
join
(
' '
)
end
end
...
...
spec/unit/specification_spec.rb
View file @
58dce641
...
@@ -107,11 +107,11 @@ describe "A Pod::Specification loaded from a podspec" do
...
@@ -107,11 +107,11 @@ describe "A Pod::Specification loaded from a podspec" do
it
"adds compiler flags if ARC is required"
do
it
"adds compiler flags if ARC is required"
do
@spec
.
parent
.
should
==
nil
@spec
.
parent
.
should
==
nil
@spec
.
requires_arc
=
true
@spec
.
requires_arc
=
true
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
"-fobjc-arc"
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
"-fobjc-arc
-DOS_OBJECT_USE_OBJC=0
"
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
"-fobjc-arc"
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
"-fobjc-arc
-DOS_OBJECT_USE_OBJC=0
"
@spec
.
compiler_flags
=
"-Wunused-value"
@spec
.
compiler_flags
=
"-Wunused-value"
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
"-Wunused-value -fobjc-arc"
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
"-Wunused-value -fobjc-arc
-DOS_OBJECT_USE_OBJC=0
"
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
"-Wunused-value -fobjc-arc"
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
"-Wunused-value -fobjc-arc
-DOS_OBJECT_USE_OBJC=0
"
end
end
end
end
...
@@ -523,7 +523,7 @@ describe "A Pod::Specification, concerning its attributes that support different
...
@@ -523,7 +523,7 @@ describe "A Pod::Specification, concerning its attributes that support different
end
end
it
"returns the same list of compiler flags for each platform"
do
it
"returns the same list of compiler flags for each platform"
do
compiler_flags
=
'-Wdeprecated-implementations -fobjc-arc'
compiler_flags
=
'-Wdeprecated-implementations -fobjc-arc
-DOS_OBJECT_USE_OBJC=0
'
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
compiler_flags
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
compiler_flags
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
compiler_flags
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
compiler_flags
end
end
...
@@ -587,8 +587,8 @@ describe "A Pod::Specification, concerning its attributes that support different
...
@@ -587,8 +587,8 @@ describe "A Pod::Specification, concerning its attributes that support different
end
end
it
"returns the same list of compiler flags for each platform"
do
it
"returns the same list of compiler flags for each platform"
do
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
'-Wdeprecated-implementations -fobjc-arc'
@spec
.
activate_platform
(
:ios
).
compiler_flags
.
should
==
'-Wdeprecated-implementations -fobjc-arc
-DOS_OBJECT_USE_OBJC=0
'
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
'-Wfloat-equal -fobjc-arc'
@spec
.
activate_platform
(
:osx
).
compiler_flags
.
should
==
'-Wfloat-equal -fobjc-arc
-DOS_OBJECT_USE_OBJC=0
'
end
end
it
"returns the same list of dependencies for each platform"
do
it
"returns the same list of dependencies for each platform"
do
...
@@ -596,4 +596,42 @@ describe "A Pod::Specification, concerning its attributes that support different
...
@@ -596,4 +596,42 @@ describe "A Pod::Specification, concerning its attributes that support different
@spec
.
activate_platform
(
:osx
).
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'SSZipArchive'
)]
@spec
.
activate_platform
(
:osx
).
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'SSZipArchive'
)]
end
end
end
end
describe
"concerning ARC before and after iOS 6.0 and OS X 10.8"
do
before
do
@spec
=
Pod
::
Spec
.
new
end
it
"does not do anything if ARC is *not* required"
do
@spec
.
ios
.
deployment_target
=
'5'
@spec
.
osx
.
deployment_target
=
'10.6'
[
:ios
,
:osx
,
[
:ios
,
'6'
],
[
:ios
,
'6.1'
],
[
:osx
,
'10.8'
],
[
:osx
,
'10.8.2'
]].
each
do
|
target
|
@spec
.
activate_platform
(
*
target
).
compiler_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
end
end
it
"does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8"
do
@spec
.
ios
.
deployment_target
=
'6'
@spec
.
osx
.
deployment_target
=
'10.8'
[[
:ios
,
'6'
],
[
:ios
,
'6.1'
],
[
:osx
,
'10.8'
],
[
:osx
,
'10.8.2'
]].
each
do
|
target
|
@spec
.
activate_platform
(
*
target
).
compiler_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
end
end
it
"*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8"
do
@spec
.
requires_arc
=
true
@spec
.
ios
.
deployment_target
=
'5.1'
@spec
.
osx
.
deployment_target
=
'10.7.2'
[[
:ios
,
'6'
],
[
:ios
,
'6.1'
],
[
:osx
,
'10.8'
],
[
:osx
,
'10.8.2'
]].
each
do
|
target
|
@spec
.
activate_platform
(
*
target
).
compiler_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC=0'
end
end
it
"*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified"
do
@spec
.
requires_arc
=
true
[
:ios
,
:osx
,
[
:ios
,
'6'
],
[
:ios
,
'6.1'
],
[
:osx
,
'10.8'
],
[
:osx
,
'10.8.2'
]].
each
do
|
target
|
@spec
.
activate_platform
(
*
target
).
compiler_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC=0'
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