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
08b71052
Commit
08b71052
authored
Sep 11, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor and start on creation of static library.
parent
e65536b2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
18 deletions
+58
-18
install.rb
lib/cocoa_pods/command/install.rb
+1
-0
resolver.rb
lib/cocoa_pods/resolver.rb
+2
-7
source.rb
lib/cocoa_pods/source.rb
+1
-1
specification.rb
lib/cocoa_pods/specification.rb
+38
-10
set.rb
lib/cocoa_pods/specification/set.rb
+16
-0
No files found.
lib/cocoa_pods/command/install.rb
View file @
08b71052
...
@@ -5,6 +5,7 @@ module Pod
...
@@ -5,6 +5,7 @@ module Pod
if
spec
=
Specification
.
from_podfile
(
podfile
)
if
spec
=
Specification
.
from_podfile
(
podfile
)
#config.clean = false
#config.clean = false
spec
.
install_dependent_specifications!
spec
.
install_dependent_specifications!
spec
.
create_static_library!
else
else
$stderr
.
puts
"No Podfile found in current working directory."
$stderr
.
puts
"No Podfile found in current working directory."
end
end
...
...
lib/cocoa_pods/resolver.rb
View file @
08b71052
...
@@ -7,7 +7,6 @@ module Pod
...
@@ -7,7 +7,6 @@ module Pod
def
resolve
def
resolve
@sets
=
[]
@sets
=
[]
find_dependency_sets
(
@specification
)
find_dependency_sets
(
@specification
)
#@sets.reject(&:only_part_of_other_pod?).map(&:podspec)
@sets
@sets
end
end
...
@@ -18,12 +17,8 @@ module Pod
...
@@ -18,12 +17,8 @@ module Pod
raise
"Unable to find a pod named `
#{
dependency
.
name
}
'"
raise
"Unable to find a pod named `
#{
dependency
.
name
}
'"
end
end
sets
.
each
do
|
set
|
sets
.
each
do
|
set
|
# TODO ultimately this compatibility check should be used to try and
set
.
required_by
(
specification
,
dependency
)
# resolve the conflicts, but for now we'll keep it simple.
unless
@sets
.
include?
(
set
)
if
existing_set
=
@sets
.
find
{
|
s
|
s
==
set
}
existing_set
.
required_by
(
specification
,
dependency
)
else
set
.
required_by
(
specification
,
dependency
)
@sets
<<
set
@sets
<<
set
find_dependency_sets
(
set
.
podspec
)
find_dependency_sets
(
set
.
podspec
)
end
end
...
...
lib/cocoa_pods/source.rb
View file @
08b71052
...
@@ -16,7 +16,7 @@ module Pod
...
@@ -16,7 +16,7 @@ module Pod
def
search
(
dependency
)
def
search
(
dependency
)
if
dir
=
@repo
.
children
.
find
{
|
c
|
c
.
basename
.
to_s
==
dependency
.
name
}
if
dir
=
@repo
.
children
.
find
{
|
c
|
c
.
basename
.
to_s
==
dependency
.
name
}
Specification
::
Set
.
new
(
dir
)
Specification
::
Set
.
by_pod_dir
(
dir
)
end
end
end
end
end
end
...
...
lib/cocoa_pods/specification.rb
View file @
08b71052
...
@@ -82,8 +82,19 @@ module Pod
...
@@ -82,8 +82,19 @@ module Pod
dep
dep
end
end
def
xcconfig
(
path
)
@xcconfig
=
path
end
# Not attributes
# Not attributes
# Returns the specification for the pod that this pod's source is a part of.
def
part_of_specification
if
@part_of
Set
.
by_specification_name
(
@part_of
.
name
).
podspec
end
end
# This also includes those that are only part of other specs, but are not
# This also includes those that are only part of other specs, but are not
# actually being used themselves.
# actually being used themselves.
def
resolved_dependent_specification_sets
def
resolved_dependent_specification_sets
...
@@ -96,25 +107,38 @@ module Pod
...
@@ -96,25 +107,38 @@ module Pod
# In case the set is only part of other pods we don't need to install
# In case the set is only part of other pods we don't need to install
# the pod itself.
# the pod itself.
next
if
set
.
only_part_of_other_pod?
next
if
set
.
only_part_of_other_pod?
set
.
podspec
.
install!
end
end
def
create_static_library!
puts
"==> Creating static library"
source_files
=
[]
resolved_dependent_specification_sets
.
each
do
|
set
|
# In case the set is only part of other pods we don't need to build
# the pod itself.
next
if
set
.
only_part_of_other_pod?
spec
=
set
.
podspec
spec
=
set
.
podspec
spec
.
install!
spec
.
read
(
:source_files
).
each
do
|
pattern
|
pattern
=
spec
.
pod_destroot
+
pattern
# In case spec is part of another pod we need to dowload the other
pattern
=
pattern
+
'*.{m,mm,c,cpp}'
if
pattern
.
directory?
# pod's source.
source_files
.
concat
(
Dir
.
glob
(
pattern
.
to_s
))
if
spec
.
part_of_other_pod?
# Find the specification of the pod that spec's source is a part of.
part_of_name
=
spec
.
read
(
:part_of
).
name
spec
=
sets
.
find
{
|
set
|
set
.
name
==
part_of_name
}.
podspec
end
end
spec
.
download_if_necessary!
end
end
#p source_files
load_paths
=
source_files
.
map
{
|
file
|
File
.
dirname
(
file
)
}.
uniq
#p load_paths
end
end
include
Config
::
Mixin
include
Config
::
Mixin
def
pod_destroot
def
pod_destroot
config
.
project_pods_root
+
"
#{
@name
}
-
#{
@version
}
"
if
part_of_other_pod?
part_of_specification
.
pod_destroot
else
config
.
project_pods_root
+
"
#{
@name
}
-
#{
@version
}
"
end
end
end
# Places the activated podspec in the project's pods directory.
# Places the activated podspec in the project's pods directory.
...
@@ -123,6 +147,10 @@ module Pod
...
@@ -123,6 +147,10 @@ module Pod
config
.
project_pods_root
.
mkpath
config
.
project_pods_root
.
mkpath
require
'fileutils'
require
'fileutils'
FileUtils
.
cp
(
@defined_in_file
,
config
.
project_pods_root
)
FileUtils
.
cp
(
@defined_in_file
,
config
.
project_pods_root
)
# In case this spec is part of another pod's source, we need to dowload
# the other pod's source.
(
spart_of_specification
||
self
).
download_if_necessary!
end
end
def
download_if_necessary!
def
download_if_necessary!
...
...
lib/cocoa_pods/specification/set.rb
View file @
08b71052
module
Pod
module
Pod
class
Specification
class
Specification
class
Set
class
Set
def
self
.
sets
@sets
||=
{}
end
def
self
.
by_specification_name
(
name
)
sets
[
name
]
end
# This keeps an identity map of sets so that you always get the same Set
# instance for the same pod directory.
def
self
.
by_pod_dir
(
pod_dir
)
set
=
new
(
pod_dir
)
sets
[
set
.
name
]
||=
set
sets
[
set
.
name
]
end
def
initialize
(
pod_dir
)
def
initialize
(
pod_dir
)
@pod_dir
=
pod_dir
@pod_dir
=
pod_dir
@required_by
=
[]
@required_by
=
[]
...
...
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