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
25e2940f
Commit
25e2940f
authored
May 09, 2015
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PodTarget] Make #include_in_build_config? ready for deduplication
parent
142b23c3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
14 deletions
+20
-14
aggregate_target_installer.rb
.../installer/target_installer/aggregate_target_installer.rb
+2
-2
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+1
-1
pod_target.rb
lib/cocoapods/target/pod_target.rb
+10
-4
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+2
-2
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+5
-5
No files found.
lib/cocoapods/installer/target_installer/aggregate_target_installer.rb
View file @
25e2940f
...
@@ -101,7 +101,7 @@ module Pod
...
@@ -101,7 +101,7 @@ module Pod
end
end
resources_by_config
=
{}
resources_by_config
=
{}
target
.
user_build_configurations
.
keys
.
each
do
|
config
|
target
.
user_build_configurations
.
keys
.
each
do
|
config
|
file_accessors
=
library_targets
.
select
{
|
t
|
t
.
include_in_build_config?
(
config
)
}.
flat_map
(
&
:file_accessors
)
file_accessors
=
library_targets
.
select
{
|
t
|
t
.
include_in_build_config?
(
target_definition
,
config
)
}.
flat_map
(
&
:file_accessors
)
resource_paths
=
file_accessors
.
flat_map
{
|
accessor
|
accessor
.
resources
.
flat_map
{
|
res
|
res
.
relative_path_from
(
project
.
path
.
dirname
)
}
}
resource_paths
=
file_accessors
.
flat_map
{
|
accessor
|
accessor
.
resources
.
flat_map
{
|
res
|
res
.
relative_path_from
(
project
.
path
.
dirname
)
}
}
resource_bundles
=
file_accessors
.
flat_map
{
|
accessor
|
accessor
.
resource_bundles
.
keys
.
map
{
|
name
|
"${BUILT_PRODUCTS_DIR}/
#{
name
.
shellescape
}
.bundle"
}
}
resource_bundles
=
file_accessors
.
flat_map
{
|
accessor
|
accessor
.
resource_bundles
.
keys
.
map
{
|
name
|
"${BUILT_PRODUCTS_DIR}/
#{
name
.
shellescape
}
.bundle"
}
}
resources_by_config
[
config
]
=
(
resource_paths
+
resource_bundles
).
uniq
resources_by_config
[
config
]
=
(
resource_paths
+
resource_bundles
).
uniq
...
@@ -139,7 +139,7 @@ module Pod
...
@@ -139,7 +139,7 @@ module Pod
frameworks_by_config
=
{}
frameworks_by_config
=
{}
target
.
user_build_configurations
.
keys
.
each
do
|
config
|
target
.
user_build_configurations
.
keys
.
each
do
|
config
|
frameworks_by_config
[
config
]
=
target
.
pod_targets
.
select
do
|
pod_target
|
frameworks_by_config
[
config
]
=
target
.
pod_targets
.
select
do
|
pod_target
|
pod_target
.
include_in_build_config?
(
config
)
&&
pod_target
.
should_build?
pod_target
.
include_in_build_config?
(
target_definition
,
config
)
&&
pod_target
.
should_build?
end
.
map
do
|
pod_target
|
end
.
map
do
|
pod_target
|
"
#{
target_definition
.
label
}
/
#{
pod_target
.
product_name
}
"
"
#{
target_definition
.
label
}
/
#{
pod_target
.
product_name
}
"
end
end
...
...
lib/cocoapods/target/aggregate_target.rb
View file @
25e2940f
...
@@ -94,7 +94,7 @@ module Pod
...
@@ -94,7 +94,7 @@ module Pod
#
#
def
pod_targets_for_build_configuration
(
build_configuration
)
def
pod_targets_for_build_configuration
(
build_configuration
)
pod_targets
.
select
do
|
pod_target
|
pod_targets
.
select
do
|
pod_target
|
pod_target
.
include_in_build_config?
(
build_configuration
)
pod_target
.
include_in_build_config?
(
target_definition
,
build_configuration
)
end
end
end
end
...
...
lib/cocoapods/target/pod_target.rb
View file @
25e2940f
...
@@ -121,13 +121,16 @@ module Pod
...
@@ -121,13 +121,16 @@ module Pod
end
end
# Checks if the target should be included in the build configuration with
# Checks if the target should be included in the build configuration with
# the given name.
# the given name of a given target definition.
#
# @param [TargetDefinition] target_definition
# The target definition to check.
#
#
# @param [String] configuration_name
# @param [String] configuration_name
# The name of the build configuration.
# The name of the build configuration.
#
#
def
include_in_build_config?
(
configuration_name
)
def
include_in_build_config?
(
target_definition
,
configuration_name
)
whitelists
=
target_definition_dependencies
.
map
do
|
dependency
|
whitelists
=
target_definition_dependencies
(
target_definition
)
.
map
do
|
dependency
|
target_definition
.
pod_whitelisted_for_configuration?
(
dependency
.
name
,
configuration_name
)
target_definition
.
pod_whitelisted_for_configuration?
(
dependency
.
name
,
configuration_name
)
end
.
uniq
end
.
uniq
...
@@ -145,12 +148,15 @@ module Pod
...
@@ -145,12 +148,15 @@ module Pod
private
private
# @param [TargetDefinition] target_definition
# The target definition to check.
#
# @return [Array<Dependency>] The dependency of the target definition for
# @return [Array<Dependency>] The dependency of the target definition for
# this Pod. Return an empty array if the Pod is not a direct
# this Pod. Return an empty array if the Pod is not a direct
# dependency of the target definition but the dependency of one or
# dependency of the target definition but the dependency of one or
# more Pods.
# more Pods.
#
#
def
target_definition_dependencies
def
target_definition_dependencies
(
target_definition
)
target_definition
.
dependencies
.
select
do
|
dependency
|
target_definition
.
dependencies
.
select
do
|
dependency
|
Specification
.
root_name
(
dependency
.
name
)
==
pod_name
Specification
.
root_name
(
dependency
.
name
)
==
pod_name
end
end
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
25e2940f
...
@@ -97,8 +97,8 @@ module Pod
...
@@ -97,8 +97,8 @@ module Pod
describe
'with configuration dependent pod targets'
do
describe
'with configuration dependent pod targets'
do
before
do
before
do
@pod_target_release
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@pod_target_release
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
'Debug'
).
returns
(
false
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Debug'
).
returns
(
false
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
'Release'
).
returns
(
true
)
@pod_target_release
.
expects
(
:include_in_build_config?
).
with
(
@target_definition
,
'Release'
).
returns
(
true
)
@target
.
pod_targets
=
[
@pod_target
,
@pod_target_release
]
@target
.
pod_targets
=
[
@pod_target
,
@pod_target_release
]
@target
.
user_build_configurations
=
{
@target
.
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Debug'
=>
:debug
,
...
...
spec/unit/target/pod_target_spec.rb
View file @
25e2940f
...
@@ -63,13 +63,13 @@ module Pod
...
@@ -63,13 +63,13 @@ module Pod
it
'returns whether it is whitelisted in a build configuration'
do
it
'returns whether it is whitelisted in a build configuration'
do
@target_definition
.
store_pod
(
'BananaLib'
)
@target_definition
.
store_pod
(
'BananaLib'
)
@target_definition
.
whitelist_pod_for_configuration
(
'BananaLib'
,
'debug'
)
@target_definition
.
whitelist_pod_for_configuration
(
'BananaLib'
,
'debug'
)
@pod_target
.
include_in_build_config?
(
'Debug'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Debug'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
'Release'
).
should
.
be
.
false
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Release'
).
should
.
be
.
false
end
end
it
'is whitelisted on all build configurations of it is a dependency of other Pods'
do
it
'is whitelisted on all build configurations of it is a dependency of other Pods'
do
@pod_target
.
include_in_build_config?
(
'Debug'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Debug'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
'Release'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
@target_definition
,
'Release'
).
should
.
be
.
true
end
end
it
'raises if a Pod is whitelisted for different build configurations'
do
it
'raises if a Pod is whitelisted for different build configurations'
do
...
@@ -77,7 +77,7 @@ module Pod
...
@@ -77,7 +77,7 @@ module Pod
@target_definition
.
store_pod
(
'BananaLib/Subspec'
)
@target_definition
.
store_pod
(
'BananaLib/Subspec'
)
@target_definition
.
whitelist_pod_for_configuration
(
'BananaLib'
,
'debug'
)
@target_definition
.
whitelist_pod_for_configuration
(
'BananaLib'
,
'debug'
)
message
=
should
.
raise
Informative
do
message
=
should
.
raise
Informative
do
@pod_target
.
include_in_build_config?
(
'release'
).
should
.
be
.
true
@pod_target
.
include_in_build_config?
(
@target_definition
,
'release'
).
should
.
be
.
true
end
.
message
end
.
message
message
.
should
.
match
/subspecs across different build configurations/
message
.
should
.
match
/subspecs across different build configurations/
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