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
e92cd653
Commit
e92cd653
authored
Apr 28, 2016
by
Marius Rackwitz
Committed by
Samuel Giddins
Apr 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XCConfig] Support customized build dirs in user project
parent
ea67c41e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
33 deletions
+60
-33
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+28
-17
pod_target.rb
lib/cocoapods/target/pod_target.rb
+2
-2
aggregate_xcconfig_spec.rb
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
+14
-6
pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
+8
-0
aggregate_target_installer_spec.rb
...aller/target_installer/aggregate_target_installer_spec.rb
+2
-2
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+6
-6
No files found.
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
e92cd653
...
...
@@ -4,12 +4,21 @@ module Pod
# Stores the shared logic of the classes of the XCConfig module.
#
module
XCConfigHelper
# @return [String]
Defined to hold the default Xcode build path, so
#
that when this is overridden per {PodTarget}, it is still
#
possible to reference other build products relative to the
#
original path
.
# @return [String]
Used as alias for BUILD_DIR, so that when this
#
is overridden in the user target, the user can override
#
this variable to point to the standard directory, which
#
will be used by CocoaPods
.
#
SHARED_BUILD_DIR_VARIABLE
=
'PODS_SHARED_BUILD_DIR'
.
freeze
BUILD_DIR_VARIABLE
=
'$PODS_BUILD_DIR'
.
freeze
# @return [String] Used as alias for CONFIGURATION_BUILD_DIR, so that
# when this is overridden per {PodTarget}, it is still possible
# to reference other build products relative to the original
# path. Furthermore if it was overridden in the user target,
# the user can override this variable to point to the standard
# directory, which will be used by CocoaPods.
#
CONFIGURATION_BUILD_DIR_VARIABLE
=
'$PODS_CONFIGURATION_BUILD_DIR'
.
freeze
# Converts an array of strings to a single string where the each string
# is surrounded by double quotes and separated by a space. Used to
...
...
@@ -232,25 +241,27 @@ module Pod
#
def
self
.
settings_for_dependent_targets
(
target
,
dependent_targets
)
dependent_targets
=
dependent_targets
.
select
(
&
:should_build?
)
has_configuration_build_dir
=
target
.
respond_to?
(
:configuration_build_dir
)
if
has_configuration_build_dir
build_dir_var
=
"$
#{
SHARED_BUILD_DIR_VARIABLE
}
"
build_settings
=
{
'CONFIGURATION_BUILD_DIR'
=>
target
.
configuration_build_dir
(
build_dir_var
),
SHARED_BUILD_DIR_VARIABLE
=>
'$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
,
}
else
build_dir_var
=
'$CONFIGURATION_BUILD_DIR'
build_settings
=
{}
# Alias build dirs to avoid recursive definitions for pod targets and depending
# on build settings which could be overwritten in the user target.
build_settings
=
{
BUILD_DIR_VARIABLE
[
1
..-
1
]
=>
'$BUILD_DIR'
,
CONFIGURATION_BUILD_DIR_VARIABLE
[
1
..-
1
]
=>
"
#{
BUILD_DIR_VARIABLE
}
/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"
,
}
# Scope pod targets
if
target
.
respond_to?
(
:configuration_build_dir
)
build_settings
[
'CONFIGURATION_BUILD_DIR'
]
=
target
.
configuration_build_dir
(
CONFIGURATION_BUILD_DIR_VARIABLE
)
end
unless
dependent_targets
.
empty?
framework_search_paths
=
[]
library_search_paths
=
[]
dependent_targets
.
each
do
|
dependent_target
|
if
dependent_target
.
requires_frameworks?
framework_search_paths
<<
dependent_target
.
configuration_build_dir
(
build_dir_var
)
framework_search_paths
<<
dependent_target
.
configuration_build_dir
(
CONFIGURATION_BUILD_DIR_VARIABLE
)
else
library_search_paths
<<
dependent_target
.
configuration_build_dir
(
build_dir_var
)
library_search_paths
<<
dependent_target
.
configuration_build_dir
(
CONFIGURATION_BUILD_DIR_VARIABLE
)
end
end
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
]
=
XCConfigHelper
.
quote
(
framework_search_paths
.
uniq
)
...
...
lib/cocoapods/target/pod_target.rb
View file @
e92cd653
...
...
@@ -240,7 +240,7 @@ module Pod
#
# @return [String] The absolute path to the configuration build dir
#
def
configuration_build_dir
(
dir
=
'$CONFIGURATION_BUILD_DIR'
)
def
configuration_build_dir
(
dir
=
Generator
::
XCConfig
::
XCConfigHelper
::
CONFIGURATION_BUILD_DIR_VARIABLE
)
"
#{
dir
}
/
#{
label
}
"
end
...
...
@@ -249,7 +249,7 @@ module Pod
#
# @return [String] The absolute path to the build product
#
def
build_product_path
(
dir
=
'$CONFIGURATION_BUILD_DIR'
)
def
build_product_path
(
dir
=
Generator
::
XCConfig
::
XCConfigHelper
::
CONFIGURATION_BUILD_DIR_VARIABLE
)
"
#{
configuration_build_dir
(
dir
)
}
/
#{
product_name
}
"
end
...
...
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
View file @
e92cd653
...
...
@@ -61,6 +61,14 @@ module Pod
@xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}/Pods'
end
it
'sets the PODS_BUILD_DIR build variable'
do
@xcconfig
.
to_hash
[
'PODS_BUILD_DIR'
].
should
==
'$BUILD_DIR'
end
it
'sets the PODS_CONFIGURATION_BUILD_DIR build variable'
do
@xcconfig
.
to_hash
[
'PODS_CONFIGURATION_BUILD_DIR'
].
should
==
'$PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
end
it
'adds the COCOAPODS macro definition'
do
@xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
.
include
'COCOAPODS=1'
end
...
...
@@ -166,12 +174,12 @@ module Pod
end
it
'does not include framework header paths as local headers for pods that are linked statically'
do
monkey_headers
=
'-iquote "$CONFIGURATION_BUILD_DIR/monkey.framework/Headers"'
monkey_headers
=
'-iquote "$
PODS_
CONFIGURATION_BUILD_DIR/monkey.framework/Headers"'
@xcconfig
.
to_hash
[
'OTHER_CFLAGS'
].
should
.
not
.
include
monkey_headers
end
it
'includes the public header paths as system headers'
do
expected
=
'$(inherited) -iquote "$CONFIGURATION_BUILD_DIR/OrangeFramework/OrangeFramework.framework/Headers" -isystem "${PODS_ROOT}/Headers/Public"'
expected
=
'$(inherited) -iquote "$
PODS_
CONFIGURATION_BUILD_DIR/OrangeFramework/OrangeFramework.framework/Headers" -isystem "${PODS_ROOT}/Headers/Public"'
@generator
.
stubs
(
:pod_targets
).
returns
([
@pod_targets
.
first
,
pod_target
(
fixture_spec
(
'orange-framework/OrangeFramework.podspec'
),
@target_definition
)])
@xcconfig
=
@generator
.
generate
@xcconfig
.
to_hash
[
'OTHER_CFLAGS'
].
should
==
expected
...
...
@@ -205,22 +213,22 @@ module Pod
end
it
'adds the framework build path to the xcconfig, with quotes, as framework search paths'
do
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'$(inherited) "$
CONFIGURATION_BUILD_DIR/BananaLib-iOS" "$
CONFIGURATION_BUILD_DIR/OrangeFramework-iOS"'
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'$(inherited) "$
PODS_CONFIGURATION_BUILD_DIR/BananaLib-iOS" "$PODS_
CONFIGURATION_BUILD_DIR/OrangeFramework-iOS"'
end
it
'adds the framework header paths to the xcconfig, with quotes, as local headers'
do
expected
=
'$(inherited) -iquote "$
CONFIGURATION_BUILD_DIR/BananaLib-iOS/BananaLib.framework/Headers" -iquote "$
CONFIGURATION_BUILD_DIR/OrangeFramework-iOS/OrangeFramework.framework/Headers"'
expected
=
'$(inherited) -iquote "$
PODS_CONFIGURATION_BUILD_DIR/BananaLib-iOS/BananaLib.framework/Headers" -iquote "$PODS_
CONFIGURATION_BUILD_DIR/OrangeFramework-iOS/OrangeFramework.framework/Headers"'
@xcconfig
.
to_hash
[
'OTHER_CFLAGS'
].
should
==
expected
end
end
describe
'with an unscoped pod target'
do
it
'adds the framework build path to the xcconfig, with quotes, as framework search paths'
do
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'$(inherited) "$CONFIGURATION_BUILD_DIR/OrangeFramework"'
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'$(inherited) "$
PODS_
CONFIGURATION_BUILD_DIR/OrangeFramework"'
end
it
'adds the framework header paths to the xcconfig, with quotes, as local headers'
do
expected
=
'$(inherited) -iquote "$CONFIGURATION_BUILD_DIR/OrangeFramework/OrangeFramework.framework/Headers"'
expected
=
'$(inherited) -iquote "$
PODS_
CONFIGURATION_BUILD_DIR/OrangeFramework/OrangeFramework.framework/Headers"'
@xcconfig
.
to_hash
[
'OTHER_CFLAGS'
].
should
==
expected
end
end
...
...
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
View file @
e92cd653
...
...
@@ -95,6 +95,14 @@ module Pod
@xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}'
end
it
'sets the PODS_BUILD_DIR build variable'
do
@xcconfig
.
to_hash
[
'PODS_BUILD_DIR'
].
should
==
'$BUILD_DIR'
end
it
'sets the PODS_CONFIGURATION_BUILD_DIR build variable'
do
@xcconfig
.
to_hash
[
'PODS_CONFIGURATION_BUILD_DIR'
].
should
==
'$PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
end
it
'will be skipped when installing'
do
@xcconfig
.
to_hash
[
'SKIP_INSTALL'
].
should
==
'YES'
end
...
...
spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
View file @
e92cd653
...
...
@@ -157,8 +157,8 @@ module Pod
)
resources_by_config
=
@installer
.
send
(
:resources_by_config
)
resources_by_config
.
each_value
do
|
resources
|
resources
.
should
.
include
'$CONFIGURATION_BUILD_DIR/BananaLib/Trees.bundle'
resources
.
should
.
include
'$CONFIGURATION_BUILD_DIR/BananaLib/Leafs.bundle'
resources
.
should
.
include
'$
PODS_
CONFIGURATION_BUILD_DIR/BananaLib/Trees.bundle'
resources
.
should
.
include
'$
PODS_
CONFIGURATION_BUILD_DIR/BananaLib/Leafs.bundle'
end
end
...
...
spec/unit/target/pod_target_spec.rb
View file @
e92cd653
...
...
@@ -169,15 +169,15 @@ module Pod
end
it
'returns the path for the CONFIGURATION_BUILD_DIR build setting'
do
@pod_target
.
configuration_build_dir
.
should
==
'$CONFIGURATION_BUILD_DIR/BananaLib'
@pod_target
.
scoped
.
first
.
configuration_build_dir
.
should
==
'$CONFIGURATION_BUILD_DIR/BananaLib-Pods'
@pod_target
.
configuration_build_dir
(
'$PODS_
SHARED_BUILD_DIR'
).
should
==
'$PODS_SHARED
_BUILD_DIR/BananaLib'
@pod_target
.
scoped
.
first
.
configuration_build_dir
(
'$PODS_
SHARED_BUILD_DIR'
).
should
==
'$PODS_SHARED
_BUILD_DIR/BananaLib-Pods'
@pod_target
.
configuration_build_dir
.
should
==
'$
PODS_
CONFIGURATION_BUILD_DIR/BananaLib'
@pod_target
.
scoped
.
first
.
configuration_build_dir
.
should
==
'$
PODS_
CONFIGURATION_BUILD_DIR/BananaLib-Pods'
@pod_target
.
configuration_build_dir
(
'$PODS_
BUILD_DIR'
).
should
==
'$PODS
_BUILD_DIR/BananaLib'
@pod_target
.
scoped
.
first
.
configuration_build_dir
(
'$PODS_
BUILD_DIR'
).
should
==
'$PODS
_BUILD_DIR/BananaLib-Pods'
end
it
'returns the path for the CONFIGURATION_BUILD_DIR build setting'
do
@pod_target
.
build_product_path
.
should
==
'$CONFIGURATION_BUILD_DIR/BananaLib/libBananaLib.a'
@pod_target
.
scoped
.
first
.
build_product_path
.
should
==
'$CONFIGURATION_BUILD_DIR/BananaLib-Pods/libBananaLib-Pods.a'
@pod_target
.
build_product_path
.
should
==
'$
PODS_
CONFIGURATION_BUILD_DIR/BananaLib/libBananaLib.a'
@pod_target
.
scoped
.
first
.
build_product_path
.
should
==
'$
PODS_
CONFIGURATION_BUILD_DIR/BananaLib-Pods/libBananaLib-Pods.a'
@pod_target
.
build_product_path
(
'$BUILT_PRODUCTS_DIR'
).
should
==
'$BUILT_PRODUCTS_DIR/BananaLib/libBananaLib.a'
@pod_target
.
scoped
.
first
.
build_product_path
(
'$BUILT_PRODUCTS_DIR'
).
should
==
'$BUILT_PRODUCTS_DIR/BananaLib-Pods/libBananaLib-Pods.a'
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