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
756f48c2
Commit
756f48c2
authored
Jun 16, 2017
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add inputs and outputs for resources script phase
parent
7246c408
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
16 deletions
+54
-16
CHANGELOG.md
CHANGELOG.md
+4
-0
target_integrator.rb
...ds/installer/user_project_integrator/target_integrator.rb
+6
-2
aggregate_target_installer.rb
...code/pods_project_generator/aggregate_target_installer.rb
+1
-1
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+3
-3
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
target_integrator_spec.rb
...staller/user_project_integrator/target_integrator_spec.rb
+35
-5
aggregate_target_installer_spec.rb
...pods_project_generator/aggregate_target_installer_spec.rb
+4
-4
No files found.
CHANGELOG.md
View file @
756f48c2
...
...
@@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
*
Add inputs and outputs for resources script phase
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6806
](
https://github.com/CocoaPods/CocoaPods/pull/6806
)
*
Simplify logic around framework input and output paths
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6803
](
https://github.com/CocoaPods/CocoaPods/pull/6803
)
...
...
lib/cocoapods/installer/user_project_integrator/target_integrator.rb
View file @
756f48c2
...
...
@@ -136,7 +136,7 @@ module Pod
script_path
=
target
.
embed_frameworks_script_relative_path
phase
.
shell_script
=
%("#{script_path}"\n)
framework_paths_by_config
=
target
.
framework_paths_by_config
.
values
.
flatten
.
uniq
unless
framework_paths_by_config
.
empty?
unless
framework_paths_by_config
.
all?
(
&
:empty?
)
phase
.
input_paths
=
[
target
.
embed_frameworks_script_relative_path
,
*
framework_paths_by_config
.
map
{
|
fw
|
[
fw
[
:input_path
],
fw
[
:dsym_input_path
]]
}.
flatten
.
compact
]
phase
.
output_paths
=
framework_paths_by_config
.
map
{
|
fw
|
[
fw
[
:output_path
],
fw
[
:dsym_output_path
]]
}.
flatten
.
compact
end
...
...
@@ -164,7 +164,11 @@ module Pod
phase
=
create_or_update_build_phase
(
native_target
,
phase_name
)
script_path
=
target
.
copy_resources_script_relative_path
phase
.
shell_script
=
%("#{script_path}"\n)
# TODO: Add input and output paths for the copy resources script phase.
resource_paths_by_config
=
target
.
resource_paths_by_config
unless
resource_paths_by_config
.
values
.
all?
(
&
:empty?
)
phase
.
input_paths
=
[
target
.
copy_resources_script_relative_path
,
*
resource_paths_by_config
.
values
.
flatten
.
uniq
]
phase
.
output_paths
=
[
'${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'
]
end
end
end
...
...
lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb
View file @
756f48c2
...
...
@@ -119,7 +119,7 @@ module Pod
#
def
create_copy_resources_script
path
=
target
.
copy_resources_script_path
generator
=
Generator
::
CopyResourcesScript
.
new
(
target
.
resources_by_config
,
target
.
platform
)
generator
=
Generator
::
CopyResourcesScript
.
new
(
target
.
resource
_path
s_by_config
,
target
.
platform
)
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
end
...
...
lib/cocoapods/target/aggregate_target.rb
View file @
756f48c2
...
...
@@ -222,9 +222,9 @@ module Pod
framework_paths_by_config
end
# @return [Hash{ S
ymbol => Array<Pathname
> }] Uniqued Resources grouped by config
# @return [Hash{ S
tring => Array<String
> }] Uniqued Resources grouped by config
#
def
resources_by_config
def
resource
_path
s_by_config
library_targets
=
pod_targets
.
reject
do
|
pod_target
|
pod_target
.
should_build?
&&
pod_target
.
requires_frameworks?
end
...
...
@@ -232,7 +232,7 @@ module Pod
resources_by_config
[
config
]
=
library_targets
.
flat_map
do
|
library_target
|
next
[]
unless
library_target
.
include_in_build_config?
(
target_definition
,
config
)
resource_paths
=
library_target
.
file_accessors
.
flat_map
do
|
accessor
|
accessor
.
resources
.
flat_map
{
|
res
|
res
.
relative_path_from
(
sandbox
.
project
.
path
.
dirname
)
}
accessor
.
resources
.
flat_map
{
|
res
|
"${PODS_ROOT}/
#{
res
.
relative_path_from
(
sandbox
.
project
.
path
.
dirname
)
}
"
}
end
resource_bundles
=
library_target
.
file_accessors
.
flat_map
do
|
accessor
|
accessor
.
resource_bundles
.
keys
.
map
{
|
name
|
"
#{
library_target
.
configuration_build_dir
}
/
#{
name
.
shellescape
}
.bundle"
}
...
...
cocoapods-integration-specs
@
72424f47
Subproject commit
20fe360fab027944870e3e7f6307942e994acc74
Subproject commit
72424f479a2e86682d511955ada020e87d631231
spec/unit/installer/user_project_integrator/target_integrator_spec.rb
View file @
756f48c2
...
...
@@ -31,6 +31,10 @@ module Pod
@phase_prefix
=
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
BUILD_PHASE_PREFIX
@embed_framework_phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
EMBED_FRAMEWORK_PHASE_NAME
@copy_pods_resources_phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
COPY_PODS_RESOURCES_PHASE_NAME
@check_manifest_phase_name
=
@phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
CHECK_MANIFEST_PHASE_NAME
end
describe
'#integrate!'
do
...
...
@@ -47,7 +51,7 @@ module Pod
it
'fixes the copy resource scripts of legacy installations'
do
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase_name
=
@
phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
COPY_PODS_RESOURCES_PHASE_NAME
phase_name
=
@
copy_pods_resources_phase_name
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
.
shell_script
=
%("${SRCROOT}/../Pods/Pods-resources.sh"\n)
@target_integrator
.
integrate!
...
...
@@ -85,7 +89,7 @@ module Pod
it
'adds a Copy Pods Resources build phase to each target'
do
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase_name
=
@
phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
COPY_PODS_RESOURCES_PHASE_NAME
phase_name
=
@
copy_pods_resources_phase_name
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
.
shell_script
.
strip
.
should
==
'"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh"'
end
...
...
@@ -93,7 +97,7 @@ module Pod
it
'adds a Check Manifest.lock build phase to each target'
do
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase_name
=
@
phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
CHECK_MANIFEST_PHASE_NAME
phase_name
=
@
check_manifest_phase_name
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
phase
.
shell_script
.
should
==
<<-
EOS
.
strip_heredoc
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
...
...
@@ -111,7 +115,7 @@ module Pod
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
target
.
build_phases
.
first
phase_name
=
@
phase_prefix
+
Installer
::
UserProjectIntegrator
::
TargetIntegrator
::
CHECK_MANIFEST_PHASE_NAME
phase_name
=
@
check_manifest_phase_name
phase
=
target
.
build_phases
.
find
{
|
bp
|
bp
.
name
==
phase_name
}
target
.
build_phases
.
first
.
should
.
equal?
phase
end
...
...
@@ -284,8 +288,34 @@ module Pod
phase
.
nil?
.
should
==
true
end
it
'does not add copy pods resources input and output paths with no resources'
do
@pod_bundle
.
stubs
(
:resource_paths_by_config
=>
{
'Debug'
=>
[],
'Release'
=>
[]
})
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
@copy_pods_resources_phase_name
}
phase
.
input_paths
.
should
.
be
.
empty
phase
.
output_paths
.
should
.
be
.
empty
end
it
'adds copy pods resources input and output paths'
do
resource_paths_by_config
=
{
'Debug'
=>
[
'$PODS_CONFIGURATION_BUILD_DIR/DebugLib/DebugLib.bundle'
],
'Release'
=>
[
'$PODS_CONFIGURATION_BUILD_DIR/ReleaseLib/ReleaseLib.bundle'
],
}
@pod_bundle
.
stubs
(
:resource_paths_by_config
=>
resource_paths_by_config
)
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
@copy_pods_resources_phase_name
}
phase
.
input_paths
.
sort
.
should
==
%w(
$PODS_CONFIGURATION_BUILD_DIR/DebugLib/DebugLib.bundle
$PODS_CONFIGURATION_BUILD_DIR/ReleaseLib/ReleaseLib.bundle
${SRCROOT}/../Pods/Target\ Support\ Files/Pods/Pods-resources.sh
)
phase
.
output_paths
.
sort
.
should
==
%w(${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH})
end
it
'does not add embed frameworks build phase input output paths with no frameworks'
do
@pod_bundle
.
stubs
(
:framework_paths_by_config
=>
{})
@pod_bundle
.
stubs
(
:framework_paths_by_config
=>
{
'Debug'
=>
{},
'Release'
=>
{}
})
@target_integrator
.
integrate!
target
=
@target_integrator
.
send
(
:native_targets
).
first
phase
=
target
.
shell_script_build_phases
.
find
{
|
bp
|
bp
.
name
==
@embed_framework_phase_name
}
...
...
spec/unit/installer/xcode/pods_project_generator/aggregate_target_installer_spec.rb
View file @
756f48c2
...
...
@@ -158,7 +158,7 @@ module Pod
'Trees'
=>
[
Pathname
(
'palm.jpg'
)],
'Leafs'
=>
[
Pathname
(
'leaf.jpg'
)],
)
resources_by_config
=
@target
.
resources_by_config
resources_by_config
=
@target
.
resource
_path
s_by_config
resources_by_config
.
each_value
do
|
resources
|
resources
.
should
.
include
'$PODS_CONFIGURATION_BUILD_DIR/BananaLib/Trees.bundle'
resources
.
should
.
include
'$PODS_CONFIGURATION_BUILD_DIR/BananaLib/Leafs.bundle'
...
...
@@ -167,7 +167,7 @@ module Pod
it
'adds the bridge support file to the copy resources script, if one was created'
do
Podfile
.
any_instance
.
stubs
(
:generate_bridge_support?
=>
true
)
resources_by_config
=
@target
.
resources_by_config
resources_by_config
=
@target
.
resource
_path
s_by_config
resources_by_config
.
each_value
do
|
resources
|
resources
.
should
.
include
@installer
.
target
.
bridge_support_file
end
...
...
@@ -190,10 +190,10 @@ module Pod
accessor
.
stubs
(
:resources
=>
duplicated_paths
)
end
end
resources_by_config
=
@target
.
resources_by_config
resources_by_config
=
@target
.
resource
_path
s_by_config
resources_by_config
.
each_value
do
|
resources
|
resources
.
length
.
should
==
1
resources
[
0
]
.
basename
.
should
==
a_path
.
basename
Pathname
.
new
(
resources
[
0
])
.
basename
.
should
==
a_path
.
basename
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