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
cf14392d
Commit
cf14392d
authored
Mar 15, 2018
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Even more immutability across other classes
parent
1f95c589
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
167 additions
and
151 deletions
+167
-151
external_sources.rb
lib/cocoapods/external_sources.rb
+7
-4
abstract_external_source.rb
lib/cocoapods/external_sources/abstract_external_source.rb
+4
-3
header.rb
lib/cocoapods/generator/header.rb
+1
-1
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+54
-56
pod_xcconfig.rb
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
+22
-19
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+2
-3
target_inspection_result.rb
lib/cocoapods/installer/analyzer/target_inspection_result.rb
+24
-16
target_inspector.rb
lib/cocoapods/installer/analyzer/target_inspector.rb
+10
-11
pods_project_generator.rb
lib/cocoapods/installer/xcode/pods_project_generator.rb
+1
-2
aggregate_target_installer.rb
...code/pods_project_generator/aggregate_target_installer.rb
+2
-2
pod_target_installer.rb
...ller/xcode/pods_project_generator/pod_target_installer.rb
+16
-5
target_installer.rb
...nstaller/xcode/pods_project_generator/target_installer.rb
+4
-3
path_list.rb
lib/cocoapods/sandbox/path_list.rb
+2
-2
abstract_external_source_spec.rb
spec/unit/external_sources/abstract_external_source_spec.rb
+1
-1
downloader_source_spec.rb
spec/unit/external_sources/downloader_source_spec.rb
+1
-1
path_source_spec.rb
spec/unit/external_sources/path_source_spec.rb
+1
-1
podspec_source_spec.rb
spec/unit/external_sources/podspec_source_spec.rb
+1
-1
external_sources_spec.rb
spec/unit/external_sources_spec.rb
+3
-3
target_inspector_spec.rb
spec/unit/installer/analyzer/target_inspector_spec.rb
+5
-5
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+6
-12
No files found.
lib/cocoapods/external_sources.rb
View file @
cf14392d
...
...
@@ -16,18 +16,21 @@ module Pod
# @param [String] podfile_path
# @see AbstractExternalSource#podfile_path
#
# @param [Boolean] can_cache
# @see AbstractExternalSource#can_cache
#
# @return [AbstractExternalSource] an initialized instance of the concrete
# external source class associated with the option specified in the
# hash.
#
def
self
.
from_dependency
(
dependency
,
podfile_path
)
from_params
(
dependency
.
external_source
,
dependency
,
podfile_path
)
def
self
.
from_dependency
(
dependency
,
podfile_path
,
can_cache
)
from_params
(
dependency
.
external_source
,
dependency
,
podfile_path
,
can_cache
)
end
def
self
.
from_params
(
params
,
dependency
,
podfile_path
)
def
self
.
from_params
(
params
,
dependency
,
podfile_path
,
can_cache
)
name
=
dependency
.
root_name
if
klass
=
concrete_class_from_params
(
params
)
klass
.
new
(
name
,
params
,
podfile_path
)
klass
.
new
(
name
,
params
,
podfile_path
,
can_cache
)
else
msg
=
"Unknown external source parameters for `
#{
name
}
`: `
#{
params
}
`"
raise
Informative
,
msg
...
...
lib/cocoapods/external_sources/abstract_external_source.rb
View file @
cf14392d
...
...
@@ -19,7 +19,7 @@ module Pod
# @return [Boolean] Whether the source is allowed to touch the cache.
#
attr_
accesso
r
:can_cache
attr_
reade
r
:can_cache
alias_method
:can_cache?
,
:can_cache
# Initialize a new instance
...
...
@@ -27,12 +27,13 @@ module Pod
# @param [String] name @see #name
# @param [Hash] params @see #params
# @param [String] podfile_path @see #podfile_path
# @param [Boolean] can_cache @see #can_cache
#
def
initialize
(
name
,
params
,
podfile_path
)
def
initialize
(
name
,
params
,
podfile_path
,
can_cache
=
true
)
@name
=
name
@params
=
params
@podfile_path
=
podfile_path
@can_cache
=
tru
e
@can_cache
=
can_cach
e
end
# @return [Bool] whether an external source source is equal to another
...
...
lib/cocoapods/generator/header.rb
View file @
cf14392d
...
...
@@ -17,7 +17,7 @@ module Pod
# @return [Array<String>] The list of the modules to import.
#
attr_
accesso
r
:module_imports
attr_
reade
r
:module_imports
# Initialize a new instance
#
...
...
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
cf14392d
...
...
@@ -13,10 +13,6 @@ module Pod
#
attr_reader
:configuration_name
# @return [Xcodeproj::Config] The generated xcconfig.
#
attr_reader
:xcconfig
# Initialize a new instance
#
# @param [Target] target @see #target
...
...
@@ -32,10 +28,12 @@ module Pod
# @param [Pathname] path
# the path where the xcconfig should be stored.
#
# @return [
void
]
# @return [
Xcodeproj::Config
]
#
def
save_as
(
path
)
generate
.
save_as
(
path
)
result
=
generate
result
.
save_as
(
path
)
result
end
# Generates the xcconfig.
...
...
@@ -66,23 +64,23 @@ module Pod
'SWIFT_INCLUDE_PATHS'
=>
'$(inherited) '
,
}.
merge
(
embedded_content_settings
)
@
xcconfig
=
Xcodeproj
::
Config
.
new
(
config
)
xcconfig
=
Xcodeproj
::
Config
.
new
(
config
)
@
xcconfig
.
merge!
(
merged_user_target_xcconfigs
)
xcconfig
.
merge!
(
merged_user_target_xcconfigs
)
generate_settings_to_import_pod_targets
generate_settings_to_import_pod_targets
(
xcconfig
)
XCConfigHelper
.
add_target_specific_settings
(
target
,
@
xcconfig
)
XCConfigHelper
.
add_target_specific_settings
(
target
,
xcconfig
)
targets
=
pod_targets
+
target
.
search_paths_aggregate_targets
.
flat_map
(
&
:pod_targets
)
XCConfigHelper
.
generate_vendored_build_settings
(
target
,
targets
,
@
xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
target
,
pod_targets
,
@
xcconfig
)
XCConfigHelper
.
generate_vendored_build_settings
(
target
,
targets
,
xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
target
,
pod_targets
,
xcconfig
)
# 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'
)
xcconfig
.
attributes
.
delete
(
'USE_HEADERMAP'
)
# If any of the aggregate target dependencies bring in any vendored dynamic artifacts we should ensure to
# update the runpath search paths.
...
...
@@ -90,48 +88,15 @@ module Pod
symbol_type
=
target
.
user_targets
.
map
(
&
:symbol_type
).
uniq
.
first
test_bundle
=
symbol_type
==
:octest_bundle
||
symbol_type
==
:unit_test_bundle
||
symbol_type
==
:ui_test_bundle
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
target
.
requires_host_target?
,
test_bundle
,
@
xcconfig
)
if
target
.
requires_frameworks?
||
vendored_dynamic_artifacts
.
count
>
0
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
target
.
requires_host_target?
,
test_bundle
,
xcconfig
)
if
target
.
requires_frameworks?
||
vendored_dynamic_artifacts
.
count
>
0
@
xcconfig
xcconfig
end
#---------------------------------------------------------------------#
protected
# @return String the SWIFT_VERSION of the target being integrated
#
def
target_swift_version
target
.
target_definition
.
swift_version
unless
target
.
target_definition
.
swift_version
.
blank?
end
EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION
=
Gem
::
Version
.
new
(
'2.3'
)
# @return [Hash<String, String>] the build settings necessary for Swift
# targets to be correctly embedded in their host.
#
def
embedded_content_settings
# For embedded targets, which live in a host target, CocoaPods
# copies all of the embedded target's pod_targets its host
# target. Therefore, this check will properly require the Swift
# libs in the host target, if the embedded target has any pod targets
# that use Swift. Setting this for the embedded target would
# cause an App Store rejection because frameworks cannot be embedded
# in embedded targets.
swift_version
=
Gem
::
Version
.
new
(
target_swift_version
)
should_embed
=
!
target
.
requires_host_target?
&&
pod_targets
.
any?
(
&
:uses_swift?
)
config
=
{}
if
should_embed
if
swift_version
>=
EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION
config
[
'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'
]
=
'YES'
else
config
[
'EMBEDDED_CONTENT_CONTAINS_SWIFT'
]
=
'YES'
end
end
config
end
# @return [Hash<String, String>] the build settings necessary to import
# the pod targets.
#
...
...
@@ -167,28 +132,61 @@ module Pod
end
end
#---------------------------------------------------------------------#
private
# @return String the SWIFT_VERSION of the target being integrated
#
def
target_swift_version
target
.
target_definition
.
swift_version
unless
target
.
target_definition
.
swift_version
.
blank?
end
EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION
=
Gem
::
Version
.
new
(
'2.3'
)
# @return [Hash<String, String>] the build settings necessary for Swift
# targets to be correctly embedded in their host.
#
def
embedded_content_settings
# For embedded targets, which live in a host target, CocoaPods
# copies all of the embedded target's pod_targets its host
# target. Therefore, this check will properly require the Swift
# libs in the host target, if the embedded target has any pod targets
# that use Swift. Setting this for the embedded target would
# cause an App Store rejection because frameworks cannot be embedded
# in embedded targets.
swift_version
=
Gem
::
Version
.
new
(
target_swift_version
)
should_embed
=
!
target
.
requires_host_target?
&&
pod_targets
.
any?
(
&
:uses_swift?
)
config
=
{}
if
should_embed
if
swift_version
>=
EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION
config
[
'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'
]
=
'YES'
else
config
[
'EMBEDDED_CONTENT_CONTAINS_SWIFT'
]
=
'YES'
end
end
config
end
# Add build settings, which ensure that the pod targets can be imported from the integrating target.
# For >= 1.5.0 we use modular (stricter) header search paths this means that the integrated target will only be
# able to import public headers using `<>` or `@import` notation, but never import any private headers.
#
# For < 1.5.0 legacy header search paths the same rules apply: It's the wild west.
#
def
generate_settings_to_import_pod_targets
@
xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
target
,
pod_targets
)
@
xcconfig
.
merge!
(
settings_to_import_pod_targets
)
def
generate_settings_to_import_pod_targets
(
xcconfig
)
xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
target
,
pod_targets
)
xcconfig
.
merge!
(
settings_to_import_pod_targets
)
target
.
search_paths_aggregate_targets
.
each
do
|
search_paths_target
|
generator
=
AggregateXCConfig
.
new
(
search_paths_target
,
configuration_name
)
@
xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
nil
,
search_paths_target
.
pod_targets
)
@
xcconfig
.
merge!
(
generator
.
settings_to_import_pod_targets
)
xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
nil
,
search_paths_target
.
pod_targets
)
xcconfig
.
merge!
(
generator
.
settings_to_import_pod_targets
)
# Propagate any HEADER_SEARCH_PATHS settings from the search paths.
XCConfigHelper
.
propagate_header_search_paths_from_search_paths
(
search_paths_target
,
@
xcconfig
)
XCConfigHelper
.
propagate_header_search_paths_from_search_paths
(
search_paths_target
,
xcconfig
)
end
end
private
#---------------------------------------------------------------------#
# !@group Private Helpers
...
...
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
View file @
cf14392d
...
...
@@ -12,9 +12,10 @@ module Pod
#
attr_reader
:target
# @return [
Xcodeproj::Config] The generated xcconfig
.
# @return [
Boolean] whether this xcconfig is for a test target
.
#
attr_reader
:xcconfig
attr_reader
:test_xcconfig
alias
test_xcconfig?
test_xcconfig
# Initialize a new instance
#
...
...
@@ -31,12 +32,14 @@ module Pod
# Generates and saves the xcconfig to the given path.
#
# @param [Pathname] path
# the path where the
prefix header
should be stored.
# the path where the
xcconfig
should be stored.
#
# @return [
void
]
# @return [
Xcodeproj::Config
]
#
def
save_as
(
path
)
generate
.
save_as
(
path
)
result
=
generate
result
.
save_as
(
path
)
result
end
# Generates the xcconfig.
...
...
@@ -47,10 +50,10 @@ module Pod
config
=
{
'FRAMEWORK_SEARCH_PATHS'
=>
'$(inherited) '
,
'GCC_PREPROCESSOR_DEFINITIONS'
=>
'$(inherited) COCOAPODS=1'
,
'HEADER_SEARCH_PATHS'
=>
'$(inherited) '
+
XCConfigHelper
.
quote
(
target
.
header_search_paths
(
@test_xcconfig
)),
'HEADER_SEARCH_PATHS'
=>
'$(inherited) '
+
XCConfigHelper
.
quote
(
target
.
header_search_paths
(
test_xcconfig?
)),
'LIBRARY_SEARCH_PATHS'
=>
'$(inherited) '
,
'OTHER_CFLAGS'
=>
'$(inherited) '
,
'OTHER_LDFLAGS'
=>
XCConfigHelper
.
default_ld_flags
(
target
,
@test_xcconfig
),
'OTHER_LDFLAGS'
=>
XCConfigHelper
.
default_ld_flags
(
target
,
test_xcconfig?
),
'OTHER_SWIFT_FLAGS'
=>
'$(inherited) '
,
'PODS_ROOT'
=>
'${SRCROOT}'
,
'PODS_TARGET_SRCROOT'
=>
target
.
pod_target_srcroot
,
...
...
@@ -60,24 +63,24 @@ module Pod
'SWIFT_INCLUDE_PATHS'
=>
'$(inherited) '
,
}
@
xcconfig
=
Xcodeproj
::
Config
.
new
(
config
)
xcconfig
=
Xcodeproj
::
Config
.
new
(
config
)
XCConfigHelper
.
add_settings_for_file_accessors_of_target
(
nil
,
target
,
@xcconfig
,
true
,
@test_xcconfig
)
XCConfigHelper
.
add_settings_for_file_accessors_of_target
(
nil
,
target
,
xcconfig
,
true
,
test_xcconfig?
)
target
.
file_accessors
.
each
do
|
file_accessor
|
@xcconfig
.
merge!
(
file_accessor
.
spec_consumer
.
pod_target_xcconfig
)
if
@test_xcconfig
==
file_accessor
.
spec
.
test_specification?
xcconfig
.
merge!
(
file_accessor
.
spec_consumer
.
pod_target_xcconfig
)
if
test_xcconfig?
==
file_accessor
.
spec
.
test_specification?
end
XCConfigHelper
.
add_target_specific_settings
(
target
,
@
xcconfig
)
XCConfigHelper
.
add_target_specific_settings
(
target
,
xcconfig
)
recursive_dependent_targets
=
target
.
recursive_dependent_targets
@xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
target
,
recursive_dependent_targets
,
@test_xcconfig
)
XCConfigHelper
.
generate_vendored_build_settings
(
target
,
recursive_dependent_targets
,
@xcconfig
,
false
,
@test_xcconfig
)
if
target
.
requires_frameworks?
if
@test_xcconfig
xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
target
,
recursive_dependent_targets
,
test_xcconfig?
)
XCConfigHelper
.
generate_vendored_build_settings
(
target
,
recursive_dependent_targets
,
xcconfig
,
false
,
test_xcconfig?
)
if
target
.
requires_frameworks?
if
test_xcconfig?
test_dependent_targets
=
[
target
,
*
target
.
recursive_test_dependent_targets
].
uniq
@xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
target
,
test_dependent_targets
-
recursive_dependent_targets
,
@test_xcconfig
)
XCConfigHelper
.
generate_vendored_build_settings
(
nil
,
target
.
all_dependent_targets
,
@xcconfig
,
true
,
@test_xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
nil
,
target
.
all_dependent_targets
,
@
xcconfig
)
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
false
,
true
,
@
xcconfig
)
xcconfig
.
merge!
XCConfigHelper
.
search_paths_for_dependent_targets
(
target
,
test_dependent_targets
-
recursive_dependent_targets
,
test_xcconfig?
)
XCConfigHelper
.
generate_vendored_build_settings
(
nil
,
target
.
all_dependent_targets
,
xcconfig
,
true
,
test_xcconfig?
)
XCConfigHelper
.
generate_other_ld_flags
(
nil
,
target
.
all_dependent_targets
,
xcconfig
)
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
false
,
true
,
xcconfig
)
end
@
xcconfig
xcconfig
end
#-----------------------------------------------------------------------#
...
...
lib/cocoapods/installer/analyzer.rb
View file @
cf14392d
...
...
@@ -685,11 +685,10 @@ module Pod
def
fetch_external_source
(
dependency
,
use_lockfile_options
)
checkout_options
=
lockfile
.
checkout_options_for_pod_named
(
dependency
.
root_name
)
if
lockfile
source
=
if
checkout_options
&&
use_lockfile_options
ExternalSources
.
from_params
(
checkout_options
,
dependency
,
podfile
.
defined_in_file
)
ExternalSources
.
from_params
(
checkout_options
,
dependency
,
podfile
.
defined_in_file
,
installation_options
.
clean?
)
else
ExternalSources
.
from_dependency
(
dependency
,
podfile
.
defined_in_file
)
ExternalSources
.
from_dependency
(
dependency
,
podfile
.
defined_in_file
,
installation_options
.
clean?
)
end
source
.
can_cache
=
installation_options
.
clean?
source
.
fetch
(
sandbox
)
end
...
...
lib/cocoapods/installer/analyzer/target_inspection_result.rb
View file @
cf14392d
...
...
@@ -5,40 +5,48 @@ module Pod
# @return [TargetDefinition] the target definition, whose project was
# inspected
#
attr_
accesso
r
:target_definition
attr_
reade
r
:target_definition
# @return [Pathname] the path of the user project that the
# #target_definition should integrate
# @return [Xcodeproj::Project] the user's Xcode project
#
attr_
accessor
:project_path
attr_
reader
:project
# @return [Array<String>] the uuid of the user's targets
#
attr_
accesso
r
:project_target_uuids
attr_
reade
r
:project_target_uuids
# @return [Hash{String=>Symbol}] A hash representing the user build
# configurations where each key corresponds to the name of a
# configuration and its value to its type (`:debug` or
# `:release`).
#
attr_
accesso
r
:build_configurations
attr_
reade
r
:build_configurations
# @return [Platform] the platform of the user targets
#
attr_
accesso
r
:platform
attr_
reade
r
:platform
# @return [Array<String>] the architectures used by user's targets
#
attr_accessor
:archs
# @return [Bool] whether frameworks are recommended for the integration
# due to the presence of Swift source in the user's targets
#
attr_accessor
:recommends_frameworks
attr_reader
:archs
# @return [Xcodeproj::Project] the user's Xcode project
#
attr_accessor
:project
# Initialize a new instance
#
# @param [TargetDefinition] target_definition @see #target_definition
# @param [Xcodeproj::Project] project @see #project
# @param [Array<String>] project_target_uuids @see #project_target_uuids
# @param [Hash{String=>Symbol}] build_configurations @see #build_configurations
# @param [Platform] platform @see #platform
# @param [Array<String>] archs @see #archs
#
def
initialize
(
target_definition
,
project
,
project_target_uuids
,
build_configurations
,
platform
,
archs
)
@target_definition
=
target_definition
@project
=
project
@project_target_uuids
=
project_target_uuids
@build_configurations
=
build_configurations
@platform
=
platform
@archs
=
archs
end
end
end
end
...
...
lib/cocoapods/installer/analyzer/target_inspector.rb
View file @
cf14392d
...
...
@@ -32,22 +32,21 @@ module Pod
#
# @raise If no `user_project` is set
#
# @return [TargetInspectionResult]
# @return [TargetInspectionResult]
the result of the inspection of the target definition within the user project
#
def
compute_results
(
user_project
)
raise
ArgumentError
,
'Cannot compute results without a user project set'
unless
user_project
targets
=
compute_targets
(
user_project
)
result
=
TargetInspectionResult
.
new
result
.
target_definition
=
target_definition
result
.
project_path
=
user_project
.
path
result
.
project_target_uuids
=
targets
.
map
(
&
:uuid
)
result
.
build_configurations
=
compute_build_configurations
(
targets
)
result
.
platform
=
compute_platform
(
targets
)
result
.
archs
=
compute_archs
(
targets
)
result
.
project
=
user_project
result
.
target_definition
.
swift_version
=
compute_swift_version_from_targets
(
targets
)
project_target_uuids
=
targets
.
map
(
&
:uuid
)
build_configurations
=
compute_build_configurations
(
targets
)
platform
=
compute_platform
(
targets
)
archs
=
compute_archs
(
targets
)
swift_version
=
compute_swift_version_from_targets
(
targets
)
result
=
TargetInspectionResult
.
new
(
target_definition
,
user_project
,
project_target_uuids
,
build_configurations
,
platform
,
archs
)
result
.
target_definition
.
swift_version
=
swift_version
result
end
...
...
lib/cocoapods/installer/xcode/pods_project_generator.rb
View file @
cf14392d
...
...
@@ -171,8 +171,7 @@ module Pod
end
.
compact
.
group_by
(
&
:dirname
)
pod_targets
.
sort_by
(
&
:name
).
each
do
|
pod_target
|
target_installer
=
PodTargetInstaller
.
new
(
sandbox
,
pod_target
)
target_installer
.
umbrella_headers_by_dir
=
umbrella_headers_by_dir
target_installer
=
PodTargetInstaller
.
new
(
sandbox
,
pod_target
,
umbrella_headers_by_dir
)
target_installer
.
install!
end
...
...
lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb
View file @
cf14392d
...
...
@@ -93,8 +93,8 @@ module Pod
native_target
.
build_configurations
.
each
do
|
configuration
|
path
=
target
.
xcconfig_path
(
configuration
.
name
)
gen
=
Generator
::
XCConfig
::
AggregateXCConfig
.
new
(
target
,
configuration
.
name
)
update_changed_file
(
gen
,
path
)
target
.
xcconfigs
[
configuration
.
name
]
=
gen
.
xcconfig
xcconfig
=
update_changed_file
(
gen
,
path
)
target
.
xcconfigs
[
configuration
.
name
]
=
xcconfig
xcconfig_file_ref
=
add_file_to_support_group
(
path
)
configuration
.
base_configuration_reference
=
xcconfig_file_ref
end
...
...
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb
View file @
cf14392d
...
...
@@ -6,6 +6,22 @@ module Pod
# relative support files.
#
class
PodTargetInstaller
<
TargetInstaller
# @return [Hash{Pathname => Pathname}] A hash of all umbrella headers, grouped by the directory
# the are stored in. This can be `nil` if there is no grouping.
#
attr_reader
:umbrella_headers_by_dir
# Initialize a new instance
#
# @param [Sandbox] sandbox @see TargetInstaller#sandbox
# @param [Target] target @see TargetInstaller#target
# @param [Hash{Pathname => Pathname}] umbrella_headers_by_dir @see #umbrella_headers_by_dir
#
def
initialize
(
sandbox
,
target
,
umbrella_headers_by_dir
=
nil
)
super
(
sandbox
,
target
)
@umbrella_headers_by_dir
=
umbrella_headers_by_dir
end
# Creates the target in the Pods project and the relative support files.
#
# @return [void]
...
...
@@ -70,11 +86,6 @@ module Pod
end
end
# @return [Hash<Pathname,Pathname>] A hash of all umbrella headers, grouped by the directory
# the are stored in
#
attr_accessor
:umbrella_headers_by_dir
private
# @param [Array<Specification>] specs
...
...
lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb
View file @
cf14392d
...
...
@@ -99,19 +99,20 @@ module Pod
#
# Saves the content the provided path unless the path exists and the contents are exactly the same.
#
# @return [
Void]
# @return [
Object] the result of the generator.
#
def
update_changed_file
(
generator
,
path
)
path
.
dirname
.
mkpath
if
path
.
exist?
generator
.
save_as
(
support_files_temp_dir
)
result
=
generator
.
save_as
(
support_files_temp_dir
)
unless
FileUtils
.
identical?
(
support_files_temp_dir
,
path
)
FileUtils
.
mv
(
support_files_temp_dir
,
path
)
end
else
generator
.
save_as
(
path
)
result
=
generator
.
save_as
(
path
)
end
clean_support_files_temp_dir
if
support_files_temp_dir
.
exist?
result
end
# Creates the directory where to store the support files of the target.
...
...
lib/cocoapods/sandbox/path_list.rb
View file @
cf14392d
...
...
@@ -16,11 +16,11 @@ module Pod
# @return [Pathname] The root of the list whose files and directories
# are used to perform the matching operations.
#
attr_
accesso
r
:root
attr_
reade
r
:root
# Initialize a new instance
#
# @param [Pathname] root
The root of the PathList.
# @param [Pathname] root
@see #root
#
def
initialize
(
root
)
root_dir
=
ActiveSupport
::
Multibyte
::
Unicode
.
normalize
(
root
.
to_s
)
...
...
spec/unit/external_sources/abstract_external_source_spec.rb
View file @
cf14392d
...
...
@@ -4,7 +4,7 @@ module Pod
describe
ExternalSources
::
AbstractExternalSource
do
before
do
dependency
=
Dependency
.
new
(
'Reachability'
,
:git
=>
fixture
(
'integration/Reachability'
))
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
nil
)
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
nil
,
true
)
config
.
sandbox
.
prepare
end
...
...
spec/unit/external_sources/downloader_source_spec.rb
View file @
cf14392d
...
...
@@ -8,7 +8,7 @@ module Pod
:branch
=>
'master'
,
}
dep
=
Dependency
.
new
(
'Reachability'
,
params
)
@subject
=
ExternalSources
.
from_dependency
(
dep
,
nil
)
@subject
=
ExternalSources
.
from_dependency
(
dep
,
nil
,
true
)
end
it
'creates a copy of the podspec'
do
...
...
spec/unit/external_sources/path_source_spec.rb
View file @
cf14392d
...
...
@@ -6,7 +6,7 @@ module Pod
params
=
{
:path
=>
fixture
(
'integration/Reachability'
)
}
dependency
=
Dependency
.
new
(
'Reachability'
,
params
)
podfile_path
=
fixture
(
'integration/Podfile'
)
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
,
true
)
end
it
'creates a copy of the podspec'
do
...
...
spec/unit/external_sources/podspec_source_spec.rb
View file @
cf14392d
...
...
@@ -7,7 +7,7 @@ module Pod
podspec_path
=
fixture
(
'integration/Reachability/Reachability.podspec'
)
dependency
=
Dependency
.
new
(
'Reachability'
,
:podspec
=>
podspec_path
.
to_s
)
podfile_path
=
fixture
(
'integration/Podfile'
)
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
,
true
)
end
it
'creates a copy of the podspec'
do
...
...
spec/unit/external_sources_spec.rb
View file @
cf14392d
...
...
@@ -9,20 +9,20 @@ module Pod
describe
'from_dependency'
do
it
'supports a podspec source'
do
dep
=
Dependency
.
new
(
'Reachability'
,
:podspec
=>
''
)
klass
=
@subject
.
from_dependency
(
dep
,
nil
).
class
klass
=
@subject
.
from_dependency
(
dep
,
nil
,
true
).
class
klass
.
should
==
@subject
::
PodspecSource
end
it
'supports a path source'
do
dep
=
Dependency
.
new
(
'Reachability'
,
:path
=>
''
)
klass
=
@subject
.
from_dependency
(
dep
,
nil
).
class
klass
=
@subject
.
from_dependency
(
dep
,
nil
,
true
).
class
klass
.
should
==
@subject
::
PathSource
end
it
'supports all the strategies implemented by the downloader'
do
[
:git
,
:svn
,
:hg
,
:bzr
,
:http
].
each
do
|
strategy
|
dep
=
Dependency
.
new
(
'Reachability'
,
strategy
=>
''
)
klass
=
@subject
.
from_dependency
(
dep
,
nil
).
class
klass
=
@subject
.
from_dependency
(
dep
,
nil
,
true
).
class
klass
.
should
==
@subject
::
DownloaderSource
end
end
...
...
spec/unit/installer/analyzer/target_inspector_spec.rb
View file @
cf14392d
...
...
@@ -12,7 +12,7 @@ module Pod
target_definition
.
user_project_path
=
'SampleProject/SampleProject'
target_inspector
=
TargetInspector
.
new
(
target_definition
,
config
.
installation_root
)
path
=
target_inspector
.
send
(
:compute_project_path
)
path
=
target_inspector
.
compute_project_path
path
.
to_s
.
should
.
include
'SampleProject/SampleProject.xcodeproj'
end
...
...
@@ -21,7 +21,7 @@ module Pod
target_definition
.
user_project_path
=
'Test'
target_inspector
=
TargetInspector
.
new
(
target_definition
,
config
.
installation_root
)
e
=
lambda
{
target_inspector
.
send
(
:compute_project_path
)
}.
should
.
raise
Informative
e
=
lambda
{
target_inspector
.
compute_project_path
}.
should
.
raise
Informative
e
.
message
.
should
.
match
/Unable to find/
end
...
...
@@ -30,7 +30,7 @@ module Pod
config
.
installation_root
=
config
.
installation_root
+
'SampleProject'
target_inspector
=
TargetInspector
.
new
(
target_definition
,
config
.
installation_root
)
path
=
target_inspector
.
send
(
:compute_project_path
)
path
=
target_inspector
.
compute_project_path
path
.
to_s
.
should
.
include
'SampleProject/SampleProject.xcodeproj'
end
...
...
@@ -38,7 +38,7 @@ module Pod
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
target_inspector
=
TargetInspector
.
new
(
target_definition
,
config
.
installation_root
)
e
=
lambda
{
target_inspector
.
send
(
:compute_project_path
)
}.
should
.
raise
Informative
e
=
lambda
{
target_inspector
.
compute_project_path
}.
should
.
raise
Informative
e
.
message
.
should
.
match
/Could not.*select.*project/
end
...
...
@@ -49,7 +49,7 @@ module Pod
config
.
installation_root
=
config
.
installation_root
+
'Project[With]Special{chars}in*path?'
target_inspector
=
TargetInspector
.
new
(
target_definition
,
config
.
installation_root
)
path
=
target_inspector
.
send
(
:compute_project_path
)
path
=
target_inspector
.
compute_project_path
path
.
to_s
.
should
.
include
'Project[With]Special{chars}in*path?/Project[With]Special{chars}in*path?.xcodeproj'
end
end
...
...
spec/unit/installer/analyzer_spec.rb
View file @
cf14392d
...
...
@@ -1061,10 +1061,9 @@ module Pod
@sandbox_manifest
.
send
(
:checkout_options_data
).
delete
(
'BananaLib'
)
downloader
=
stub
(
'DownloaderSource'
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@lockfile_checkout_options
,
@dependency
,
@podfile
.
defined_in_file
).
returns
(
downloader
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@lockfile_checkout_options
,
@dependency
,
@podfile
.
defined_in_file
,
true
).
returns
(
downloader
)
downloader
.
expects
(
:fetch
)
downloader
.
expects
(
:can_cache
=
).
with
(
true
).
once
@analyzer
.
send
(
:fetch_external_sources
)
end
...
...
@@ -1073,10 +1072,9 @@ module Pod
@sandbox_manifest
.
send
(
:checkout_options_data
)[
'BananaLib'
]
=
@lockfile_checkout_options
.
merge
(
:commit
=>
'other commit'
)
downloader
=
stub
(
'DownloaderSource'
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@lockfile_checkout_options
,
@dependency
,
@podfile
.
defined_in_file
).
returns
(
downloader
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@lockfile_checkout_options
,
@dependency
,
@podfile
.
defined_in_file
,
true
).
returns
(
downloader
)
downloader
.
expects
(
:fetch
)
downloader
.
expects
(
:can_cache
=
).
with
(
true
).
once
@analyzer
.
send
(
:fetch_external_sources
)
end
...
...
@@ -1084,10 +1082,9 @@ module Pod
@analyzer
.
result
.
podfile_state
.
changed
<<
'BananaLib'
downloader
=
stub
(
'DownloaderSource'
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@dependency
.
external_source
,
@dependency
,
@podfile
.
defined_in_file
).
returns
(
downloader
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@dependency
.
external_source
,
@dependency
,
@podfile
.
defined_in_file
,
true
).
returns
(
downloader
)
downloader
.
expects
(
:fetch
)
downloader
.
expects
(
:can_cache
=
).
with
(
true
).
once
@analyzer
.
send
(
:fetch_external_sources
)
end
...
...
@@ -1096,10 +1093,9 @@ module Pod
@analyzer
.
stubs
(
:update
).
returns
(
:pods
=>
%w(BananaLib)
)
downloader
=
stub
(
'DownloaderSource'
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@dependency
.
external_source
,
@dependency
,
@podfile
.
defined_in_file
).
returns
(
downloader
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@dependency
.
external_source
,
@dependency
,
@podfile
.
defined_in_file
,
true
).
returns
(
downloader
)
downloader
.
expects
(
:fetch
)
downloader
.
expects
(
:can_cache
=
).
with
(
true
).
once
@analyzer
.
send
(
:fetch_external_sources
)
end
...
...
@@ -1108,10 +1104,9 @@ module Pod
@analyzer
.
stubs
(
:update
).
returns
(
true
)
downloader
=
stub
(
'DownloaderSource'
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@dependency
.
external_source
,
@dependency
,
@podfile
.
defined_in_file
).
returns
(
downloader
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@dependency
.
external_source
,
@dependency
,
@podfile
.
defined_in_file
,
true
).
returns
(
downloader
)
downloader
.
expects
(
:fetch
)
downloader
.
expects
(
:can_cache
=
).
with
(
true
).
once
@analyzer
.
send
(
:fetch_external_sources
)
end
...
...
@@ -1120,10 +1115,9 @@ module Pod
@sandbox_manifest
.
send
(
:checkout_options_data
).
delete
(
'BananaLib'
)
downloader
=
stub
(
'DownloaderSource'
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@lockfile_checkout_options
,
@dependency
,
@podfile
.
defined_in_file
).
returns
(
downloader
)
ExternalSources
.
stubs
(
:from_params
).
with
(
@lockfile_checkout_options
,
@dependency
,
@podfile
.
defined_in_file
,
false
).
returns
(
downloader
)
downloader
.
expects
(
:fetch
)
downloader
.
expects
(
:can_cache
=
).
with
(
false
).
once
@analyzer
.
installation_options
.
clean
=
false
@analyzer
.
send
(
:fetch_external_sources
)
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