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
3b752904
Commit
3b752904
authored
Jul 31, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Specification] add support for library_files
parent
05d0f7de
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
89 additions
and
22 deletions
+89
-22
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+3
-0
public_pod_xcconfig.rb
lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb
+3
-0
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+19
-0
file_references_installer.rb
lib/cocoapods/installer/file_references_installer.rb
+4
-2
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+1
-0
project.rb
lib/cocoapods/project.rb
+1
-1
file_accessor.rb
lib/cocoapods/sandbox/file_accessor.rb
+14
-3
banana-lib.tar.gz
spec/fixtures/banana-lib.tar.gz
+0
-0
chameleon.tar.gz
spec/fixtures/chameleon.tar.gz
+0
-0
public_pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/public_pod_xcconfig_spec.rb
+19
-16
xcconfig_helper_spec.rb
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
+13
-0
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+6
-0
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+1
-0
file_accessor_spec.rb
spec/unit/sandbox/file_accessor_spec.rb
+4
-0
path_list_spec.rb
spec/unit/sandbox/path_list_spec.rb
+1
-0
No files found.
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
3b752904
...
@@ -57,6 +57,9 @@ module Pod
...
@@ -57,6 +57,9 @@ module Pod
file_accessor
.
framework_bundles
.
each
do
|
framework_bundle
|
file_accessor
.
framework_bundles
.
each
do
|
framework_bundle
|
XCConfigHelper
.
add_framework_build_settings
(
framework_bundle
,
@xcconfig
,
target
.
sandbox
.
root
)
XCConfigHelper
.
add_framework_build_settings
(
framework_bundle
,
@xcconfig
,
target
.
sandbox
.
root
)
end
end
file_accessor
.
library_files
.
each
do
|
library_file
|
XCConfigHelper
.
add_library_build_settings
(
library_file
,
@xcconfig
,
target
.
sandbox
.
root
)
end
end
end
end
end
...
...
lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb
View file @
3b752904
...
@@ -47,6 +47,9 @@ module Pod
...
@@ -47,6 +47,9 @@ module Pod
file_accessor
.
framework_bundles
.
each
do
|
framework_bundle
|
file_accessor
.
framework_bundles
.
each
do
|
framework_bundle
|
XCConfigHelper
.
add_framework_build_settings
(
framework_bundle
,
@xcconfig
,
target
.
sandbox
.
root
)
XCConfigHelper
.
add_framework_build_settings
(
framework_bundle
,
@xcconfig
,
target
.
sandbox
.
root
)
end
end
file_accessor
.
library_files
.
each
do
|
library_file
|
XCConfigHelper
.
add_library_build_settings
(
library_file
,
@xcconfig
,
target
.
sandbox
.
root
)
end
end
end
@xcconfig
@xcconfig
end
end
...
...
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
3b752904
...
@@ -68,6 +68,25 @@ module Pod
...
@@ -68,6 +68,25 @@ module Pod
xcconfig
.
merge!
(
build_settings
)
xcconfig
.
merge!
(
build_settings
)
end
end
# Configures the given Xcconfig with the the build settings for the given
# framework path.
#
# @param [Pathanme] framework_path
# The path of the framework.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
def
self
.
add_library_build_settings
(
library_path
,
xcconfig
,
sandbox_root
)
name
=
File
.
basename
(
library_path
,
".a"
).
sub
(
/\Alib/
,
''
)
dirname
=
File
.
dirname
(
library_path
).
sub
(
sandbox_root
.
to_s
,
'$(PODS_ROOT)'
)
build_settings
=
{
'OTHER_LDFLAGS'
=>
"-l
#{
name
}
"
,
'LIBRARY_SEARCH_PATHS'
=>
quote
([
dirname
])
}
xcconfig
.
merge!
(
build_settings
)
end
# @return [Array<String>] The search paths for the developer frameworks.
# @return [Array<String>] The search paths for the developer frameworks.
#
#
DEVELOPER_FRAMEWORKS_SEARCH_PATHS
=
[
DEVELOPER_FRAMEWORKS_SEARCH_PATHS
=
[
...
...
lib/cocoapods/installer/file_references_installer.rb
View file @
3b752904
...
@@ -83,14 +83,16 @@ module Pod
...
@@ -83,14 +83,16 @@ module Pod
#
#
def
add_frameworks_bundles
def
add_frameworks_bundles
UI
.
message
"- Adding frameworks to Pods project"
do
UI
.
message
"- Adding frameworks to Pods project"
do
add_file_acessors_paths_to_pods_group
(
:framework_bundles
,
:frameworks
)
add_file_acessors_paths_to_pods_group
(
:framework_bundles
,
:frameworks
_and_libraries
)
end
end
end
end
# TODO
# TODO
#
#
def
add_library_files
def
add_library_files
UI
.
message
"- Adding frameworks to Pods project"
do
add_file_acessors_paths_to_pods_group
(
:library_files
,
:frameworks_and_libraries
)
end
end
end
# Adds the resources of the Pods to the Pods project.
# Adds the resources of the Pods to the Pods project.
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
3b752904
...
@@ -230,6 +230,7 @@ module Pod
...
@@ -230,6 +230,7 @@ module Pod
def
used_files
def
used_files
files
=
[
files
=
[
file_accessors
.
map
(
&
:framework_bundles
),
file_accessors
.
map
(
&
:framework_bundles
),
file_accessors
.
map
(
&
:library_files
),
file_accessors
.
map
(
&
:license
),
file_accessors
.
map
(
&
:license
),
file_accessors
.
map
(
&
:prefix_header
),
file_accessors
.
map
(
&
:prefix_header
),
file_accessors
.
map
(
&
:preserve_paths
),
file_accessors
.
map
(
&
:preserve_paths
),
...
...
lib/cocoapods/project.rb
View file @
3b752904
...
@@ -122,7 +122,7 @@ module Pod
...
@@ -122,7 +122,7 @@ module Pod
case
type
case
type
when
:source_files
then
sub_group
=
'Source Files'
when
:source_files
then
sub_group
=
'Source Files'
when
:resources
then
sub_group
=
'Resources'
when
:resources
then
sub_group
=
'Resources'
when
:frameworks
then
sub_group
=
'Framework
s'
when
:frameworks
_and_libraries
then
sub_group
=
'Frameworks & Librarie
s'
when
:support_files
then
sub_group
=
'Support Files'
when
:support_files
then
sub_group
=
'Support Files'
else
raise
"[BUG]"
else
raise
"[BUG]"
end
end
...
...
lib/cocoapods/sandbox/file_accessor.rb
View file @
3b752904
...
@@ -21,11 +21,15 @@ module Pod
...
@@ -21,11 +21,15 @@ module Pod
#
#
attr_reader
:spec_consumer
attr_reader
:spec_consumer
# @param [Sandbox::PathList] path_list @see path_list
# @param [Sandbox::PathList
, Pathname
] path_list @see path_list
# @param [Specification::Consumer] spec_consumer @see spec_consumer
# @param [Specification::Consumer] spec_consumer @see spec_consumer
#
#
def
initialize
(
path_list
,
spec_consumer
)
def
initialize
(
path_list
,
spec_consumer
)
@path_list
=
path_list
if
path_list
.
is_a?
(
PathList
)
@path_list
=
path_list
else
@path_list
=
PathList
.
new
(
path_list
)
end
@spec_consumer
=
spec_consumer
@spec_consumer
=
spec_consumer
unless
@spec_consumer
unless
@spec_consumer
...
@@ -106,7 +110,14 @@ module Pod
...
@@ -106,7 +110,14 @@ module Pod
# shipped with the Pod.
# shipped with the Pod.
#
#
def
framework_bundles
def
framework_bundles
expanded_paths
(
spec_consumer
.
framework_bundles
,
:include_dirs
=>
true
)
paths_for_attribute
(
:framework_bundles
,
true
)
end
# @return [Array<Pathname>] The paths of the framework bundles that come
# shipped with the Pod.
#
def
library_files
paths_for_attribute
(
:library_files
)
end
end
# @return [Pathname] The of the prefix header file of the specification.
# @return [Pathname] The of the prefix header file of the specification.
...
...
spec/fixtures/banana-lib.tar.gz
View file @
3b752904
No preview for this file type
spec/fixtures/chameleon.tar.gz
View file @
3b752904
No preview for this file type
spec/unit/generator/xcconfig/public_pod_xcconfig_spec.rb
View file @
3b752904
...
@@ -17,9 +17,9 @@ module Pod
...
@@ -17,9 +17,9 @@ module Pod
@spec
.
frameworks
=
[
'QuartzCore'
]
@spec
.
frameworks
=
[
'QuartzCore'
]
@spec
.
weak_frameworks
=
[
'iAd'
]
@spec
.
weak_frameworks
=
[
'iAd'
]
@spec
.
libraries
=
[
'xml2'
]
@spec
.
libraries
=
[
'xml2'
]
file_accessors
=
[
Sandbox
::
FileAccessor
.
new
(
nil
,
@spec
.
consumer
(
:ios
))]
file_accessors
=
[
Sandbox
::
FileAccessor
.
new
(
fixture
(
'banana-lib'
)
,
@spec
.
consumer
(
:ios
))]
framework_bundle_paths
=
[
config
.
sandbox
.
root
+
'BananaLib/BananaLib.framework'
]
#
framework_bundle_paths = [config.sandbox.root + 'BananaLib/BananaLib.framework']
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:framework_bundles
).
returns
(
framework_bundle_paths
)
#
Sandbox::FileAccessor.any_instance.stubs(:framework_bundles).returns(framework_bundle_paths)
@pod_target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@pod_target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@pod_target
.
stubs
(
:file_accessors
).
returns
(
file_accessors
)
@pod_target
.
stubs
(
:file_accessors
).
returns
(
file_accessors
)
...
@@ -51,26 +51,29 @@ module Pod
...
@@ -51,26 +51,29 @@ module Pod
@spec
.
xcconfig
=
{
'OTHER_LDFLAGS'
=>
'-no_compact_unwind'
}
@spec
.
xcconfig
=
{
'OTHER_LDFLAGS'
=>
'-no_compact_unwind'
}
@spec
.
frameworks
=
[
'SenTestingKit'
]
@spec
.
frameworks
=
[
'SenTestingKit'
]
xcconfig
=
@generator
.
generate
xcconfig
=
@generator
.
generate
xcconfig
.
to_hash
[
"FRAMEWORK_SEARCH_PATHS"
].
should
==
'$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks" "$(PODS_ROOT)/BananaLib"'
framework_search_paths
=
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
]
framework_search_paths
.
should
.
include
(
'$(SDKROOT)/Developer'
)
end
end
it
"doesn't include the developer frameworks if already present"
do
it
"doesn't include the developer frameworks if already present"
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@spec
.
xcconfig
=
{
'FRAMEWORK_SEARCH_PATHS'
=>
'"$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
}
pod_target
=
PodTarget
.
new
([
@spec
,
spec
],
@target_definition
,
config
.
sandbox
)
@spec
.
frameworks
=
[
'SenTestingKit'
]
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
xcconfig
=
@generator
.
generate
generator
=
PublicPodXCConfig
.
new
(
pod_target
)
framework_search_paths
=
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
split
(
' '
)
spec
.
frameworks
=
[
'SenTestingKit'
]
framework_search_paths
.
select
{
|
path
|
path
==
'"$(SDKROOT)/Developer/Library/Frameworks"'
}.
count
.
should
==
1
file_accessors
=
[
Sandbox
::
FileAccessor
.
new
(
nil
,
spec
.
consumer
(
:ios
))]
framework_search_paths
.
select
{
|
path
|
path
==
'"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
}.
count
.
should
==
1
pod_target
.
stubs
(
:file_accessors
).
returns
(
file_accessors
)
xcconfig
=
generator
.
generate
xcconfig
.
to_hash
[
"FRAMEWORK_SEARCH_PATHS"
].
should
==
'$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks" "$(PODS_ROOT)/BananaLib"'
end
end
it
"includes the build settings of the frameworks bundles of the spec"
do
it
"includes the build settings of the frameworks bundles of the spec"
do
@spec
.
framework_bundles
=
[
'BananaLib.framework'
]
config
.
sandbox
.
stubs
(
:root
).
returns
(
fixture
(
''
))
xcconfig
=
@generator
.
generate
xcconfig
.
to_hash
[
"FRAMEWORK_SEARCH_PATHS"
].
should
.
include?
(
'"$(PODS_ROOT)/banana-lib"'
)
end
it
"includes the build settings of the libraries shipped with the spec"
do
config
.
sandbox
.
stubs
(
:root
).
returns
(
fixture
(
''
))
xcconfig
=
@generator
.
generate
xcconfig
=
@generator
.
generate
xcconfig
.
to_hash
[
"
FRAMEWORK_SEARCH_PATHS"
].
should
.
include?
(
'"$(PODS_ROOT)/BananaL
ib"'
)
xcconfig
.
to_hash
[
"
LIBRARY_SEARCH_PATHS"
].
should
.
include?
(
'"$(PODS_ROOT)/banana-l
ib"'
)
end
end
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
...
...
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
View file @
3b752904
...
@@ -134,6 +134,19 @@ module Pod
...
@@ -134,6 +134,19 @@ module Pod
#---------------------------------------------------------------------#
#---------------------------------------------------------------------#
describe
"::add_library_build_settings"
do
it
"adds the build settings of a framework to the given xcconfig"
do
path
=
config
.
sandbox
.
root
+
'MapBox/Proj4/libProj4.a'
xcconfig
=
Xcodeproj
::
Config
.
new
@sut
.
add_library_build_settings
(
path
,
xcconfig
,
config
.
sandbox
.
root
)
hash_config
=
xcconfig
.
to_hash
hash_config
[
'OTHER_LDFLAGS'
].
should
==
"-lProj4"
hash_config
[
'LIBRARY_SEARCH_PATHS'
].
should
==
'"$(PODS_ROOT)/MapBox/Proj4"'
end
end
#---------------------------------------------------------------------#
describe
"::add_framework_build_settings"
do
describe
"::add_framework_build_settings"
do
it
"adds the developer frameworks search paths to the xcconfig if SenTestingKit has been detected"
do
it
"adds the developer frameworks search paths to the xcconfig if SenTestingKit has been detected"
do
xcconfig
=
Xcodeproj
::
Config
.
new
({
'OTHER_LDFLAGS'
=>
'-framework SenTestingKit'
})
xcconfig
=
Xcodeproj
::
Config
.
new
({
'OTHER_LDFLAGS'
=>
'-framework SenTestingKit'
})
...
...
spec/unit/installer/file_references_installer_spec.rb
View file @
3b752904
...
@@ -35,6 +35,12 @@ module Pod
...
@@ -35,6 +35,12 @@ module Pod
file_ref
.
should
.
be
.
not
.
nil
file_ref
.
should
.
be
.
not
.
nil
end
end
xit
"adds the file references of the frameworks of the projet"
do
end
xit
"adds the file references of the libraries of the project"
it
"adds the files references of the resources the Pods project"
do
it
"adds the files references of the resources the Pods project"
do
@installer
.
install!
@installer
.
install!
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/Resources/logo-sidebar.png'
]
file_ref
=
@installer
.
pods_project
[
'Pods/BananaLib/Resources/logo-sidebar.png'
]
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
3b752904
...
@@ -171,6 +171,7 @@ module Pod
...
@@ -171,6 +171,7 @@ module Pod
it
"compacts the used files as nil would be converted to the empty string"
do
it
"compacts the used files as nil would be converted to the empty string"
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:library_files
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:resources
).
returns
(
nil
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:resources
).
returns
(
nil
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:preserve_paths
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:preserve_paths
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:prefix_header
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:prefix_header
)
...
...
spec/unit/sandbox/file_accessor_spec.rb
View file @
3b752904
...
@@ -107,6 +107,10 @@ module Pod
...
@@ -107,6 +107,10 @@ module Pod
@accessor
.
framework_bundles
.
should
.
include?
(
@root
+
"Bananalib.framework"
)
@accessor
.
framework_bundles
.
should
.
include?
(
@root
+
"Bananalib.framework"
)
end
end
it
"returns the paths of the library files"
do
@accessor
.
library_files
.
should
.
include?
(
@root
+
"libBananalib.a"
)
end
it
"returns the prefix header of the specification"
do
it
"returns the prefix header of the specification"
do
@accessor
.
prefix_header
.
should
==
@root
+
'Classes/BananaLib.pch'
@accessor
.
prefix_header
.
should
==
@root
+
'Classes/BananaLib.pch'
end
end
...
...
spec/unit/sandbox/path_list_spec.rb
View file @
3b752904
...
@@ -23,6 +23,7 @@ module Pod
...
@@ -23,6 +23,7 @@ module Pod
README
README
Resources/logo-sidebar.png
Resources/logo-sidebar.png
Resources/sub_dir/logo-sidebar.png
Resources/sub_dir/logo-sidebar.png
libBananalib.a
preserve_me.txt
preserve_me.txt
sub-dir/sub-dir-2/somefile.txt
sub-dir/sub-dir-2/somefile.txt
]
]
...
...
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