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
3d3ab979
Commit
3d3ab979
authored
May 21, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Target] Refactor file structure
parent
9b3de5a8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
167 deletions
+171
-167
cocoapods.rb
lib/cocoapods.rb
+5
-4
target.rb
lib/cocoapods/target.rb
+1
-163
pod_target.rb
lib/cocoapods/target/pod_target.rb
+113
-0
spec_target.rb
lib/cocoapods/target/spec_target.rb
+52
-0
No files found.
lib/cocoapods.rb
View file @
3d3ab979
...
...
@@ -44,8 +44,9 @@ module Pod
autoload
:ExternalSources
,
'cocoapods/external_sources'
autoload
:Installer
,
'cocoapods/installer'
autoload
:SourcesManager
,
'cocoapods/sources_manager'
autoload
:PodTarget
,
'cocoapods/target'
autoload
:SpecTarget
,
'cocoapods/target'
autoload
:Target
,
'cocoapods/target'
autoload
:PodTarget
,
'cocoapods/target/pod_target'
autoload
:SpecTarget
,
'cocoapods/target/spec_target'
autoload
:Project
,
'cocoapods/project'
autoload
:Resolver
,
'cocoapods/resolver'
autoload
:Sandbox
,
'cocoapods/sandbox'
...
...
@@ -54,11 +55,11 @@ module Pod
module
Generator
autoload
:Acknowledgements
,
'cocoapods/generator/acknowledgements'
autoload
:Markdown
,
'cocoapods/generator/acknowledgements/markdown'
autoload
:Plist
,
'cocoapods/generator/acknowledgements/plist'
autoload
:BridgeSupport
,
'cocoapods/generator/bridge_support'
autoload
:CopyResourcesScript
,
'cocoapods/generator/copy_resources_script'
autoload
:DummySource
,
'cocoapods/generator/dummy_source'
autoload
:Markdown
,
'cocoapods/generator/acknowledgements/markdown'
autoload
:Plist
,
'cocoapods/generator/acknowledgements/plist'
autoload
:PrefixHeader
,
'cocoapods/generator/prefix_header'
autoload
:TargetEnvironmentHeader
,
'cocoapods/generator/target_environment_header'
autoload
:PodXCConfig
,
'cocoapods/generator/xcconfig'
...
...
lib/cocoapods/target.rb
View file @
3d3ab979
...
...
@@ -6,7 +6,7 @@ module Pod
# working with a target in the Podfile and it's dependent libraries.
# This class is used to represent both the targets and their libraries.
#
class
Abstract
Target
class
Target
# @return [PBXNativeTarget] the target definition of the Podfile that
# generated this target.
...
...
@@ -105,169 +105,7 @@ module Pod
support_files_root
+
"
#{
label
}
-dummy.m"
end
end
#---------------------------------------------------------------------------#
class
PodTarget
<
AbstractTarget
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
def
initialize
(
target_definition
,
sandbox
)
@target_definition
=
target_definition
@sandbox
=
sandbox
@libraries
=
[]
@file_accessors
=
[]
end
# @return [String] the label for the library.
#
def
label
target_definition
.
label
.
to_s
end
# @return [Pathname] the folder where the client is stored used for
# computing the relative paths. If integrating it should be the
# folder where the user project is stored, otherwise it should
# be the installation root.
#
attr_accessor
:client_root
# @return [Pathname] the path of the user project that this library will
# integrate as identified by the analyzer.
#
# @note The project instance is not stored to prevent editing different
# instances.
#
attr_accessor
:user_project_path
# @return [String] the list of the UUIDs of the user targets that will be
# integrated by this library as identified by the analizer.
#
# @note The target instances are not stored to prevent editing different
# instances.
#
attr_accessor
:user_target_uuids
# @return [Xcodeproj::Config] the configuration file of the library
#
# @note The configuration is generated by the {TargetInstaller} and
# used by {UserProjectIntegrator} to check for any overridden
# values.
#
attr_accessor
:xcconfig
# @return [Array<SpecTarget>] the dependencies for this target (or library).
#
attr_accessor
:libraries
# @return [Pathname] the absolute path of acknowledgements file.
#
# @note The acknowledgements generators add the extension according to
# the file type.
#
def
acknowledgements_basepath
support_files_root
+
"
#{
label
}
-acknowledgements"
end
# @return [Pathname] the absolute path of the copy resources script.
#
def
copy_resources_script_path
support_files_root
+
"
#{
label
}
-resources.sh"
end
# @return [String] The xcconfig path of the root from the `$(SRCROOT)`
# variable of the user's project.
#
def
relative_pods_root
"${SRCROOT}/
#{
support_files_root
.
relative_path_from
(
client_root
)
}
"
end
# @return [String] the path of the xcconfig file relative to the root of
# the user project.
#
def
xcconfig_relative_path
relative_to_srcroot
(
xcconfig_path
).
to_s
end
# @return [String] the path of the copy resources script relative to the
# root of the user project.
#
def
copy_resources_script_relative_path
"${SRCROOT}/
#{
relative_to_srcroot
(
copy_resources_script_path
)
}
"
end
#-------------------------------------------------------------------------#
# @!group Private Helpers
private
# Computes the relative path of a sandboxed file from the `$(SRCROOT)`
# variable of the user's project.
#
# @param [Pathname] path
# A relative path from the root of the sandbox.
#
# @return [String] the computed path.
#
def
relative_to_srcroot
(
path
)
path
.
relative_path_from
(
client_root
).
to_s
end
end
#---------------------------------------------------------------------------#
class
SpecTarget
<
AbstractTarget
# @return [Specification] the spec for the target.
#
attr_reader
:spec
# @return [HeadersStore] the header directory for the library.
#
attr_reader
:build_headers
# @param [Specification] spec @see spec
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
def
initialize
(
spec
,
target_definition
,
sandbox
)
@spec
=
spec
@target_definition
=
target_definition
@sandbox
=
sandbox
@build_headers
=
Sandbox
::
HeadersStore
.
new
(
sandbox
,
"BuildHeaders"
)
@file_accessors
=
[]
end
# @return [String] the label for the library.
#
def
label
"
#{
target_definition
.
label
.
to_s
}
-
#{
spec
.
name
.
gsub
(
'/'
,
'-'
)
}
"
end
# @return [Specification] the specification for this library.
#
attr_accessor
:spec
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
# specifications of this library.
#
attr_accessor
:file_accessors
#--------------------------------------#
# @return [Specification::Consumer] the specification consumer for the
# library.
#
def
consumer
spec
.
consumer
(
platform
)
end
end
#---------------------------------------------------------------------------#
end
lib/cocoapods/target/pod_target.rb
0 → 100644
View file @
3d3ab979
module
Pod
class
PodTarget
<
Target
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
def
initialize
(
target_definition
,
sandbox
)
@target_definition
=
target_definition
@sandbox
=
sandbox
@libraries
=
[]
@file_accessors
=
[]
end
# @return [String] the label for the library.
#
def
label
target_definition
.
label
.
to_s
end
# @return [Pathname] the folder where the client is stored used for
# computing the relative paths. If integrating it should be the
# folder where the user project is stored, otherwise it should
# be the installation root.
#
attr_accessor
:client_root
# @return [Pathname] the path of the user project that this library will
# integrate as identified by the analyzer.
#
# @note The project instance is not stored to prevent editing different
# instances.
#
attr_accessor
:user_project_path
# @return [String] the list of the UUIDs of the user targets that will be
# integrated by this library as identified by the analizer.
#
# @note The target instances are not stored to prevent editing different
# instances.
#
attr_accessor
:user_target_uuids
# @return [Xcodeproj::Config] the configuration file of the library
#
# @note The configuration is generated by the {TargetInstaller} and
# used by {UserProjectIntegrator} to check for any overridden
# values.
#
attr_accessor
:xcconfig
# @return [Array<SpecTarget>] the dependencies for this target (or library).
#
attr_accessor
:libraries
# @return [Pathname] the absolute path of acknowledgements file.
#
# @note The acknowledgements generators add the extension according to
# the file type.
#
def
acknowledgements_basepath
support_files_root
+
"
#{
label
}
-acknowledgements"
end
# @return [Pathname] the absolute path of the copy resources script.
#
def
copy_resources_script_path
support_files_root
+
"
#{
label
}
-resources.sh"
end
# @return [String] The xcconfig path of the root from the `$(SRCROOT)`
# variable of the user's project.
#
def
relative_pods_root
"${SRCROOT}/
#{
support_files_root
.
relative_path_from
(
client_root
)
}
"
end
# @return [String] the path of the xcconfig file relative to the root of
# the user project.
#
def
xcconfig_relative_path
relative_to_srcroot
(
xcconfig_path
).
to_s
end
# @return [String] the path of the copy resources script relative to the
# root of the user project.
#
def
copy_resources_script_relative_path
"${SRCROOT}/
#{
relative_to_srcroot
(
copy_resources_script_path
)
}
"
end
#-------------------------------------------------------------------------#
# @!group Private Helpers
private
# Computes the relative path of a sandboxed file from the `$(SRCROOT)`
# variable of the user's project.
#
# @param [Pathname] path
# A relative path from the root of the sandbox.
#
# @return [String] the computed path.
#
def
relative_to_srcroot
(
path
)
path
.
relative_path_from
(
client_root
).
to_s
end
#-------------------------------------------------------------------------#
end
end
lib/cocoapods/target/spec_target.rb
0 → 100644
View file @
3d3ab979
module
Pod
class
SpecTarget
<
Target
# @return [Specification] the spec for the target.
#
attr_reader
:spec
# @return [HeadersStore] the header directory for the library.
#
attr_reader
:build_headers
# @param [Specification] spec @see spec
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
def
initialize
(
spec
,
target_definition
,
sandbox
)
@spec
=
spec
@target_definition
=
target_definition
@sandbox
=
sandbox
@build_headers
=
Sandbox
::
HeadersStore
.
new
(
sandbox
,
"BuildHeaders"
)
@file_accessors
=
[]
end
# @return [String] the label for the library.
#
def
label
"
#{
target_definition
.
label
.
to_s
}
-
#{
spec
.
name
.
gsub
(
'/'
,
'-'
)
}
"
end
# @return [Specification] the specification for this library.
#
attr_accessor
:spec
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
# specifications of this library.
#
attr_accessor
:file_accessors
#-------------------------------------------------------------------------#
# @return [Specification::Consumer] the specification consumer for the
# library.
#
def
consumer
spec
.
consumer
(
platform
)
end
#-------------------------------------------------------------------------#
end
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