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
dfd3ed6c
Commit
dfd3ed6c
authored
Nov 15, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4106 from CocoaPods/use-realpath-for-development-pods
Fix Swift code completion for Development Pods
parents
313ffd35
67e4aca2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
8 deletions
+41
-8
CHANGELOG.md
CHANGELOG.md
+5
-0
project.rb
lib/cocoapods/project.rb
+3
-3
installer_spec.rb
spec/unit/installer_spec.rb
+10
-4
project_spec.rb
spec/unit/project_spec.rb
+20
-0
validator_spec.rb
spec/unit/validator_spec.rb
+3
-1
No files found.
CHANGELOG.md
View file @
dfd3ed6c
...
...
@@ -136,6 +136,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#4514
](
https://github.com/CocoaPods/CocoaPods/issues/4514
)
*
Fix Swift code completion for Development Pods by using
`realpath`
for
symlinked source files.
[
Boris Bügling
](
https://github.com/neonichu
)
[
#3777
](
https://github.com/CocoaPods/CocoaPods/issues/3777
)
## 0.39.0 (2015-10-09)
...
...
lib/cocoapods/project.rb
View file @
dfd3ed6c
...
...
@@ -179,13 +179,13 @@ module Pod
# @return [PBXFileReference] The new file reference.
#
def
add_file_reference
(
absolute_path
,
group
,
reflect_file_system_structure
=
false
)
file_path_name
=
Pathname
.
new
(
absolute_path
)
file_path_name
=
absolute_path
.
is_a?
(
Pathname
)
?
absolute_path
:
Pathname
.
new
(
absolute_path
)
group
=
group_for_path_in_group
(
file_path_name
,
group
,
reflect_file_system_structure
)
if
ref
=
reference_for_path
(
absolute_
path
)
if
ref
=
reference_for_path
(
file_path_name
.
real
path
)
ref
else
ref
=
group
.
new_file
(
absolute_
path
)
ref
=
group
.
new_file
(
file_path_name
.
real
path
)
@refs_by_absolute_path
[
absolute_path
.
to_s
]
=
ref
end
end
...
...
spec/unit/installer_spec.rb
View file @
dfd3ed6c
...
...
@@ -252,24 +252,30 @@ module Pod
pod
'monkey'
,
:path
=>
(
fixture_path
+
'monkey'
).
to_s
end
@lockfile
=
generate_lockfile
@file
=
Pathname
(
'/yolo.m'
)
@file
.
stubs
(
:realpath
).
returns
(
@file
)
@lib_thing
=
Pathname
(
'/libThing.a'
)
@lib_thing
.
stubs
(
:realpath
).
returns
(
@lib_thing
)
end
it
'detects transitive static dependencies which are linked directly to the user target'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
Pathname
(
'/libThing.a'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@lib_thing
])
@installer
=
Installer
.
new
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
raise
(
Informative
)
{
@installer
.
install!
}.
message
.
should
.
match
/transitive.*libThing/
end
it
'allows transitive static dependencies which contain other source code'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
Pathname
(
'/yolo.m'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
Pathname
(
'/libThing.a'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
@file
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@lib_thing
])
@installer
=
Installer
.
new
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
not
.
raise
(
Informative
)
{
@installer
.
install!
}
end
it
'allows transitive static dependencies when both dependencies are linked against the user target'
do
PodTarget
.
any_instance
.
stubs
(
:should_build?
=>
false
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
Pathname
(
'/libThing.a'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@lib_thing
])
@installer
=
Installer
.
new
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
not
.
raise
(
Informative
)
{
@installer
.
install!
}
end
...
...
spec/unit/project_spec.rb
View file @
dfd3ed6c
...
...
@@ -174,26 +174,31 @@ module Pod
end
it
'adds a file references to the given file'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@file
)
ref
=
@project
.
add_file_reference
(
@file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
it
'adds subgroups for a file reference if requested'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@nested_file
)
ref
=
@project
.
add_file_reference
(
@nested_file
,
@group
,
true
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Dir/SubDir/nested_file.m'
end
it
'does not add subgroups for a file reference if not requested'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@nested_file
)
ref
=
@project
.
add_file_reference
(
@nested_file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/nested_file.m'
end
it
'does not add subgroups for a file reference if requested not to'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@nested_file
)
ref
=
@project
.
add_file_reference
(
@nested_file
,
@group
,
false
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/nested_file.m'
end
it
"it doesn't duplicate file references for a single path"
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@file
)
ref_1
=
@project
.
add_file_reference
(
@file
,
@group
)
ref_2
=
@project
.
add_file_reference
(
@file
,
@group
)
ref_1
.
uuid
.
should
==
ref_2
.
uuid
...
...
@@ -201,12 +206,14 @@ module Pod
end
it
'creates variant group for localized file'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@localized_file
)
ref
=
@project
.
add_file_reference
(
@localized_file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Foo/Foo.strings'
ref
.
parent
.
class
.
should
==
Xcodeproj
::
Project
::
Object
::
PBXVariantGroup
end
it
'creates variant group for localized file in subgroup'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@localized_file
)
ref
=
@project
.
add_file_reference
(
@localized_file
,
@group
,
true
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Dir/SubDir/Foo/Foo.strings'
ref
.
parent
.
class
.
should
==
Xcodeproj
::
Project
::
Object
::
PBXVariantGroup
...
...
@@ -217,6 +224,18 @@ module Pod
@project
.
add_file_reference
(
'relative/path/to/file.m'
,
@group
)
end
.
message
.
should
.
match
/Paths must be absolute/
end
it
'uses realpath for resolving symlinks'
do
file
=
Pathname
.
new
(
Dir
.
tmpdir
)
+
'file.m'
FileUtils
.
rm_f
(
file
)
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
''
)
}
sym_file
=
Pathname
.
new
(
Dir
.
tmpdir
)
+
'symlinked_file.m'
FileUtils
.
rm_f
(
sym_file
)
File
.
symlink
(
file
,
sym_file
)
ref
=
@project
.
add_file_reference
(
sym_file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
end
#----------------------------------------#
...
...
@@ -312,6 +331,7 @@ module Pod
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
'file.m'
@group
=
@project
.
group_for_spec
(
'BananaLib'
)
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@file
)
@project
.
add_file_reference
(
@file
,
@group
)
end
...
...
spec/unit/validator_spec.rb
View file @
dfd3ed6c
...
...
@@ -729,9 +729,11 @@ module Pod
def
test_swiftpod
podspec
=
stub_podspec
(
/.*source_files.*/
,
'"source_files": "*.swift",'
)
file
=
write_podspec
(
podspec
)
pathname
=
Pathname
.
new
(
'/Foo.swift'
)
pathname
.
stubs
(
:realpath
).
returns
(
pathname
)
Podfile
::
TargetDefinition
.
any_instance
.
stubs
(
:uses_frameworks?
).
returns
(
true
)
Pod
::
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'/Foo.swift'
)
])
Pod
::
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
pathname
])
validator
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
))
validator
.
stubs
(
:build_pod
)
validator
.
stubs
(
:validate_url
)
...
...
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