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
7523cb84
Commit
7523cb84
authored
Jul 24, 2015
by
Boris Bügling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert #3878
parent
d19dd87b
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
28 additions
and
121 deletions
+28
-121
CHANGELOG.md
CHANGELOG.md
+0
-4
module_map.rb
lib/cocoapods/generator/module_map.rb
+1
-2
pod_target_installer.rb
...oapods/installer/target_installer/pod_target_installer.rb
+1
-30
headers_store.rb
lib/cocoapods/sandbox/headers_store.rb
+3
-25
validator.rb
lib/cocoapods/validator.rb
+17
-24
push_spec.rb
spec/functional/command/repo/push_spec.rb
+2
-5
module_map_spec.rb
spec/unit/generator/module_map_spec.rb
+1
-17
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+0
-2
validator_spec.rb
spec/unit/validator_spec.rb
+3
-12
No files found.
CHANGELOG.md
View file @
7523cb84
...
@@ -22,10 +22,6 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -22,10 +22,6 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
frameworks.
frameworks.
[
Marius Rackwitz
](
https://github.com/mrackwitz
)
[
Marius Rackwitz
](
https://github.com/mrackwitz
)
*
Pods integrated as static libraries can now be imported as modules.
[
Tomas Linhart
](
https://github.com/TomasLinhart
)
[
#3874
](
https://github.com/CocoaPods/CocoaPods/issues/3874
)
##### Bug Fixes
##### Bug Fixes
*
Ensure the aggregate
`.xcconfig`
file only has the settings for the
*
Ensure the aggregate
`.xcconfig`
file only has the settings for the
...
...
lib/cocoapods/generator/module_map.rb
View file @
7523cb84
...
@@ -42,9 +42,8 @@ module Pod
...
@@ -42,9 +42,8 @@ module Pod
# @return [String]
# @return [String]
#
#
def
generate
def
generate
module_declaration_qualifier
=
target
.
requires_frameworks?
?
'framework '
:
''
result
=
<<-
eos
.
strip_heredoc
result
=
<<-
eos
.
strip_heredoc
#{
module_declaration_qualifier
}
module
#{
target
.
product_module_name
}
{
framework
module
#{
target
.
product_module_name
}
{
umbrella header "
#{
target
.
umbrella_header_path
.
basename
}
"
umbrella header "
#{
target
.
umbrella_header_path
.
basename
}
"
export *
export *
...
...
lib/cocoapods/installer/target_installer/pod_target_installer.rb
View file @
7523cb84
...
@@ -22,15 +22,13 @@ module Pod
...
@@ -22,15 +22,13 @@ module Pod
create_xcconfig_file
create_xcconfig_file
if
target
.
requires_frameworks?
if
target
.
requires_frameworks?
create_info_plist_file
create_info_plist_file
end
create_module_map
do
|
generator
|
create_module_map
do
|
generator
|
generator
.
private_headers
+=
target
.
file_accessors
.
flat_map
(
&
:private_headers
).
map
(
&
:basename
)
generator
.
private_headers
+=
target
.
file_accessors
.
flat_map
(
&
:private_headers
).
map
(
&
:basename
)
end
end
create_umbrella_header
do
|
generator
|
create_umbrella_header
do
|
generator
|
generator
.
imports
+=
target
.
file_accessors
.
flat_map
(
&
:public_headers
).
map
(
&
:basename
)
generator
.
imports
+=
target
.
file_accessors
.
flat_map
(
&
:public_headers
).
map
(
&
:basename
)
end
end
link_module_map
end
link_umbrella_header
create_prefix_header
create_prefix_header
create_dummy_source
create_dummy_source
end
end
...
@@ -185,27 +183,6 @@ module Pod
...
@@ -185,27 +183,6 @@ module Pod
end
end
end
end
# Links a module map to Public headers.
#
# @return [void]
#
def
link_module_map
return
if
target
.
requires_frameworks?
&&
target
.
should_build?
sandbox
.
public_headers
.
add_file
(
target
.
name
,
target
.
module_map_path
,
'module.modulemap'
,
target
.
platform
)
end
# Links a an umbrella header to Public headers.
#
# @return [void]
#
def
link_umbrella_header
return
if
custom_module_map
return
if
target
.
requires_frameworks?
&&
target
.
should_build?
sandbox
.
public_headers
.
add_files
(
target
.
name
,
[
target
.
umbrella_header_path
],
target
.
platform
)
end
# Creates a prefix header file which imports `UIKit` or `Cocoa` according
# Creates a prefix header file which imports `UIKit` or `Cocoa` according
# to the platform of the target. This file also include any prefix header
# to the platform of the target. This file also include any prefix header
# content reported by the specification of the pods.
# content reported by the specification of the pods.
...
@@ -303,12 +280,6 @@ module Pod
...
@@ -303,12 +280,6 @@ module Pod
FileUtils
.
cp
(
custom_module_map
,
path
)
FileUtils
.
cp
(
custom_module_map
,
path
)
add_file_to_support_group
(
path
)
add_file_to_support_group
(
path
)
unless
target
.
requires_frameworks?
contents
=
path
.
read
contents
.
gsub!
(
/^\s*framework\s+module/
,
'module'
)
path
.
open
(
'w'
)
{
|
f
|
f
.
write
(
contents
)
}
end
native_target
.
build_configurations
.
each
do
|
c
|
native_target
.
build_configurations
.
each
do
|
c
|
relative_path
=
path
.
relative_path_from
(
sandbox
.
root
)
relative_path
=
path
.
relative_path_from
(
sandbox
.
root
)
c
.
build_settings
[
'MODULEMAP_FILE'
]
=
relative_path
.
to_s
c
.
build_settings
[
'MODULEMAP_FILE'
]
=
relative_path
.
to_s
...
...
lib/cocoapods/sandbox/headers_store.rb
View file @
7523cb84
...
@@ -71,41 +71,19 @@ module Pod
...
@@ -71,41 +71,19 @@ module Pod
# @return [Array<Pathname>]
# @return [Array<Pathname>]
#
#
def
add_files
(
namespace
,
relative_header_paths
,
platform
)
def
add_files
(
namespace
,
relative_header_paths
,
platform
)
relative_header_paths
.
map
do
|
relative_header_path
|
add_file
(
namespace
,
relative_header_path
,
relative_header_path
.
basename
,
platform
)
end
end
# Adds a header to the directory under different name.
#
# @param [Pathname] namespace
# the path where the header file should be stored relative to the
# headers directory.
#
# @param [Pathname] relative_header_path
# the path of the header file relative to the Pods project
# (`PODS_ROOT` variable of the xcconfigs).
#
# @param [String] final_name
# the name under which the file should be available in the
# headers directory.
#
# @note This method adds the file to the search paths.
#
# @return [Pathname]
#
def
add_file
(
namespace
,
relative_header_path
,
final_name
,
platform
)
add_search_path
(
namespace
,
platform
)
add_search_path
(
namespace
,
platform
)
namespaced_path
=
root
+
namespace
namespaced_path
=
root
+
namespace
namespaced_path
.
mkpath
unless
File
.
exist?
(
namespaced_path
)
namespaced_path
.
mkpath
unless
File
.
exist?
(
namespaced_path
)
relative_header_paths
.
map
do
|
relative_header_path
|
absolute_source
=
(
sandbox
.
root
+
relative_header_path
)
absolute_source
=
(
sandbox
.
root
+
relative_header_path
)
source
=
absolute_source
.
relative_path_from
(
namespaced_path
)
source
=
absolute_source
.
relative_path_from
(
namespaced_path
)
Dir
.
chdir
(
namespaced_path
)
do
Dir
.
chdir
(
namespaced_path
)
do
FileUtils
.
ln_sf
(
source
,
final_
name
)
FileUtils
.
ln_sf
(
source
,
relative_header_path
.
base
name
)
end
end
namespaced_path
+
relative_header_path
.
basename
namespaced_path
+
relative_header_path
.
basename
end
end
end
# Adds an header search path to the sandbox.
# Adds an header search path to the sandbox.
#
#
...
...
lib/cocoapods/validator.rb
View file @
7523cb84
...
@@ -244,19 +244,15 @@ module Pod
...
@@ -244,19 +244,15 @@ module Pod
UI
.
message
"
\n\n
#{
spec
}
- Analyzing on
#{
platform
}
platform."
.
green
.
reversed
UI
.
message
"
\n\n
#{
spec
}
- Analyzing on
#{
platform
}
platform."
.
green
.
reversed
@consumer
=
spec
.
consumer
(
platform
)
@consumer
=
spec
.
consumer
(
platform
)
setup_validation_environment
setup_validation_environment
download_pod
check_file_patterns
install_pod
install_pod
validate_vendored_dynamic_frameworks
validate_vendored_dynamic_frameworks
build_pod
build_pod
check_file_patterns
tear_down_validation_environment
tear_down_validation_environment
validated?
validated?
end
end
return
false
if
fail_fast
&&
!
valid
return
false
if
fail_fast
&&
!
valid
perform_extensive_subspec_analysis
(
spec
)
unless
@no_subspecs
perform_extensive_subspec_analysis
(
spec
)
unless
@no_subspecs
rescue
=>
e
error
(
'unknown'
,
"Encountered an unknown error (
#{
e
}
) during validation."
)
false
end
end
# Recursively perform the extensive analysis on all subspecs
# Recursively perform the extensive analysis on all subspecs
...
@@ -338,33 +334,29 @@ module Pod
...
@@ -338,33 +334,29 @@ module Pod
Config
.
instance
=
@original_config
Config
.
instance
=
@original_config
end
end
def
download_pod
deployment_target
=
spec
.
subspec_by_name
(
subspec_name
).
deployment_target
(
consumer
.
platform_name
)
podfile
=
podfile_from_spec
(
consumer
.
platform_name
,
deployment_target
,
use_frameworks
)
sandbox
=
Sandbox
.
new
(
config
.
sandbox_root
)
@installer
=
Installer
.
new
(
sandbox
,
podfile
)
@installer
.
use_default_plugins
=
false
%i(prepare resolve_dependencies download_dependencies)
.
each
{
|
m
|
@installer
.
send
(
m
)
}
@file_accessor
=
@installer
.
pod_targets
.
flat_map
(
&
:file_accessors
).
find
{
|
fa
|
fa
.
spec
.
name
==
consumer
.
spec
.
name
}
end
# It creates a podfile in memory and builds a library containing the pod
# It creates a podfile in memory and builds a library containing the pod
# for all available platforms with xcodebuild.
# for all available platforms with xcodebuild.
#
#
def
install_pod
def
install_pod
%i(determine_dependency_product_types verify_no_duplicate_framework_names
verify_no_static_framework_transitive_dependencies
verify_framework_usage generate_pods_project
perform_post_install_actions)
.
each
{
|
m
|
@installer
.
send
(
m
)
}
deployment_target
=
spec
.
subspec_by_name
(
subspec_name
).
deployment_target
(
consumer
.
platform_name
)
deployment_target
=
spec
.
subspec_by_name
(
subspec_name
).
deployment_target
(
consumer
.
platform_name
)
@installer
.
aggregate_targets
.
each
do
|
target
|
podfile
=
podfile_from_spec
(
consumer
.
platform_name
,
deployment_target
,
use_frameworks
)
sandbox
=
Sandbox
.
new
(
config
.
sandbox_root
)
installer
=
Installer
.
new
(
sandbox
,
podfile
)
installer
.
use_default_plugins
=
false
installer
.
install!
file_accessors
=
installer
.
aggregate_targets
.
map
do
|
target
|
if
target
.
pod_targets
.
any?
(
&
:uses_swift?
)
&&
consumer
.
platform_name
==
:ios
&&
if
target
.
pod_targets
.
any?
(
&
:uses_swift?
)
&&
consumer
.
platform_name
==
:ios
&&
(
deployment_target
.
nil?
||
Version
.
new
(
deployment_target
).
major
<
8
)
(
deployment_target
.
nil?
||
Version
.
new
(
deployment_target
).
major
<
8
)
uses_xctest
=
target
.
spec_consumers
.
any?
{
|
c
|
(
c
.
frameworks
+
c
.
weak_frameworks
).
include?
'XCTest'
}
uses_xctest
=
target
.
spec_consumers
.
any?
{
|
c
|
(
c
.
frameworks
+
c
.
weak_frameworks
).
include?
'XCTest'
}
error
(
'swift'
,
'Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.'
)
unless
uses_xctest
error
(
'swift'
,
'Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.'
)
unless
uses_xctest
end
end
end
target
.
pod_targets
.
map
(
&
:file_accessors
)
end
.
flatten
@file_accessor
=
file_accessors
.
find
{
|
accessor
|
accessor
.
spec
.
root
.
name
==
spec
.
root
.
name
}
config
.
silent
end
end
def
validate_vendored_dynamic_frameworks
def
validate_vendored_dynamic_frameworks
...
@@ -554,11 +546,11 @@ module Pod
...
@@ -554,11 +546,11 @@ module Pod
# in local mode.
# in local mode.
#
#
def
podfile_from_spec
(
platform_name
,
deployment_target
,
use_frameworks
=
true
)
def
podfile_from_spec
(
platform_name
,
deployment_target
,
use_frameworks
=
true
)
name
=
subspec_name
||
spec
.
name
name
=
subspec_name
?
subspec_name
:
spec
.
name
podspec
=
file
.
realpath
podspec
=
file
.
realpath
local
=
local?
local
=
local?
urls
=
source_urls
urls
=
source_urls
Pod
::
Podfile
.
new
do
podfile
=
Pod
::
Podfile
.
new
do
urls
.
each
{
|
u
|
source
(
u
)
}
urls
.
each
{
|
u
|
source
(
u
)
}
use_frameworks!
(
use_frameworks
)
use_frameworks!
(
use_frameworks
)
platform
(
platform_name
,
deployment_target
)
platform
(
platform_name
,
deployment_target
)
...
@@ -568,6 +560,7 @@ module Pod
...
@@ -568,6 +560,7 @@ module Pod
pod
name
,
:podspec
=>
podspec
.
to_s
pod
name
,
:podspec
=>
podspec
.
to_s
end
end
end
end
podfile
end
end
# Parse the xcode build output to identify the lines which are relevant
# Parse the xcode build output to identify the lines which are relevant
...
...
spec/functional/command/repo/push_spec.rb
View file @
7523cb84
...
@@ -114,12 +114,9 @@ module Pod
...
@@ -114,12 +114,9 @@ module Pod
end
end
before
do
before
do
%i(prepare resolve_dependencies download_dependencies)
.
each
do
|
m
|
Installer
.
any_instance
.
stubs
(
m
)
end
Installer
.
any_instance
.
stubs
(
:aggregate_targets
).
returns
([])
Installer
.
any_instance
.
stubs
(
:aggregate_targets
).
returns
([])
Installer
.
any_instance
.
stubs
(
:
pod_targets
).
returns
([]
)
Installer
.
any_instance
.
stubs
(
:
install!
)
Validator
.
any_instance
.
stubs
(
:install_pod
)
Validator
.
any_instance
.
stubs
(
:check_file_patterns
)
Validator
.
any_instance
.
stubs
(
:check_file_patterns
)
Validator
.
any_instance
.
stubs
(
:validated?
).
returns
(
true
)
Validator
.
any_instance
.
stubs
(
:validated?
).
returns
(
true
)
Validator
.
any_instance
.
stubs
(
:validate_url
)
Validator
.
any_instance
.
stubs
(
:validate_url
)
...
...
spec/unit/generator/module_map_spec.rb
View file @
7523cb84
...
@@ -9,9 +9,8 @@ module Pod
...
@@ -9,9 +9,8 @@ module Pod
@gen
=
Generator
::
ModuleMap
.
new
(
@pod_target
)
@gen
=
Generator
::
ModuleMap
.
new
(
@pod_target
)
end
end
it
'writes the
framework
module map to the disk'
do
it
'writes the module map to the disk'
do
path
=
temporary_directory
+
'BananaLib.modulemap'
path
=
temporary_directory
+
'BananaLib.modulemap'
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@gen
.
save_as
(
path
)
@gen
.
save_as
(
path
)
path
.
read
.
should
==
<<-
EOS
.
strip_heredoc
path
.
read
.
should
==
<<-
EOS
.
strip_heredoc
framework module BananaLib {
framework module BananaLib {
...
@@ -23,23 +22,8 @@ module Pod
...
@@ -23,23 +22,8 @@ module Pod
EOS
EOS
end
end
it
'writes the library module map to the disk'
do
path
=
temporary_directory
+
'BananaLib.modulemap'
@pod_target
.
stubs
(
:requires_frameworks?
=>
false
)
@gen
.
save_as
(
path
)
path
.
read
.
should
==
<<-
EOS
.
strip_heredoc
module BananaLib {
umbrella header "BananaLib-umbrella.h"
export *
module * { export * }
}
EOS
end
it
'correctly adds private headers'
do
it
'correctly adds private headers'
do
@gen
.
stubs
(
:private_headers
).
returns
([
'Private.h'
])
@gen
.
stubs
(
:private_headers
).
returns
([
'Private.h'
])
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@gen
.
generate
.
should
==
<<-
EOS
.
strip_heredoc
@gen
.
generate
.
should
==
<<-
EOS
.
strip_heredoc
framework module BananaLib {
framework module BananaLib {
umbrella header "BananaLib-umbrella.h"
umbrella header "BananaLib-umbrella.h"
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
7523cb84
...
@@ -103,7 +103,6 @@ module Pod
...
@@ -103,7 +103,6 @@ module Pod
'Pods-BananaLib-Private.xcconfig'
,
'Pods-BananaLib-Private.xcconfig'
,
'Pods-BananaLib-dummy.m'
,
'Pods-BananaLib-dummy.m'
,
'Pods-BananaLib-prefix.pch'
,
'Pods-BananaLib-prefix.pch'
,
'Pods-BananaLib.modulemap'
,
'Pods-BananaLib.xcconfig'
,
'Pods-BananaLib.xcconfig'
,
]
]
end
end
...
@@ -146,7 +145,6 @@ module Pod
...
@@ -146,7 +145,6 @@ module Pod
'BananaLib-Private.xcconfig'
,
'BananaLib-Private.xcconfig'
,
'BananaLib-dummy.m'
,
'BananaLib-dummy.m'
,
'BananaLib-prefix.pch'
,
'BananaLib-prefix.pch'
,
'BananaLib.modulemap'
,
'BananaLib.xcconfig'
,
'BananaLib.xcconfig'
,
]
]
end
end
...
...
spec/unit/validator_spec.rb
View file @
7523cb84
...
@@ -99,10 +99,9 @@ module Pod
...
@@ -99,10 +99,9 @@ module Pod
describe
'URL validation'
do
describe
'URL validation'
do
before
do
before
do
@validator
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
.
map
(
&
:url
))
@validator
=
Validator
.
new
(
podspec_path
,
SourcesManager
.
master
.
map
(
&
:url
))
@validator
.
stubs
(
:download_pod
)
@validator
.
stubs
(
:check_file_patterns
)
@validator
.
stubs
(
:install_pod
)
@validator
.
stubs
(
:install_pod
)
@validator
.
stubs
(
:build_pod
)
@validator
.
stubs
(
:build_pod
)
@validator
.
stubs
(
:check_file_patterns
)
@validator
.
stubs
(
:tear_down_validation_environment
)
@validator
.
stubs
(
:tear_down_validation_environment
)
WebMock
::
API
.
stub_request
(
:head
,
/not-found/
).
to_return
(
:status
=>
404
)
WebMock
::
API
.
stub_request
(
:head
,
/not-found/
).
to_return
(
:status
=>
404
)
WebMock
::
API
.
stub_request
(
:get
,
/not-found/
).
to_return
(
:status
=>
404
)
WebMock
::
API
.
stub_request
(
:get
,
/not-found/
).
to_return
(
:status
=>
404
)
...
@@ -301,12 +300,8 @@ module Pod
...
@@ -301,12 +300,8 @@ module Pod
validator
.
stubs
(
:validate_screenshots
)
validator
.
stubs
(
:validate_screenshots
)
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:install_pod
)
Installer
.
any_instance
.
stubs
(
:install!
)
%i(prepare resolve_dependencies download_dependencies)
.
each
do
|
m
|
Installer
.
any_instance
.
stubs
(
m
)
end
Installer
.
any_instance
.
stubs
(
:aggregate_targets
).
returns
([])
Installer
.
any_instance
.
stubs
(
:aggregate_targets
).
returns
([])
Installer
.
any_instance
.
stubs
(
:pod_targets
).
returns
([])
subspec
=
Specification
.
new
(
validator
.
spec
,
'subspec'
)
do
|
s
|
subspec
=
Specification
.
new
(
validator
.
spec
,
'subspec'
)
do
|
s
|
s
.
ios
.
deployment_target
=
'7.0'
s
.
ios
.
deployment_target
=
'7.0'
end
end
...
@@ -513,12 +508,8 @@ module Pod
...
@@ -513,12 +508,8 @@ module Pod
@validator
.
stubs
(
:validate_url
)
@validator
.
stubs
(
:validate_url
)
@validator
.
stubs
(
:validate_screenshots
)
@validator
.
stubs
(
:validate_screenshots
)
@validator
.
stubs
(
:check_file_patterns
)
@validator
.
stubs
(
:check_file_patterns
)
@validator
.
stubs
(
:install_pod
)
Installer
.
any_instance
.
stubs
(
:install!
)
%i(prepare resolve_dependencies download_dependencies)
.
each
do
|
m
|
Installer
.
any_instance
.
stubs
(
m
)
end
Installer
.
any_instance
.
stubs
(
:aggregate_targets
).
returns
([])
Installer
.
any_instance
.
stubs
(
:aggregate_targets
).
returns
([])
Installer
.
any_instance
.
stubs
(
:pod_targets
).
returns
([])
end
end
it
'lints as a framework if specified'
do
it
'lints as a framework if specified'
do
...
...
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