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
7cbc243f
Commit
7cbc243f
authored
Oct 02, 2016
by
Stephen Hayes
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'CocoaPods/master'
parents
88c43965
b6143c3e
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
198 additions
and
87 deletions
+198
-87
CHANGELOG.md
CHANGELOG.md
+26
-2
Gemfile.lock
Gemfile.lock
+3
-3
Rakefile
Rakefile
+2
-1
lint.rb
lib/cocoapods/command/lib/lint.rb
+4
-0
lint.rb
lib/cocoapods/command/spec/lint.rb
+4
-0
copy_resources_script.rb
lib/cocoapods/generator/copy_resources_script.rb
+2
-8
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+35
-1
pod_variant.rb
lib/cocoapods/installer/analyzer/pod_variant.rb
+3
-9
pod_target_installer.rb
...ller/xcode/pods_project_generator/pod_target_installer.rb
+3
-3
headers_store.rb
lib/cocoapods/sandbox/headers_store.rb
+4
-10
validator.rb
lib/cocoapods/validator.rb
+13
-1
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
pod_variant_spec.rb
spec/unit/installer/analyzer/pod_variant_spec.rb
+41
-48
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+35
-0
validator_spec.rb
spec/unit/validator_spec.rb
+22
-0
No files found.
CHANGELOG.md
View file @
7cbc243f
...
@@ -11,8 +11,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -11,8 +11,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
*
Cache result of inhibit_warnings and include_in_build_config to speed up pod install.
*
Cache result of inhibit_warnings and include_in_build_config to speed up pod install.
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#5934
](
https://github.com/CocoaPods/CocoaPods/pull/5934
)
[
#5934
](
https://github.com/CocoaPods/CocoaPods/pull/5934
)
*
Improve performance of PathList.read_file_system
*
Tell users about the .swift-version file on validation failures.
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#5951
](
https://github.com/CocoaPods/CocoaPods/pull/5951
)
*
Improve performance of PathList.read_file_system
[
Heath Borders
](
https://github.com/hborders
)
[
Heath Borders
](
https://github.com/hborders
)
[
#5890
](
https://github.com/CocoaPods/CocoaPods/issues/5890
)
[
#5890
](
https://github.com/CocoaPods/CocoaPods/issues/5890
)
...
@@ -23,6 +27,21 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -23,6 +27,21 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
*
Greenify pod install success message
*
Greenify pod install success message
[
Stephen Hayes
](
https://github.com/schayes04
)
[
Stephen Hayes
](
https://github.com/schayes04
)
[
#5713
](
https://github.com/CocoaPods/CocoaPods/issues/5713
)
[
#5713
](
https://github.com/CocoaPods/CocoaPods/issues/5713
)
*
Remove uses of
`cd`
in generated scripts
[
Ben Asher
](
https://github.com/benasher44
)
[
#5959
](
https://github.com/CocoaPods/CocoaPods/pull/5959
)
*
Error with helpful message when integrating a pod into targets that have mismatched Swift versions.
[
Ben Asher
](
https://github.com/benasher44
)
[
#5984
](
https://github.com/CocoaPods/CocoaPods/pull/5984
)
*
Allow users to share pods between Objective-C and Swift targets.
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#5984
](
https://github.com/CocoaPods/CocoaPods/pull/5984
)
*
Allow setting the linting Swift version via
`--swift-version=VERSION`
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#5989
](
https://github.com/CocoaPods/CocoaPods/pull/5989
)
##### Bug Fixes
##### Bug Fixes
...
@@ -34,6 +53,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -34,6 +53,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Ben Asher
](
https://github.com/benasher44
)
[
Ben Asher
](
https://github.com/benasher44
)
[
#5860
](
https://github.com/CocoaPods/CocoaPods/issues/5860
)
[
#5860
](
https://github.com/CocoaPods/CocoaPods/issues/5860
)
*
Fix linting of private pods when using libraries.
[
Stefan Pühringer
](
https://github.com/b-ray
)
[
#5891
](
https://github.com/CocoaPods/CocoaPods/issues/5891
)
## 1.1.0.rc.2 (2016-09-13)
## 1.1.0.rc.2 (2016-09-13)
##### Enhancements
##### Enhancements
...
...
Gemfile.lock
View file @
7cbc243f
GIT
GIT
remote: https://github.com/CocoaPods/CLAide.git
remote: https://github.com/CocoaPods/CLAide.git
revision:
61071679fc965083b6d43fdc1aa042afbaf172d1
revision:
8106d0d779ae1c9f571404a9f38950905ad5c803
branch: master
branch: master
specs:
specs:
claide (1.0.0)
claide (1.0.0)
GIT
GIT
remote: https://github.com/CocoaPods/Core.git
remote: https://github.com/CocoaPods/Core.git
revision: f
c8c258d0bce73e091f09de260a1a65bed3482a
1
revision: f
ef34047643147b09955f8aeb1277a47d01ff1c
1
branch: master
branch: master
specs:
specs:
cocoapods-core (1.1.0.rc.2)
cocoapods-core (1.1.0.rc.2)
...
@@ -24,7 +24,7 @@ GIT
...
@@ -24,7 +24,7 @@ GIT
GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
remote: https://github.com/CocoaPods/Xcodeproj.git
revision:
c8b7277072c3c2432ac99ef9b45cd1a6d181409e
revision:
4020ac913be863bdc4925fbb132aa94af71850f4
branch: master
branch: master
specs:
specs:
xcodeproj (1.3.1)
xcodeproj (1.3.1)
...
...
Rakefile
View file @
7cbc243f
...
@@ -178,7 +178,8 @@ begin
...
@@ -178,7 +178,8 @@ begin
task
:rebuild
=>
:check_for_pending_changes
do
task
:rebuild
=>
:check_for_pending_changes
do
tarballs
.
each
do
|
tarball
|
tarballs
.
each
do
|
tarball
|
basename
=
File
.
basename
(
tarball
)
basename
=
File
.
basename
(
tarball
)
sh
"cd
#{
File
.
dirname
(
tarball
)
}
&& rm
#{
basename
}
&& env COPYFILE_DISABLE=1 tar -zcf
#{
basename
}
#{
basename
[
0
..-
8
]
}
"
untarred_path
=
File
.
join
(
File
.
dirname
(
tarball
),
basename
[
0
..-
8
])
sh
"rm
#{
tarball
}
&& env COPYFILE_DISABLE=1 tar -zcf
#{
tarball
}
#{
untarred_path
}
"
end
end
end
end
...
...
lib/cocoapods/command/lib/lint.rb
View file @
7cbc243f
...
@@ -21,6 +21,8 @@ module Pod
...
@@ -21,6 +21,8 @@ module Pod
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'Multiple sources must be comma-delimited.'
],
'Multiple sources must be comma-delimited.'
],
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--swift-version=VERSION'
,
'The SWIFT_VERSION that should be used to lint the spec. '
\
'This takes precedence over a .swift-version file.'
],
].
concat
(
super
)
].
concat
(
super
)
end
end
...
@@ -34,6 +36,7 @@ module Pod
...
@@ -34,6 +36,7 @@ module Pod
@use_frameworks
=
!
argv
.
flag?
(
'use-libraries'
)
@use_frameworks
=
!
argv
.
flag?
(
'use-libraries'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@podspecs_paths
=
argv
.
arguments!
@podspecs_paths
=
argv
.
arguments!
super
super
end
end
...
@@ -55,6 +58,7 @@ module Pod
...
@@ -55,6 +58,7 @@ module Pod
validator
.
only_subspec
=
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
.
use_frameworks
=
@use_frameworks
validator
.
use_frameworks
=
@use_frameworks
validator
.
ignore_public_only_results
=
@private
validator
.
ignore_public_only_results
=
@private
validator
.
swift_version
=
@swift_version
validator
.
validate
validator
.
validate
unless
@clean
unless
@clean
...
...
lib/cocoapods/command/spec/lint.rb
View file @
7cbc243f
...
@@ -27,6 +27,8 @@ module Pod
...
@@ -27,6 +27,8 @@ module Pod
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'Multiple sources must be comma-delimited.'
],
'Multiple sources must be comma-delimited.'
],
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--private'
,
'Lint skips checks that apply only to public specs'
],
[
'--swift-version=VERSION'
,
'The SWIFT_VERSION that should be used to lint the spec. '
\
'This takes precedence over a .swift-version file.'
],
].
concat
(
super
)
].
concat
(
super
)
end
end
...
@@ -40,6 +42,7 @@ module Pod
...
@@ -40,6 +42,7 @@ module Pod
@use_frameworks
=
!
argv
.
flag?
(
'use-libraries'
)
@use_frameworks
=
!
argv
.
flag?
(
'use-libraries'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@private
=
argv
.
flag?
(
'private'
,
false
)
@swift_version
=
argv
.
option
(
'swift-version'
,
nil
)
@podspecs_paths
=
argv
.
arguments!
@podspecs_paths
=
argv
.
arguments!
super
super
end
end
...
@@ -57,6 +60,7 @@ module Pod
...
@@ -57,6 +60,7 @@ module Pod
validator
.
only_subspec
=
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
.
use_frameworks
=
@use_frameworks
validator
.
use_frameworks
=
@use_frameworks
validator
.
ignore_public_only_results
=
@private
validator
.
ignore_public_only_results
=
@private
validator
.
swift_version
=
@swift_version
validator
.
validate
validator
.
validate
failure_reasons
<<
validator
.
failure_reason
failure_reasons
<<
validator
.
failure_reason
...
...
lib/cocoapods/generator/copy_resources_script.rb
View file @
7cbc243f
...
@@ -119,12 +119,6 @@ case "${TARGETED_DEVICE_FAMILY}" in
...
@@ -119,12 +119,6 @@ case "${TARGETED_DEVICE_FAMILY}" in
;;
;;
esac
esac
realpath() {
DIRECTORY="$(cd "${1%/*}" && pwd)"
FILENAME="${1##*/}"
echo "$DIRECTORY/$FILENAME"
}
install_resource()
install_resource()
{
{
if [[ "$1" = /* ]] ; then
if [[ "$1" = /* ]] ; then
...
@@ -166,7 +160,7 @@ EOM
...
@@ -166,7 +160,7 @@ EOM
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
;;
;;
*.xcassets)
*.xcassets)
ABSOLUTE_XCASSET_FILE=
$(realpath "$RESOURCE_PATH")
ABSOLUTE_XCASSET_FILE=
"$RESOURCE_PATH"
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
;;
;;
*)
*)
...
@@ -195,7 +189,7 @@ then
...
@@ -195,7 +189,7 @@ then
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
while read line; do
while read line; do
if [[ $line != "
`realpath $PODS_ROOT`
*" ]]; then
if [[ $line != "
${PODS_ROOT}
*" ]]; then
XCASSET_FILES+=("$line")
XCASSET_FILES+=("$line")
fi
fi
done <<<"$OTHER_XCASSETS"
done <<<"$OTHER_XCASSETS"
...
...
lib/cocoapods/installer/analyzer.rb
View file @
7cbc243f
...
@@ -349,6 +349,7 @@ module Pod
...
@@ -349,6 +349,7 @@ module Pod
#
#
def
generate_targets
def
generate_targets
specs_by_target
=
result
.
specs_by_target
.
reject
{
|
td
,
_
|
td
.
abstract?
}
specs_by_target
=
result
.
specs_by_target
.
reject
{
|
td
,
_
|
td
.
abstract?
}
check_pod_target_swift_versions
(
specs_by_target
)
pod_targets
=
generate_pod_targets
(
specs_by_target
)
pod_targets
=
generate_pod_targets
(
specs_by_target
)
aggregate_targets
=
specs_by_target
.
keys
.
map
do
|
target_definition
|
aggregate_targets
=
specs_by_target
.
keys
.
map
do
|
target_definition
|
generate_target
(
target_definition
,
pod_targets
)
generate_target
(
target_definition
,
pod_targets
)
...
@@ -406,6 +407,39 @@ module Pod
...
@@ -406,6 +407,39 @@ module Pod
target
target
end
end
# Verify that targets using a pod have the same swift version
#
# @param [Hash{Podfile::TargetDefinition => Array<Specification>}] specs_by_target
# the resolved specifications grouped by target.
#
# @note raises Informative if targets using a pod do not have
# the same swift version
#
def
check_pod_target_swift_versions
(
specs_by_target
)
targets_by_spec
=
{}
specs_by_target
.
each
do
|
target
,
specs
|
specs
.
each
do
|
spec
|
(
targets_by_spec
[
spec
]
||=
[])
<<
target
end
end
error_message_for_target
=
lambda
do
|
target
|
"
#{
target
.
name
}
(Swift
#{
target
.
swift_version
}
)"
end
error_messages
=
targets_by_spec
.
map
do
|
spec
,
targets
|
swift_targets
=
targets
.
reject
{
|
target
|
target
.
swift_version
.
blank?
}
next
if
swift_targets
.
empty?
||
swift_targets
.
uniq
(
&
:swift_version
).
count
==
1
target_errors
=
swift_targets
.
map
(
&
error_message_for_target
).
join
(
', '
)
"-
#{
spec
.
name
}
required by
#{
target_errors
}
"
end
.
compact
unless
error_messages
.
empty?
raise
Informative
,
'The following pods are integrated into targets '
\
"that do not have the same Swift version:
\n\n
#{
error_messages
.
join
(
"
\n
"
)
}
"
end
end
# Setup the pod targets for an aggregate target. Deduplicates resulting
# Setup the pod targets for an aggregate target. Deduplicates resulting
# targets by grouping by platform and subspec by their root
# targets by grouping by platform and subspec by their root
# to create a {PodTarget} for each spec.
# to create a {PodTarget} for each spec.
...
@@ -420,7 +454,7 @@ module Pod
...
@@ -420,7 +454,7 @@ module Pod
distinct_targets
=
specs_by_target
.
each_with_object
({})
do
|
dependency
,
hash
|
distinct_targets
=
specs_by_target
.
each_with_object
({})
do
|
dependency
,
hash
|
target_definition
,
dependent_specs
=
*
dependency
target_definition
,
dependent_specs
=
*
dependency
dependent_specs
.
group_by
(
&
:root
).
each
do
|
root_spec
,
specs
|
dependent_specs
.
group_by
(
&
:root
).
each
do
|
root_spec
,
specs
|
pod_variant
=
PodVariant
.
new
(
specs
,
target_definition
.
platform
,
target_definition
.
uses_frameworks?
,
target_definition
.
swift_version
)
pod_variant
=
PodVariant
.
new
(
specs
,
target_definition
.
platform
,
target_definition
.
uses_frameworks?
)
hash
[
root_spec
]
||=
{}
hash
[
root_spec
]
||=
{}
(
hash
[
root_spec
][
pod_variant
]
||=
[])
<<
target_definition
(
hash
[
root_spec
][
pod_variant
]
||=
[])
<<
target_definition
end
end
...
...
lib/cocoapods/installer/analyzer/pod_variant.rb
View file @
7cbc243f
...
@@ -16,10 +16,6 @@ module Pod
...
@@ -16,10 +16,6 @@ module Pod
attr_accessor
:requires_frameworks
attr_accessor
:requires_frameworks
alias_method
:requires_frameworks?
,
:requires_frameworks
alias_method
:requires_frameworks?
,
:requires_frameworks
# @return [String] the Swift version
#
attr_accessor
:swift_version
# @return [Specification] the root specification
# @return [Specification] the root specification
#
#
def
root_spec
def
root_spec
...
@@ -32,11 +28,10 @@ module Pod
...
@@ -32,11 +28,10 @@ module Pod
# @param [Platform] platform @see #platform
# @param [Platform] platform @see #platform
# @param [Bool] requires_frameworks @see #requires_frameworks?
# @param [Bool] requires_frameworks @see #requires_frameworks?
#
#
def
initialize
(
specs
,
platform
,
requires_frameworks
=
false
,
swift_version
=
nil
)
def
initialize
(
specs
,
platform
,
requires_frameworks
=
false
)
self
.
specs
=
specs
self
.
specs
=
specs
self
.
platform
=
platform
self
.
platform
=
platform
self
.
requires_frameworks
=
requires_frameworks
self
.
requires_frameworks
=
requires_frameworks
self
.
swift_version
=
swift_version
end
end
# @return [Bool] whether the {PodVariant} is equal to another taking all
# @return [Bool] whether the {PodVariant} is equal to another taking all
...
@@ -46,8 +41,7 @@ module Pod
...
@@ -46,8 +41,7 @@ module Pod
self
.
class
==
other
.
class
&&
self
.
class
==
other
.
class
&&
specs
==
other
.
specs
&&
specs
==
other
.
specs
&&
platform
==
other
.
platform
&&
platform
==
other
.
platform
&&
requires_frameworks
==
other
.
requires_frameworks
&&
requires_frameworks
==
other
.
requires_frameworks
swift_version
==
other
.
swift_version
end
end
alias_method
:eql?
,
:==
alias_method
:eql?
,
:==
...
@@ -57,7 +51,7 @@ module Pod
...
@@ -57,7 +51,7 @@ module Pod
#
#
# @!visibility private
# @!visibility private
def
hash
def
hash
[
specs
,
platform
,
requires_frameworks
,
swift_version
].
hash
[
specs
,
platform
,
requires_frameworks
].
hash
end
end
end
end
end
end
...
...
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb
View file @
7cbc243f
...
@@ -241,9 +241,9 @@ module Pod
...
@@ -241,9 +241,9 @@ module Pod
build_phase
=
native_target
.
new_shell_script_build_phase
(
'Create Symlinks to Header Folders'
)
build_phase
=
native_target
.
new_shell_script_build_phase
(
'Create Symlinks to Header Folders'
)
build_phase
.
shell_script
=
<<-
eos
.
strip_heredoc
build_phase
.
shell_script
=
<<-
eos
.
strip_heredoc
cd
"$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME"
base=
"$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME"
ln -fs $
{PUBLIC_HEADERS_FOLDER_PATH
\#
$WRAPPER_NAME/}
${PUBLIC_HEADERS_FOLDER_PATH
\#\$
CONTENTS_FOLDER_PATH/}
ln -fs $
base/${PUBLIC_HEADERS_FOLDER_PATH
\#
$WRAPPER_NAME/} $base/
${PUBLIC_HEADERS_FOLDER_PATH
\#\$
CONTENTS_FOLDER_PATH/}
ln -fs $
{PRIVATE_HEADERS_FOLDER_PATH
\#\$
WRAPPER_NAME/}
${PRIVATE_HEADERS_FOLDER_PATH
\#\$
CONTENTS_FOLDER_PATH/}
ln -fs $
base/${PRIVATE_HEADERS_FOLDER_PATH
\#\$
WRAPPER_NAME/} $base/
${PRIVATE_HEADERS_FOLDER_PATH
\#\$
CONTENTS_FOLDER_PATH/}
eos
eos
end
end
...
...
lib/cocoapods/sandbox/headers_store.rb
View file @
7cbc243f
...
@@ -72,11 +72,11 @@ module Pod
...
@@ -72,11 +72,11 @@ module Pod
#
#
def
add_files
(
namespace
,
relative_header_paths
)
def
add_files
(
namespace
,
relative_header_paths
)
relative_header_paths
.
map
do
|
relative_header_path
|
relative_header_paths
.
map
do
|
relative_header_path
|
add_file
(
namespace
,
relative_header_path
,
relative_header_path
.
basename
)
add_file
(
namespace
,
relative_header_path
)
end
end
end
end
# Adds a header to the directory
under different name
.
# Adds a header to the directory.
#
#
# @param [Pathname] namespace
# @param [Pathname] namespace
# the path where the header file should be stored relative to the
# the path where the header file should be stored relative to the
...
@@ -86,23 +86,17 @@ module Pod
...
@@ -86,23 +86,17 @@ module Pod
# the path of the header file relative to the Pods project
# the path of the header file relative to the Pods project
# (`PODS_ROOT` variable of the xcconfigs).
# (`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 does _not_ add the file to the search paths.
# @note This method does _not_ add the file to the search paths.
#
#
# @return [Pathname]
# @return [Pathname]
#
#
def
add_file
(
namespace
,
relative_header_path
,
final_name
)
def
add_file
(
namespace
,
relative_header_path
)
namespaced_path
=
root
+
namespace
namespaced_path
=
root
+
namespace
namespaced_path
.
mkpath
unless
File
.
exist?
(
namespaced_path
)
namespaced_path
.
mkpath
unless
File
.
exist?
(
namespaced_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
FileUtils
.
ln_sf
(
source
,
namespaced_path
)
FileUtils
.
ln_sf
(
source
,
final_name
)
end
namespaced_path
+
relative_header_path
.
basename
namespaced_path
+
relative_header_path
.
basename
end
end
...
...
lib/cocoapods/validator.rb
View file @
7cbc243f
...
@@ -142,7 +142,15 @@ module Pod
...
@@ -142,7 +142,15 @@ module Pod
reasons
<<
'all results apply only to public specs, but you can use '
\
reasons
<<
'all results apply only to public specs, but you can use '
\
'`--private` to ignore them if linting the specification for a private pod'
'`--private` to ignore them if linting the specification for a private pod'
end
end
reasons
.
to_sentence
if
dot_swift_version
.
nil?
reasons
.
to_sentence
+
".
\n
[!] The validator for Swift projects uses "
\
'Swift 2.3 by default, if you are using a different version of '
\
'swift you can use a `.swift-version` file to set the version for '
\
"your Pod. For example to use Swift 3.0, run:
\n
"
\
' `echo "3.0" > .swift-version`'
else
reasons
.
to_sentence
end
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -243,6 +251,10 @@ module Pod
...
@@ -243,6 +251,10 @@ module Pod
@swift_version
||=
dot_swift_version
||
'2.3'
@swift_version
||=
dot_swift_version
||
'2.3'
end
end
# Set the SWIFT_VERSION that should be used to validate the pod.
#
attr_writer
:swift_version
# @return [String] the SWIFT_VERSION in the .swift-version file or nil.
# @return [String] the SWIFT_VERSION in the .swift-version file or nil.
#
#
def
dot_swift_version
def
dot_swift_version
...
...
cocoapods-integration-specs
@
261c576b
Subproject commit
6efec430148b581610f82f67947f0d12ebd62ce4
Subproject commit
261c576b588e6c8d9729cdbb9c4751f7b10f4ee7
spec/unit/installer/analyzer/pod_variant_spec.rb
View file @
7cbc243f
require
File
.
expand_path
(
'../../../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
describe
PodVariant
=
Installer
::
Analyzer
::
PodVariant
do
class
Installer
before
do
class
Analyzer
@specs
=
[
stub
(
'Spec'
),
stub
(
'Spec/Foo'
)]
describe
PodVariant
do
@platform
=
Platform
.
ios
before
do
end
@specs
=
[
stub
(
'Spec'
),
stub
(
'Spec/Foo'
)]
@platform
=
Platform
.
ios
end
it
'can be initialized with specs and platform'
do
it
'can be initialized with specs and platform'
do
variant
=
PodVariant
.
new
(
@specs
,
@platform
)
variant
=
PodVariant
.
new
(
@specs
,
@platform
)
variant
.
specs
.
should
==
@specs
variant
.
specs
.
should
==
@specs
variant
.
platform
.
should
==
@platform
variant
.
platform
.
should
==
@platform
variant
.
requires_frameworks
.
should
==
false
variant
.
requires_frameworks
.
should
==
false
variant
.
swift_version
.
should
.
nil?
end
end
it
'can be initialized with specs, platform and whether it requires frameworks'
do
it
'can be initialized with specs, platform and whether it requires frameworks'
do
variant
=
PodVariant
.
new
(
@specs
,
@platform
,
true
)
variant
=
PodVariant
.
new
(
@specs
,
@platform
,
true
)
variant
.
specs
.
should
==
@specs
variant
.
specs
.
should
==
@specs
variant
.
platform
.
should
==
@platform
variant
.
platform
.
should
==
@platform
variant
.
requires_frameworks
.
should
==
true
variant
.
requires_frameworks
.
should
==
true
variant
.
swift_version
.
should
.
nil?
end
end
it
'can be initialized with specs, platform, whether it requires frameworks, and a Swift version'
do
it
'can return the root spec'
do
variant
=
PodVariant
.
new
(
@specs
,
@platform
,
true
,
'2.3'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
variant
.
specs
.
should
==
@specs
variant
=
PodVariant
.
new
([
spec
],
Platform
.
ios
)
variant
.
platform
.
should
==
@platform
variant
.
root_spec
.
should
==
spec
variant
.
requires_frameworks
.
should
==
true
end
variant
.
swift_version
.
should
==
'2.3'
end
it
'can return the root spec'
do
it
'can be compared for equality with another variant with the same specs, platform, and whether it requires frameworks'
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
PodVariant
.
new
(
@specs
,
@platform
,
false
)
variant
=
PodVariant
.
new
([
spec
],
Platform
.
ios
)
spec
.
should
==
PodVariant
.
new
(
@specs
,
@platform
,
false
)
variant
.
root_spec
.
should
==
spec
spec
.
should
.
not
==
PodVariant
.
new
([
@specs
.
first
],
@platform
)
end
spec
.
should
.
not
==
PodVariant
.
new
(
@specs
,
Platform
.
osx
,
false
)
spec
.
should
.
not
==
PodVariant
.
new
(
@specs
,
@platform
,
true
)
it
'can be compared for equality with another variant with the same specs, platform, value for whether it requires frameworks and Swift version'
do
end
spec
=
PodVariant
.
new
(
@specs
,
@platform
,
false
,
'2.3'
)
spec
.
should
==
PodVariant
.
new
(
@specs
,
@platform
,
false
,
'2.3'
)
spec
.
should
.
not
==
PodVariant
.
new
(
@specs
,
@platform
,
false
,
'3.0'
)
spec
.
should
.
not
==
PodVariant
.
new
([
@specs
.
first
],
@platform
,
false
)
spec
.
should
.
not
==
PodVariant
.
new
(
@specs
,
Platform
.
osx
,
false
,
'2.3'
)
spec
.
should
.
not
==
PodVariant
.
new
(
@specs
,
@platform
,
true
)
end
it
'can be used as hash keys'
do
it
'can be used as hash keys'
do
k0
=
PodVariant
.
new
(
@specs
,
@platform
,
false
)
k0
=
PodVariant
.
new
(
@specs
,
@platform
,
false
)
v0
=
stub
(
'Value at index 0'
)
v0
=
stub
(
'Value at index 0'
)
k1
=
PodVariant
.
new
(
@specs
,
@platform
,
true
)
k1
=
PodVariant
.
new
(
@specs
,
@platform
,
true
)
v1
=
stub
(
'Value at index 1'
)
v1
=
stub
(
'Value at index 1'
)
hash
=
{
k0
=>
v0
,
k1
=>
v1
}
hash
=
{
k0
=>
v0
,
k1
=>
v1
}
hash
[
k0
].
should
==
v0
hash
[
k0
].
should
==
v0
hash
[
k1
].
should
==
v1
hash
[
k1
].
should
==
v1
end
end
end
end
end
end
end
end
spec/unit/installer/analyzer_spec.rb
View file @
7cbc243f
...
@@ -88,6 +88,7 @@ module Pod
...
@@ -88,6 +88,7 @@ module Pod
FileUtils
.
mkdir_p
(
tmp_directory
)
FileUtils
.
mkdir_p
(
tmp_directory
)
FileUtils
.
cp_r
(
ROOT
+
'spec/fixtures/spec-repos/test_repo/'
,
tmp_directory
)
FileUtils
.
cp_r
(
ROOT
+
'spec/fixtures/spec-repos/test_repo/'
,
tmp_directory
)
non_git_repo
=
tmp_directory
+
'test_repo'
non_git_repo
=
tmp_directory
+
'test_repo'
FileUtils
.
rm
(
non_git_repo
+
'.git'
)
podfile
=
Podfile
.
new
do
podfile
=
Podfile
.
new
do
platform
:ios
,
'8.0'
platform
:ios
,
'8.0'
...
@@ -661,6 +662,40 @@ module Pod
...
@@ -661,6 +662,40 @@ module Pod
should
.
raise
(
Informative
)
{
analyzer
.
analyze
}
should
.
raise
(
Informative
)
{
analyzer
.
analyze
}
end
end
it
'raises when targets integrate the same swift pod but have different swift versions'
do
podfile
=
Podfile
.
new
do
source
SpecHelper
.
test_repo_url
project
'SampleProject/SampleProject'
platform
:ios
,
'8.0'
pod
'OrangeFramework'
target
'SampleProject'
target
'TestRunner'
end
podfile
.
target_definitions
[
'SampleProject'
].
stubs
(
:swift_version
).
returns
(
'3.0'
)
podfile
.
target_definitions
[
'TestRunner'
].
stubs
(
:swift_version
).
returns
(
'2.3'
)
analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
podfile
)
should
.
raise
Informative
do
analyzer
.
analyze
end
.
message
.
should
.
match
/The following pods are integrated into targets that do not have the same Swift version:/
end
it
'does not raise when targets integrate the same pod but only one of the targets is a swift target'
do
podfile
=
Podfile
.
new
do
source
SpecHelper
.
test_repo_url
project
'SampleProject/SampleProject'
platform
:ios
,
'8.0'
pod
'OrangeFramework'
target
'SampleProject'
target
'TestRunner'
end
podfile
.
target_definitions
[
'SampleProject'
].
stubs
(
:swift_version
).
returns
(
'3.0'
)
# when the swift version is unset at the project level, but set in one target, swift_version is nil
podfile
.
target_definitions
[
'TestRunner'
].
stubs
(
:swift_version
).
returns
(
nil
)
analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
podfile
)
lambda
{
analyzer
.
analyze
}.
should
.
not
.
raise
end
#--------------------------------------#
#--------------------------------------#
it
'computes the state of the Sandbox respect to the resolved dependencies'
do
it
'computes the state of the Sandbox respect to the resolved dependencies'
do
...
...
spec/unit/validator_spec.rb
View file @
7cbc243f
...
@@ -812,6 +812,21 @@ module Pod
...
@@ -812,6 +812,21 @@ module Pod
validator
.
results
.
count
.
should
==
0
validator
.
results
.
count
.
should
==
0
end
end
it
'tells users about the .swift-version file if the validation fails'
do
Specification
.
any_instance
.
stubs
(
:deployment_target
).
returns
(
'9.0'
)
validator
=
test_swiftpod
validator
.
stubs
(
:validated?
).
returns
(
false
)
result
=
Validator
::
Result
.
new
(
:error
,
'attribute'
,
'message'
)
validator
.
stubs
(
:results
).
returns
([
result
])
validator
.
failure_reason
.
should
==
"1 error.
\n
[!] The validator for "
\
'Swift projects uses Swift 2.3 by default, if you are using a '
\
'different version of swift you can use a `.swift-version` file '
\
'to set the version for your Pod. For example to use Swift 3.0, '
\
"run:
\n
`echo
\"
3.0
\"
> .swift-version`"
end
describe
'#swift_version'
do
describe
'#swift_version'
do
it
'defaults to Swift 2.3'
do
it
'defaults to Swift 2.3'
do
validator
=
test_swiftpod
validator
=
test_swiftpod
...
@@ -819,6 +834,13 @@ module Pod
...
@@ -819,6 +834,13 @@ module Pod
validator
.
swift_version
.
should
==
'2.3'
validator
.
swift_version
.
should
==
'2.3'
end
end
it
'allows the user to set the version'
do
validator
=
test_swiftpod
validator
.
stubs
(
:dot_swift_version
).
returns
(
'3.0'
)
validator
.
swift_version
=
'4.0'
validator
.
swift_version
.
should
==
'4.0'
end
it
'checks for dot_swift_version'
do
it
'checks for dot_swift_version'
do
validator
=
test_swiftpod
validator
=
test_swiftpod
validator
.
expects
(
:dot_swift_version
)
validator
.
expects
(
:dot_swift_version
)
...
...
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