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
e00268b7
Commit
e00268b7
authored
Dec 09, 2014
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2918 from CocoaPods/dont-generate-targets-if-no-source-files
Do not generate targets for Pods without sources
parents
c6b6f5f4
87546c3e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
1 deletion
+52
-1
CHANGELOG.md
CHANGELOG.md
+4
-0
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+1
-0
installer.rb
lib/cocoapods/installer.rb
+4
-1
pod_target_installer.rb
...oapods/installer/target_installer/pod_target_installer.rb
+2
-0
pod_target.rb
lib/cocoapods/target/pod_target.rb
+8
-0
aggregate_xcconfig_spec.rb
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
+25
-0
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+8
-0
No files found.
CHANGELOG.md
View file @
e00268b7
...
@@ -17,6 +17,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -17,6 +17,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
##### Enhancements
*
Do not generate targets for Pods without sources.
[
Boris Bügling
](
https://github.com/neonichu
)
[
#2918
](
https://github.com/CocoaPods/CocoaPods/issues/2918
)
*
Show the name of the source for each hook that is run in verbose mode.
*
Show the name of the source for each hook that is run in verbose mode.
[
Samuel Giddins
](
https://github.com/segiddins
)
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#2639
](
https://github.com/CocoaPods/CocoaPods/issues/2639
)
[
#2639
](
https://github.com/CocoaPods/CocoaPods/issues/2639
)
...
...
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
e00268b7
...
@@ -73,6 +73,7 @@ module Pod
...
@@ -73,6 +73,7 @@ module Pod
# Add pod static lib to list of libraries that are to be linked with
# Add pod static lib to list of libraries that are to be linked with
# the user’s project.
# the user’s project.
next
unless
pod_target
.
should_build?
@xcconfig
.
merge!
(
'OTHER_LDFLAGS'
=>
%(-l "#{pod_target.name}")
)
@xcconfig
.
merge!
(
'OTHER_LDFLAGS'
=>
%(-l "#{pod_target.name}")
)
end
end
...
...
lib/cocoapods/installer.rb
View file @
e00268b7
...
@@ -435,7 +435,9 @@ module Pod
...
@@ -435,7 +435,9 @@ module Pod
pod_targets
.
sort_by
(
&
:name
).
each
do
|
pod_target
|
pod_targets
.
sort_by
(
&
:name
).
each
do
|
pod_target
|
pod_target
.
file_accessors
.
each
do
|
file_accessor
|
pod_target
.
file_accessors
.
each
do
|
file_accessor
|
file_accessor
.
spec_consumer
.
frameworks
.
each
do
|
framework
|
file_accessor
.
spec_consumer
.
frameworks
.
each
do
|
framework
|
pod_target
.
native_target
.
add_system_framework
(
framework
)
if
pod_target
.
should_build?
pod_target
.
native_target
.
add_system_framework
(
framework
)
end
end
end
end
end
end
end
...
@@ -445,6 +447,7 @@ module Pod
...
@@ -445,6 +447,7 @@ module Pod
def
set_target_dependencies
def
set_target_dependencies
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_target
.
pod_targets
.
each
do
|
pod_target
|
aggregate_target
.
pod_targets
.
each
do
|
pod_target
|
next
unless
pod_target
.
should_build?
aggregate_target
.
native_target
.
add_dependency
(
pod_target
.
native_target
)
aggregate_target
.
native_target
.
add_dependency
(
pod_target
.
native_target
)
pod_target
.
dependencies
.
each
do
|
dep
|
pod_target
.
dependencies
.
each
do
|
dep
|
...
...
lib/cocoapods/installer/target_installer/pod_target_installer.rb
View file @
e00268b7
...
@@ -9,6 +9,8 @@ module Pod
...
@@ -9,6 +9,8 @@ module Pod
# @return [void]
# @return [void]
#
#
def
install!
def
install!
return
unless
target
.
should_build?
UI
.
message
"- Installing target `
#{
target
.
name
}
`
#{
target
.
platform
}
"
do
UI
.
message
"- Installing target `
#{
target
.
name
}
`
#{
target
.
platform
}
"
do
add_target
add_target
create_support_files_dir
create_support_files_dir
...
...
lib/cocoapods/target/pod_target.rb
View file @
e00268b7
...
@@ -34,6 +34,14 @@ module Pod
...
@@ -34,6 +34,14 @@ module Pod
#
#
attr_accessor
:file_accessors
attr_accessor
:file_accessors
# @return [Bool] Whether or not this target should be build.
#
# A target should not be build if it has no source files.
#
def
should_build?
!
file_accessors
.
flat_map
(
&
:source_files
).
empty?
end
# @return [Array<Specification::Consumer>] the specification consumers for
# @return [Array<Specification::Consumer>] the specification consumers for
# the target.
# the target.
#
#
...
...
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
View file @
e00268b7
...
@@ -17,6 +17,8 @@ module Pod
...
@@ -17,6 +17,8 @@ module Pod
@pod_target
=
PodTarget
.
new
([
@spec
],
target_definition
,
config
.
sandbox
)
@pod_target
=
PodTarget
.
new
([
@spec
],
target_definition
,
config
.
sandbox
)
@pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@pod_target
.
stubs
(
:spec_consumers
).
returns
([
@consumer
])
@pod_target
.
stubs
(
:spec_consumers
).
returns
([
@consumer
])
file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@pod_target
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
@target
.
pod_targets
=
[
@pod_target
]
@target
.
pod_targets
=
[
@pod_target
]
@generator
=
AggregateXCConfig
.
new
(
@target
,
'Release'
)
@generator
=
AggregateXCConfig
.
new
(
@target
,
'Release'
)
end
end
...
@@ -91,6 +93,29 @@ module Pod
...
@@ -91,6 +93,29 @@ module Pod
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
describe
"if a pod target does not contain source files"
do
before
do
@pod_target
.
file_accessors
.
first
.
stubs
(
:source_files
).
returns
([])
@xcconfig
=
@generator
.
generate
end
it
'does not link with the aggregate integration library target'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
not
.
include
'-l"Pods-BananaLib"'
end
it
'does link with vendored frameworks'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
'-framework "Bananalib"'
end
it
'does link with vendored libraries'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
'-l"Bananalib"'
end
end
#-----------------------------------------------------------------------#
before
do
before
do
@path
=
temporary_directory
+
'sample.xcconfig'
@path
=
temporary_directory
+
'sample.xcconfig'
@generator
.
save_as
(
@path
)
@generator
.
save_as
(
@path
)
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
e00268b7
...
@@ -151,6 +151,14 @@ module Pod
...
@@ -151,6 +151,14 @@ module Pod
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
end
end
#--------------------------------------------------------------------------------#
it
'does not create a target if the specification does not define source files'
do
@pod_target
.
file_accessors
.
first
.
stubs
(
:source_files
).
returns
([])
@installer
.
install!
@project
.
targets
.
should
==
[]
end
#--------------------------------------------------------------------------------#
#--------------------------------------------------------------------------------#
describe
'concerning compiler flags'
do
describe
'concerning compiler flags'
do
before
do
before
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