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
003f92e8
Commit
003f92e8
authored
Sep 12, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TargetInstaller] Set the architecture according to the value of the user targets
parent
a4cfec2d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
18 deletions
+39
-18
Gemfile.lock
Gemfile.lock
+1
-1
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+30
-0
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+4
-2
target.rb
lib/cocoapods/target.rb
+4
-0
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+0
-15
No files found.
Gemfile.lock
View file @
003f92e8
...
@@ -17,7 +17,7 @@ GIT
...
@@ -17,7 +17,7 @@ GIT
GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
remote: https://github.com/CocoaPods/Xcodeproj.git
revision:
237aca2e1a81f0d679aa401e25a944e6fdec2112
revision:
bc3a7126fa421a962ec433ba2fac11e88da0a0f4
branch: redacted-support
branch: redacted-support
specs:
specs:
xcodeproj (0.10.1)
xcodeproj (0.10.1)
...
...
lib/cocoapods/installer/analyzer.rb
View file @
003f92e8
...
@@ -35,6 +35,7 @@ module Pod
...
@@ -35,6 +35,7 @@ module Pod
@update_mode
=
false
@update_mode
=
false
@allow_pre_downloads
=
true
@allow_pre_downloads
=
true
@archs_by_target_def
=
{}
end
end
# Performs the analysis.
# Performs the analysis.
...
@@ -176,6 +177,7 @@ module Pod
...
@@ -176,6 +177,7 @@ module Pod
target
.
client_root
=
project_path
.
dirname
target
.
client_root
=
project_path
.
dirname
target
.
user_target_uuids
=
native_targets
.
map
(
&
:uuid
)
target
.
user_target_uuids
=
native_targets
.
map
(
&
:uuid
)
target
.
user_build_configurations
=
compute_user_build_configurations
(
target_definition
,
native_targets
)
target
.
user_build_configurations
=
compute_user_build_configurations
(
target_definition
,
native_targets
)
target
.
archs
=
@archs_by_target_def
[
target_definition
]
else
else
target
.
client_root
=
config
.
installation_root
target
.
client_root
=
config
.
installation_root
target
.
user_target_uuids
=
[]
target
.
user_target_uuids
=
[]
...
@@ -189,6 +191,7 @@ module Pod
...
@@ -189,6 +191,7 @@ module Pod
grouped_specs
.
each
do
|
pod_specs
|
grouped_specs
.
each
do
|
pod_specs
|
pod_target
=
PodTarget
.
new
(
pod_specs
,
target_definition
,
sandbox
)
pod_target
=
PodTarget
.
new
(
pod_specs
,
target_definition
,
sandbox
)
pod_target
.
user_build_configurations
=
target
.
user_build_configurations
pod_target
.
user_build_configurations
=
target
.
user_build_configurations
pod_target
.
archs
=
@archs_by_target_def
[
target_definition
]
target
.
pod_targets
<<
pod_target
target
.
pod_targets
<<
pod_target
end
end
end
end
...
@@ -437,6 +440,31 @@ module Pod
...
@@ -437,6 +440,31 @@ module Pod
Platform
.
new
(
name
,
deployment_target
)
Platform
.
new
(
name
,
deployment_target
)
end
end
# @return [Platform] The platform for the library.
#
# @note This resolves to the lowest deployment target across the user
# targets.
#
# @todo Is assigning the platform to the target definition the best way
# to go?
#
def
compute_archs_for_target_definition
(
target_definition
,
user_targets
)
archs
=
[]
user_targets
.
each
do
|
target
|
target
.
build_configurations
.
each
do
|
configuration
|
archs
<<
configuration
.
build_settings
[
'ARCHS'
]
end
end
archs
=
archs
.
compact
.
uniq
.
sort
if
archs
.
count
!=
1
UI
.
warn
"Found multiple values (`
#{
archs
.
join
(
'`, `'
)
}
`) for the "
\
"architectures (`ARCHS`) build setting for the "
\
"`
#{
target_definition
}
` target definition. Using the first."
end
archs
.
first
end
# Precompute the platforms for each target_definition in the Podfile
# Precompute the platforms for each target_definition in the Podfile
#
#
# @note The platforms are computed and added to each target_definition
# @note The platforms are computed and added to each target_definition
...
@@ -452,6 +480,8 @@ module Pod
...
@@ -452,6 +480,8 @@ module Pod
user_project
=
Xcodeproj
::
Project
.
open
(
project_path
)
user_project
=
Xcodeproj
::
Project
.
open
(
project_path
)
targets
=
compute_user_project_targets
(
target_definition
,
user_project
)
targets
=
compute_user_project_targets
(
target_definition
,
user_project
)
platform
=
compute_platform_for_target_definition
(
target_definition
,
targets
)
platform
=
compute_platform_for_target_definition
(
target_definition
,
targets
)
archs
=
compute_archs_for_target_definition
(
target_definition
,
targets
)
@archs_by_target_def
[
target_definition
]
=
archs
else
else
unless
target_definition
.
platform
unless
target_definition
.
platform
raise
Informative
,
"It is necessary to specify the platform in the Podfile if not integrating."
raise
Informative
,
"It is necessary to specify the platform in the Podfile if not integrating."
...
...
lib/cocoapods/installer/target_installer.rb
View file @
003f92e8
...
@@ -44,8 +44,10 @@ module Pod
...
@@ -44,8 +44,10 @@ module Pod
@target
=
project
.
new_target
(
:static_library
,
name
,
platform
,
deployment_target
)
@target
=
project
.
new_target
(
:static_library
,
name
,
platform
,
deployment_target
)
settings
=
{}
settings
=
{}
if
library
.
platform
.
requires_legacy_ios_archs?
if
library
.
archs
settings
[
'ARCHS'
]
=
"armv6 armv7"
settings
[
'ARCHS'
]
=
library
.
archs
else
settings
.
delete
(
'ARCHS'
)
end
end
@target
.
build_settings
(
'Debug'
).
merge!
(
settings
)
@target
.
build_settings
(
'Debug'
).
merge!
(
settings
)
...
...
lib/cocoapods/target.rb
View file @
003f92e8
...
@@ -62,6 +62,10 @@ module Pod
...
@@ -62,6 +62,10 @@ module Pod
@platform
||=
target_definition
.
platform
@platform
||=
target_definition
.
platform
end
end
# @return [String] The value for the ARCHS build setting.
#
attr_accessor
:archs
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
# @!group Support files
# @!group Support files
...
...
spec/unit/installer/target_installer_spec.rb
View file @
003f92e8
...
@@ -29,20 +29,5 @@ module Pod
...
@@ -29,20 +29,5 @@ module Pod
@installer
=
Installer
::
TargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
@installer
=
Installer
::
TargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
end
end
it
"sets the ARCHS"
do
@installer
.
send
(
:add_target
)
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ONLY_ACTIVE_ARCH"
].
should
.
be
.
nil
target
.
build_settings
(
'AppStore'
)[
"ONLY_ACTIVE_ARCH"
].
should
.
be
.
nil
end
it
"sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3 for iOS targets"
do
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'4.0'
))
@installer
.
send
(
:add_target
)
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)[
"ARCHS"
].
should
==
"armv6 armv7"
end
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