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
6555d4e0
Commit
6555d4e0
authored
Jun 28, 2014
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Refactor] Renamed TargetInstaller#library to target
parent
6717e7be
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
55 deletions
+55
-55
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+16
-16
aggregate_target_installer.rb
.../installer/target_installer/aggregate_target_installer.rb
+15
-15
pod_target_installer.rb
...oapods/installer/target_installer/pod_target_installer.rb
+13
-13
aggregate_target_installer_spec.rb
...aller/target_installer/aggregate_target_installer_spec.rb
+2
-2
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+7
-7
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+2
-2
No files found.
lib/cocoapods/installer/target_installer.rb
View file @
6555d4e0
...
...
@@ -10,16 +10,16 @@ module Pod
#
attr_reader
:sandbox
# @return [
Library
] The library whose target needs to be generated.
# @return [
Target
] The library whose target needs to be generated.
#
attr_reader
:
library
attr_reader
:
target
# @param [Project] project @see project
# @param [
Library] library @see library
# @param [
Target] target @see target
#
def
initialize
(
sandbox
,
library
)
def
initialize
(
sandbox
,
target
)
@sandbox
=
sandbox
@
library
=
library
@
target
=
target
end
private
...
...
@@ -36,31 +36,31 @@ module Pod
# @return [void]
#
def
add_target
name
=
library
.
label
platform
=
library
.
platform
.
name
deployment_target
=
library
.
platform
.
deployment_target
.
to_s
name
=
target
.
label
platform
=
target
.
platform
.
name
deployment_target
=
target
.
platform
.
deployment_target
.
to_s
@native_target
=
project
.
new_target
(
:static_library
,
name
,
platform
,
deployment_target
)
library
.
user_build_configurations
.
each
do
|
bc_name
,
type
|
target
.
user_build_configurations
.
each
do
|
bc_name
,
type
|
configuration
=
@native_target
.
add_build_configuration
(
bc_name
,
type
)
end
settings
=
{
'OTHER_LDFLAGS'
=>
''
,
'OTHER_LIBTOOLFLAGS'
=>
''
}
if
library
.
archs
settings
[
'ARCHS'
]
=
library
.
archs
if
target
.
archs
settings
[
'ARCHS'
]
=
target
.
archs
end
@native_target
.
build_configurations
.
each
do
|
configuration
|
configuration
.
build_settings
.
merge!
(
settings
)
end
library
.
native_target
=
@native_target
target
.
native_target
=
@native_target
end
# Creates the directory where to store the support files of the target.
#
def
create_support_files_dir
library
.
support_files_dir
.
mkdir
target
.
support_files_dir
.
mkdir
end
# Generates a dummy source file for each target so libraries that contain
...
...
@@ -69,8 +69,8 @@ module Pod
# @return [void]
#
def
create_dummy_source
path
=
library
.
dummy_source_path
generator
=
Generator
::
DummySource
.
new
(
library
.
label
)
path
=
target
.
dummy_source_path
generator
=
Generator
::
DummySource
.
new
(
target
.
label
)
generator
.
save_as
(
path
)
file_reference
=
add_file_to_support_group
(
path
)
native_target
.
source_build_phase
.
add_file_reference
(
file_reference
)
...
...
@@ -98,7 +98,7 @@ module Pod
# @return [TargetDefinition] the target definition of the library.
#
def
target_definition
library
.
target_definition
target
.
target_definition
end
# @return [PBXGroup] the group where the file references to the support
...
...
lib/cocoapods/installer/target_installer/aggregate_target_installer.rb
View file @
6555d4e0
...
...
@@ -9,7 +9,7 @@ module Pod
# @return [void]
#
def
install!
UI
.
message
"- Installing target `
#{
library
.
name
}
`
#{
library
.
platform
}
"
do
UI
.
message
"- Installing target `
#{
target
.
name
}
`
#{
target
.
platform
}
"
do
add_target
create_support_files_dir
create_suport_files_group
...
...
@@ -33,8 +33,8 @@ module Pod
#
def
create_suport_files_group
parent
=
project
.
support_files_group
name
=
library
.
name
dir
=
library
.
support_files_dir
name
=
target
.
name
dir
=
target
.
support_files_dir
@support_files_group
=
parent
.
new_group
(
name
,
dir
)
end
...
...
@@ -44,10 +44,10 @@ module Pod
#
def
create_xcconfig_file
native_target
.
build_configurations
.
each
do
|
configuration
|
path
=
library
.
xcconfig_path
(
configuration
.
name
)
gen
=
Generator
::
XCConfig
::
AggregateXCConfig
.
new
(
library
,
configuration
.
name
)
path
=
target
.
xcconfig_path
(
configuration
.
name
)
gen
=
Generator
::
XCConfig
::
AggregateXCConfig
.
new
(
target
,
configuration
.
name
)
gen
.
save_as
(
path
)
library
.
xcconfigs
[
configuration
.
name
]
=
gen
.
xcconfig
target
.
xcconfigs
[
configuration
.
name
]
=
gen
.
xcconfig
xcconfig_file_ref
=
add_file_to_support_group
(
path
)
configuration
.
base_configuration_reference
=
xcconfig_file_ref
end
...
...
@@ -57,8 +57,8 @@ module Pod
# pods and the installed specifications of a pod.
#
def
create_target_environment_header
path
=
library
.
target_environment_header_path
generator
=
Generator
::
TargetEnvironmentHeader
.
new
(
library
.
specs_by_build_configuration
)
path
=
target
.
target_environment_header_path
generator
=
Generator
::
TargetEnvironmentHeader
.
new
(
target
.
specs_by_build_configuration
)
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
end
...
...
@@ -66,14 +66,14 @@ module Pod
# Generates the bridge support metadata if requested by the {Podfile}.
#
# @note The bridge support metadata is added to the resources of the
#
library
because it is needed for environments interpreted at
#
target
because it is needed for environments interpreted at
# runtime.
#
# @return [void]
#
def
create_bridge_support_file
if
target_definition
.
podfile
.
generate_bridge_support?
path
=
library
.
bridge_support_path
path
=
target
.
bridge_support_path
headers
=
native_target
.
headers_build_phase
.
files
.
map
{
|
bf
|
sandbox
.
root
+
bf
.
file_ref
.
path
}
generator
=
Generator
::
BridgeSupport
.
new
(
headers
)
generator
.
save_as
(
path
)
...
...
@@ -91,15 +91,15 @@ module Pod
# @return [void]
#
def
create_copy_resources_script
path
=
library
.
copy_resources_script_path
file_accessors
=
library
.
pod_targets
.
map
(
&
:file_accessors
).
flatten
path
=
target
.
copy_resources_script_path
file_accessors
=
target
.
pod_targets
.
map
(
&
:file_accessors
).
flatten
resource_paths
=
file_accessors
.
map
{
|
accessor
|
accessor
.
resources
.
flatten
.
map
{
|
res
|
res
.
relative_path_from
(
project
.
path
.
dirname
)
}
}.
flatten
resource_bundles
=
file_accessors
.
map
{
|
accessor
|
accessor
.
resource_bundles
.
keys
.
map
{
|
name
|
"${BUILT_PRODUCTS_DIR}/
#{
name
}
.bundle"
}
}.
flatten
resources
=
[]
resources
.
concat
(
resource_paths
)
resources
.
concat
(
resource_bundles
)
resources
<<
bridge_support_file
if
bridge_support_file
generator
=
Generator
::
CopyResourcesScript
.
new
(
resources
,
library
.
platform
)
generator
=
Generator
::
CopyResourcesScript
.
new
(
resources
,
target
.
platform
)
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
end
...
...
@@ -109,10 +109,10 @@ module Pod
# @return [void]
#
def
create_acknowledgements
basepath
=
library
.
acknowledgements_basepath
basepath
=
target
.
acknowledgements_basepath
Generator
::
Acknowledgements
.
generators
.
each
do
|
generator_class
|
path
=
generator_class
.
path_from_basepath
(
basepath
)
file_accessors
=
library
.
pod_targets
.
map
(
&
:file_accessors
).
flatten
file_accessors
=
target
.
pod_targets
.
map
(
&
:file_accessors
).
flatten
generator
=
generator_class
.
new
(
file_accessors
)
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
...
...
lib/cocoapods/installer/target_installer/pod_target_installer.rb
View file @
6555d4e0
...
...
@@ -9,7 +9,7 @@ module Pod
# @return [void]
#
def
install!
UI
.
message
"- Installing target `
#{
library
.
name
}
`
#{
library
.
platform
}
"
do
UI
.
message
"- Installing target `
#{
target
.
name
}
`
#{
target
.
platform
}
"
do
add_target
create_support_files_dir
add_files_to_build_phases
...
...
@@ -33,7 +33,7 @@ module Pod
# @return [void]
#
def
add_files_to_build_phases
library
.
file_accessors
.
each
do
|
file_accessor
|
target
.
file_accessors
.
each
do
|
file_accessor
|
consumer
=
file_accessor
.
spec_consumer
flags
=
compiler_flags_for_consumer
(
consumer
)
all_source_files
=
file_accessor
.
source_files
...
...
@@ -53,7 +53,7 @@ module Pod
# @return [void]
#
def
add_resources_bundle_targets
library
.
file_accessors
.
each
do
|
file_accessor
|
target
.
file_accessors
.
each
do
|
file_accessor
|
file_accessor
.
resource_bundles
.
each
do
|
bundle_name
,
paths
|
# Add a dependency on an existing Resource Bundle target if possible
if
bundle_target
=
project
.
targets
.
find
{
|
target
|
target
.
name
==
bundle_name
}
...
...
@@ -64,7 +64,7 @@ module Pod
bundle_target
=
project
.
new_resources_bundle
(
bundle_name
,
file_accessor
.
spec_consumer
.
platform_name
)
bundle_target
.
add_resources
(
file_references
)
library
.
user_build_configurations
.
each
do
|
bc_name
,
type
|
target
.
user_build_configurations
.
each
do
|
bc_name
,
type
|
bundle_target
.
add_build_configuration
(
bc_name
,
type
)
end
...
...
@@ -78,13 +78,13 @@ module Pod
# @return [void]
#
def
create_xcconfig_file
path
=
library
.
xcconfig_path
public_gen
=
Generator
::
XCConfig
::
PublicPodXCConfig
.
new
(
library
)
path
=
target
.
xcconfig_path
public_gen
=
Generator
::
XCConfig
::
PublicPodXCConfig
.
new
(
target
)
public_gen
.
save_as
(
path
)
add_file_to_support_group
(
path
)
path
=
library
.
xcconfig_private_path
private_gen
=
Generator
::
XCConfig
::
PrivatePodXCConfig
.
new
(
library
,
public_gen
.
xcconfig
)
path
=
target
.
xcconfig_private_path
private_gen
=
Generator
::
XCConfig
::
PrivatePodXCConfig
.
new
(
target
,
public_gen
.
xcconfig
)
private_gen
.
save_as
(
path
)
xcconfig_file_ref
=
add_file_to_support_group
(
path
)
...
...
@@ -100,9 +100,9 @@ module Pod
# @return [void]
#
def
create_prefix_header
path
=
library
.
prefix_header_path
generator
=
Generator
::
PrefixHeader
.
new
(
library
.
file_accessors
,
library
.
platform
)
generator
.
imports
<<
library
.
target_environment_header_path
.
basename
path
=
target
.
prefix_header_path
generator
=
Generator
::
PrefixHeader
.
new
(
target
.
file_accessors
,
target
.
platform
)
generator
.
imports
<<
target
.
target_environment_header_path
.
basename
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
...
...
@@ -176,8 +176,8 @@ module Pod
# @return [PBXFileReference] the file reference of the added file.
#
def
add_file_to_support_group
(
path
)
pod_name
=
library
.
pod_name
dir
=
library
.
support_files_dir
pod_name
=
target
.
pod_name
dir
=
target
.
support_files_dir
group
=
project
.
pod_support_files_group
(
pod_name
,
dir
)
group
.
new_file
(
path
)
end
...
...
spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
View file @
6555d4e0
...
...
@@ -109,7 +109,7 @@ module Pod
it
'does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default'
do
@installer
.
install!
@installer
.
library
.
native_target
.
build_configurations
.
each
do
|
config
|
@installer
.
target
.
native_target
.
build_configurations
.
each
do
|
config
|
config
.
build_settings
[
'GCC_WARN_INHIBIT_ALL_WARNINGS'
].
should
.
be
.
nil
end
end
...
...
@@ -166,7 +166,7 @@ module Pod
it
'creates a dummy source to ensure the creation of a single base library'
do
@installer
.
install!
build_files
=
@installer
.
library
.
native_target
.
source_build_phase
.
files
build_files
=
@installer
.
target
.
native_target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
path
.
include?
(
'Pods-dummy.m'
)
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-dummy.m'
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
6555d4e0
...
...
@@ -88,7 +88,7 @@ module Pod
it
'does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default'
do
@installer
.
install!
@installer
.
library
.
native_target
.
build_configurations
.
each
do
|
config
|
@installer
.
target
.
native_target
.
build_configurations
.
each
do
|
config
|
config
.
build_settings
[
'GCC_WARN_INHIBIT_ALL_WARNINGS'
].
should
.
be
.
nil
end
end
...
...
@@ -97,7 +97,7 @@ module Pod
it
'adds the source files of each pod to the target of the Pod library'
do
@installer
.
install!
names
=
@installer
.
library
.
native_target
.
source_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
display_name
}
names
=
@installer
.
target
.
native_target
.
source_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
display_name
}
names
.
should
.
include
(
'Banana.m'
)
end
...
...
@@ -142,7 +142,7 @@ module Pod
it
'creates a dummy source to ensure the compilation of libraries with only categories'
do
@installer
.
install!
build_files
=
@installer
.
library
.
native_target
.
source_build_phase
.
files
build_files
=
@installer
.
target
.
native_target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
display_name
==
'Pods-BananaLib-dummy.m'
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-BananaLib-dummy.m'
...
...
@@ -158,10 +158,10 @@ module Pod
end
it
'flags should not be added to dtrace files'
do
@installer
.
library
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
@installer
.
target
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
@installer
.
install!
dtrace_files
=
@installer
.
library
.
native_target
.
source_build_phase
.
files
.
reject
do
|
sf
|
dtrace_files
=
@installer
.
target
.
native_target
.
source_build_phase
.
files
.
reject
do
|
sf
|
!
(
File
.
extname
(
sf
.
file_ref
.
path
)
==
'.d'
)
end
dtrace_files
.
each
do
|
dt
|
...
...
@@ -170,7 +170,7 @@ module Pod
end
it
'adds -w per pod if target definition inhibits warnings for that pod'
do
@installer
.
library
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
@installer
.
target
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
include?
(
'-w'
)
...
...
@@ -182,7 +182,7 @@ module Pod
end
it
'adds -Xanalyzer -analyzer-disable-checker per pod'
do
@installer
.
library
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
@installer
.
target
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
include?
(
'-Xanalyzer -analyzer-disable-checker'
)
...
...
spec/unit/installer/target_installer_spec.rb
View file @
6555d4e0
...
...
@@ -42,8 +42,8 @@ module Pod
it
'always clears the OTHER_LDFLAGS and OTHER_LIBTOOLFLAGS, because these lib targets do not ever need any'
do
@installer
.
send
(
:add_target
)
@installer
.
send
(
:target
).
resolved_build_setting
(
'OTHER_LDFLAGS'
).
values
.
uniq
.
should
==
[
''
]
@installer
.
send
(
:target
).
resolved_build_setting
(
'OTHER_LIBTOOLFLAGS'
).
values
.
uniq
.
should
==
[
''
]
@installer
.
send
(
:
native_
target
).
resolved_build_setting
(
'OTHER_LDFLAGS'
).
values
.
uniq
.
should
==
[
''
]
@installer
.
send
(
:
native_
target
).
resolved_build_setting
(
'OTHER_LIBTOOLFLAGS'
).
values
.
uniq
.
should
==
[
''
]
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