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
0009b329
Commit
0009b329
authored
Jun 02, 2015
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AggregateXCConfig] Break down #generate
parent
042a6f6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
31 deletions
+67
-31
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+67
-31
No files found.
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
0009b329
...
@@ -54,10 +54,42 @@ module Pod
...
@@ -54,10 +54,42 @@ module Pod
'PODS_ROOT'
=>
target
.
relative_pods_root
,
'PODS_ROOT'
=>
target
.
relative_pods_root
,
'GCC_PREPROCESSOR_DEFINITIONS'
=>
'$(inherited) COCOAPODS=1'
,
'GCC_PREPROCESSOR_DEFINITIONS'
=>
'$(inherited) COCOAPODS=1'
,
}
}
@xcconfig
=
Xcodeproj
::
Config
.
new
(
config
)
@xcconfig
.
merge!
(
merged_user_target_xcconfigs
)
generate_settings_to_import_pod_targets
XCConfigHelper
.
add_target_specific_settings
(
target
,
@xcconfig
)
generate_vendored_build_settings
generate_other_ld_flags
# TODO: Need to decide how we are going to ensure settings like these
# are always excluded from the user's project.
#
# See https://github.com/CocoaPods/CocoaPods/issues/1216
@xcconfig
.
attributes
.
delete
(
'USE_HEADERMAP'
)
generate_ld_runpath_search_paths
if
target
.
requires_frameworks?
@xcconfig
end
#---------------------------------------------------------------------#
private
# Add build settings, which ensure that the pod targets can be imported
# from the integrating target by all sort of imports, which are:
# - `#import <…>`
# - `#import "…"`
# - `@import …` / `@import …;`
#
def
generate_settings_to_import_pod_targets
if
target
.
requires_frameworks?
if
target
.
requires_frameworks?
# Framework headers are automatically discoverable by `#import <…>`.
# Framework headers are automatically discoverable by `#import <…>`.
header_search_paths
=
pod_targets
.
map
do
|
target
|
header_search_paths
=
target
.
pod_targets
.
map
do
|
target
|
if
target
.
scoped?
if
target
.
scoped?
"$PODS_FRAMEWORK_BUILD_PATH/
#{
target
.
product_name
}
/Headers"
"$PODS_FRAMEWORK_BUILD_PATH/
#{
target
.
product_name
}
/Headers"
else
else
...
@@ -72,7 +104,7 @@ module Pod
...
@@ -72,7 +104,7 @@ module Pod
if
target
.
pod_targets
.
any?
{
|
t
|
t
.
should_build?
&&
t
.
scoped?
}
if
target
.
pod_targets
.
any?
{
|
t
|
t
.
should_build?
&&
t
.
scoped?
}
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
]
=
'$(inherited) "$PODS_FRAMEWORK_BUILD_PATH"'
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
]
=
'$(inherited) "$PODS_FRAMEWORK_BUILD_PATH"'
end
end
config
.
merge!
(
build_settings
)
@xc
config
.
merge!
(
build_settings
)
else
else
# Make headers discoverable from $PODS_ROOT/Headers directory
# Make headers discoverable from $PODS_ROOT/Headers directory
header_search_paths
=
target
.
sandbox
.
public_headers
.
search_paths
(
target
.
platform
)
header_search_paths
=
target
.
sandbox
.
public_headers
.
search_paths
(
target
.
platform
)
...
@@ -82,46 +114,50 @@ module Pod
...
@@ -82,46 +114,50 @@ module Pod
# by `#import <…>`
# by `#import <…>`
'OTHER_CFLAGS'
=>
'$(inherited) '
+
XCConfigHelper
.
quote
(
header_search_paths
,
'-isystem'
),
'OTHER_CFLAGS'
=>
'$(inherited) '
+
XCConfigHelper
.
quote
(
header_search_paths
,
'-isystem'
),
}
}
config
.
merge!
(
build_settings
)
@xc
config
.
merge!
(
build_settings
)
end
end
end
@xcconfig
=
Xcodeproj
::
Config
.
new
(
config
)
# Add custom build settings and required build settings to link to
# vendored libraries and frameworks.
XCConfigHelper
.
add_target_specific_settings
(
target
,
@xcconfig
)
#
# @note
pod_targets
.
each
do
|
pod_target
|
# In case of generated pod targets, which require frameworks, the
# vendored frameworks and libraries are already linked statically
# into the framework binary and must not be linked again to the
# user target.
#
def
generate_vendored_build_settings
target
.
pod_targets
.
each
do
|
pod_target
|
unless
pod_target
.
should_build?
&&
pod_target
.
requires_frameworks?
unless
pod_target
.
should_build?
&&
pod_target
.
requires_frameworks?
# In case of generated pod targets, which require frameworks, the
# vendored frameworks and libraries are already linked statically
# into the framework binary and must not be linked again to the
# user target.
XCConfigHelper
.
add_settings_for_file_accessors_of_target
(
pod_target
,
@xcconfig
)
XCConfigHelper
.
add_settings_for_file_accessors_of_target
(
pod_target
,
@xcconfig
)
end
end
end
end
# Add pod target to list of frameworks / libraries that are
# Add pod target to list of frameworks / libraries that are linked
# linked with the user’s project.
# with the user’s project.
if
pod_target
.
should_build?
#
if
pod_target
.
requires_frameworks?
def
generate_other_ld_flags
@xcconfig
.
merge!
(
'OTHER_LDFLAGS'
=>
%(-framework "#{pod_target.product_basename}")
)
other_ld_flags
=
target
.
pod_targets
.
select
(
&
:should_build?
).
map
do
|
pod_target
|
else
if
pod_target
.
requires_frameworks?
@xcconfig
.
merge!
(
'OTHER_LDFLAGS'
=>
%(-l "#{pod_target.product_basename}")
)
%(-framework "#{pod_target.product_basename}")
end
else
%(-l "#{pod_target.product_basename}")
end
end
end
end
@xcconfig
.
merge!
(
merged_user_target_xcconfigs
)
@xcconfig
.
merge!
(
'OTHER_LDFLAGS'
=>
other_ld_flags
.
join
(
' '
))
# TODO: Need to decide how we are going to ensure settings like these
# are always excluded from the user's project.
#
# See https://github.com/CocoaPods/CocoaPods/issues/1216
@xcconfig
.
attributes
.
delete
(
'USE_HEADERMAP'
)
generate_ld_runpath_search_paths
if
target
.
requires_frameworks?
@xcconfig
end
end
# Ensure to add the default linker run path search paths as they could
# be not present due to being historically absent in the project or
# target template or just being removed by being superficial when
# linking third-party dependencies exclusively statically. This is not
# something a project needs specifically for the integration with
# CocoaPods, but makes sure that it is self-contained for the given
# constraints.
#
def
generate_ld_runpath_search_paths
def
generate_ld_runpath_search_paths
ld_runpath_search_paths
=
[
'$(inherited)'
]
ld_runpath_search_paths
=
[
'$(inherited)'
]
if
target
.
platform
.
symbolic_name
==
:osx
if
target
.
platform
.
symbolic_name
==
:osx
...
...
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