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
14cb718f
Commit
14cb718f
authored
Oct 30, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually create a new PBXNativeTarget instance and set the defaults.
parent
183f2551
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
project.rb
lib/cocoapods/xcode/project.rb
+31
-6
project_spec.rb
spec/unit/xcode/project_spec.rb
+5
-2
No files found.
lib/cocoapods/xcode/project.rb
View file @
14cb718f
...
...
@@ -86,13 +86,20 @@ module Pod
def
initialize
(
project
,
uuid
,
attributes
)
is_new
=
uuid
.
nil?
super
self
.
name
||=
pathname
.
basename
.
to_s
self
.
path
=
path
if
path
# sets default name
self
.
sourceTree
||=
'SOURCE_ROOT'
if
is_new
@project
.
build_files
.
new
.
file
=
self
end
end
alias_method
:_path
=
,
:path
=
def
path
=
(
path
)
self
.
_path
=
path
self
.
name
||=
pathname
.
basename
.
to_s
path
end
def
pathname
Pathname
.
new
(
path
)
end
...
...
@@ -190,6 +197,8 @@ module Pod
end
class
PBXNativeTarget
<
PBXObject
STATIC_LIBRARY
=
'com.apple.product-type.library.static'
attributes
:productName
,
:productType
has_many
:buildPhases
,
:class
=>
PBXBuildPhase
...
...
@@ -198,12 +207,28 @@ module Pod
has_one
:buildConfigurationList
has_one
:product
,
:uuid
=>
:productReference
def
initialize
(
project
,
uuid
,
attributes
)
def
initialize
(
project
,
*
)
super
self
.
buildPhaseReferences
||=
[]
# TODO self.buildConfigurationList ||= new list?
self
.
buildRuleReferences
||=
[]
self
.
dependencyReferences
||=
[]
self
.
buildPhaseReferences
||=
[]
self
.
buildRuleReferences
||=
[]
self
.
dependencyReferences
||=
[]
unless
buildConfigurationList
self
.
buildConfigurationList
=
project
.
objects
.
add
(
XCConfigurationList
)
# TODO or should this happen in buildConfigurationList?
buildConfigurationList
.
buildConfigurations
.
new
(
'name'
=>
'Debug'
)
buildConfigurationList
.
buildConfigurations
.
new
(
'name'
=>
'Release'
)
end
unless
product
self
.
product
=
project
.
objects
.
add
(
PBXFileReference
,
'sourceTree'
=>
'BUILT_PRODUCTS_DIR'
)
case
productType
when
STATIC_LIBRARY
product
.
path
=
"lib
#{
productName
}
.a"
product
.
includeInIndex
=
"0"
# no idea what this is
product
.
explicitFileType
=
"archive.ar"
end
end
end
end
...
...
spec/unit/xcode/project_spec.rb
View file @
14cb718f
...
...
@@ -133,10 +133,13 @@ describe "Pod::Xcode::Project" do
describe
"a new PBXNativeTarget"
do
before
do
@target
=
@project
.
targets
.
first
@target
=
@project
.
targets
.
new
({
'productName'
=>
'Pods'
,
'productType'
=>
Pod
::
Xcode
::
Project
::
PBXNativeTarget
::
STATIC_LIBRARY
})
end
it
"returns the product name, which is the name of the binary"
do
it
"returns the product name, which is the name of the binary
(minus prefix/suffix)
"
do
@target
.
productName
.
should
==
"Pods"
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