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
80723d9f
Commit
80723d9f
authored
Aug 17, 2016
by
Ben Asher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
computing swift version uses PBXNativeTarget#resolved_build_setting
parent
990cd0a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
target_inspector.rb
lib/cocoapods/installer/analyzer/target_inspector.rb
+3
-4
target_inspector_spec.rb
spec/unit/installer/analyzer/target_inspector_spec.rb
+11
-0
No files found.
lib/cocoapods/installer/analyzer/target_inspector.rb
View file @
80723d9f
...
...
@@ -216,10 +216,9 @@ module Pod
# @return [String] the targets Swift version or nil
#
def
compute_swift_version_from_targets
(
targets
)
versions
=
targets
.
flat_map
(
&
:build_configurations
).
flat_map
{
|
config
|
config
.
build_settings
[
'SWIFT_VERSION'
]
}.
compact
.
uniq
versions
=
targets
.
flat_map
do
|
target
|
target
.
resolved_build_setting
(
'SWIFT_VERSION'
).
values
end
.
flatten
.
compact
.
uniq
case
versions
.
count
when
0
nil
...
...
spec/unit/installer/analyzer/target_inspector_spec.rb
View file @
80723d9f
...
...
@@ -326,6 +326,17 @@ module Pod
target_inspector
.
send
(
:compute_swift_version_from_targets
,
user_targets
)
end
.
message
.
should
.
include
'There may only be up to 1 unique SWIFT_VERSION per target.'
end
it
'returns the project-level SWIFT_VERSION if the target-level SWIFT_VERSION is not defined'
do
user_project
=
Xcodeproj
::
Project
.
new
(
'path'
)
user_project
.
build_configuration_list
.
set_setting
(
'SWIFT_VERSION'
,
'2.3'
)
target
=
user_project
.
new_target
(
:application
,
'Target'
,
:ios
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
user_targets
=
[
target
]
target_inspector
=
TargetInspector
.
new
(
target_definition
,
config
.
installation_root
)
target_inspector
.
send
(
:compute_swift_version_from_targets
,
user_targets
).
should
.
equal
'2.3'
end
end
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