Package net.sf.antcontrib.cpptasks.apple
Class XcodeProjectWriter
java.lang.Object
net.sf.antcontrib.cpptasks.apple.XcodeProjectWriter
- All Implemented Interfaces:
ProjectWriter
Writes a Apple Xcode 2.1+ project directory. XCode stores project
configuration as a PropertyList. Though it will always write the project
as a Cocoa Old-Style ASCII property list, it will read projects
stored using Cocoa's XML Property List format.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Represents a property map with an 96 bit identity. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate XcodeProjectWriter.PBXObjectRef
addDependency
(Map objects, XcodeProjectWriter.PBXObjectRef project, List mainGroupChildren, String baseDir, DependencyDef dependency) Adds a dependency to the object graph.private XcodeProjectWriter.PBXObjectRef
addDocumentationGroup
(Map objects, String sourceTree) Add documentation group to map of objects.private XcodeProjectWriter.PBXObjectRef
addNativeTarget
(Map objects, TargetInfo linkTarget, XcodeProjectWriter.PBXObjectRef product, String projectName, List sourceGroupChildren, List frameworkBuildFiles) Add native target to map of objects.private XcodeProjectWriter.PBXObjectRef
addNativeTargetConfigurationList
(Map objects, String projectName) Add native target configuration list.private XcodeProjectWriter.PBXObjectRef
addProduct
(Map objects, TargetInfo linkTarget) Add file reference of product to map of objects.private XcodeProjectWriter.PBXObjectRef
addProjectConfigurationList
(Map objects, String baseDir, List dependencies, CommandLineCompilerConfiguration compilerConfig, CommandLineLinkerConfiguration linkerConfig) Add project configuration list.private List
addSources
(Map objects, String sourceTree, String basePath, Hashtable targets) Add file references for all source files to map of objects.private static XcodeProjectWriter.PBXObjectRef
createPBXBuildFile
(XcodeProjectWriter.PBXObjectRef fileRef, Map settings) Create PBXBuildFile.private static XcodeProjectWriter.PBXObjectRef
createPBXContainerItemProxy
(XcodeProjectWriter.PBXObjectRef containerPortal, int proxyType, String remoteInfo) Create a proxy for a file in a different project.private static XcodeProjectWriter.PBXObjectRef
createPBXCopyFilesBuildPhase
(int buildActionMask, String dstPath, String dstSubfolderSpec, List files, boolean runOnly) Create a build phase that copies files to a destination.private static XcodeProjectWriter.PBXObjectRef
createPBXFileReference
(String sourceTree, String baseDir, File file) Create PBXFileReference.private static XcodeProjectWriter.PBXObjectRef
createPBXFrameworksBuildPhase
(int buildActionMask, List files, boolean runOnly) Create PBXFrameworksBuildPhase.private static XcodeProjectWriter.PBXObjectRef
createPBXGroup
(String name, String sourceTree, List children) Create PBXGroup.private static XcodeProjectWriter.PBXObjectRef
createPBXNativeTarget
(String name, XcodeProjectWriter.PBXObjectRef buildConfigurationList, List buildPhases, List buildRules, List dependencies, String productInstallPath, String productName, XcodeProjectWriter.PBXObjectRef productReference, String productType) Create PBXNativeTarget.private static XcodeProjectWriter.PBXObjectRef
createPBXProject
(XcodeProjectWriter.PBXObjectRef buildConfigurationList, XcodeProjectWriter.PBXObjectRef mainGroup, String projectDirPath, String projectRoot, List targets) Create PBXProject.private static XcodeProjectWriter.PBXObjectRef
createPBXReferenceProxy
(XcodeProjectWriter.PBXObjectRef remoteRef, DependencyDef dependency) Create a proxy for a file in a different project.private static XcodeProjectWriter.PBXObjectRef
createPBXSourcesBuildPhase
(int buildActionMask, List files, boolean runOnly) Create PBXSourcesBuildPhase.private static XcodeProjectWriter.PBXObjectRef
createXCBuildConfiguration
(String name, Map buildSettings) Create XCBuildConfiguration.private static XcodeProjectWriter.PBXObjectRef
createXCConfigurationList
(List buildConfigurations) Create XCConfigurationList.private CommandLineCompilerConfiguration
getBaseCompilerConfiguration
(Hashtable targets) Gets the first recognized compiler from the compilation targets.private String
getFileType
(TargetInfo linkTarget) private String
getProductType
(TargetInfo linkTarget) private int
getProductTypeIndex
(TargetInfo linkTarget) private static String
toString
(boolean b) Method returns "1" for true, "0" for false.void
writeProject
(File fileName, CCTask task, ProjectDef projectDef, List sources, Hashtable targets, TargetInfo linkTarget) Writes a project definition file.
-
Constructor Details
-
XcodeProjectWriter
public XcodeProjectWriter()Constructor.
-
-
Method Details
-
writeProject
public void writeProject(File fileName, CCTask task, ProjectDef projectDef, List sources, Hashtable targets, TargetInfo linkTarget) throws IOException Writes a project definition file.- Specified by:
writeProject
in interfaceProjectWriter
- Parameters:
fileName
- File name base, writer may append appropriate extensiontask
- cc task for which to write projectprojectDef
- project elementsources
- source and header filestargets
- compilation targetslinkTarget
- link target- Throws:
IOException
- if error writing project file
-
addDependency
private XcodeProjectWriter.PBXObjectRef addDependency(Map objects, XcodeProjectWriter.PBXObjectRef project, List mainGroupChildren, String baseDir, DependencyDef dependency) Adds a dependency to the object graph.- Parameters:
objects
-project
-mainGroupChildren
-baseDir
-dependency
-- Returns:
- PBXBuildFile to add to PBXFrameworksBuildPhase.
-
addDocumentationGroup
Add documentation group to map of objects.- Parameters:
objects
- object map.sourceTree
- source tree description.- Returns:
- documentation group.
-
addProduct
Add file reference of product to map of objects.- Parameters:
objects
- object map.linkTarget
- build description for executable or shared library.- Returns:
- file reference to generated executable or shared library.
-
addSources
Add file references for all source files to map of objects.- Parameters:
objects
- map of objects.sourceTree
- source tree.basePath
- parent of XCode project dirtargets
- build targets.- Returns:
- list containing file references of source files.
-
addNativeTargetConfigurationList
private XcodeProjectWriter.PBXObjectRef addNativeTargetConfigurationList(Map objects, String projectName) Add native target configuration list.- Parameters:
objects
- map of objects.projectName
- project name.- Returns:
- build configurations for native target.
-
addProjectConfigurationList
private XcodeProjectWriter.PBXObjectRef addProjectConfigurationList(Map objects, String baseDir, List dependencies, CommandLineCompilerConfiguration compilerConfig, CommandLineLinkerConfiguration linkerConfig) Add project configuration list.- Parameters:
objects
- map of objects.baseDir
- base directory.compilerConfig
- compiler configuration.- Returns:
- project configuration object.
-
addNativeTarget
private XcodeProjectWriter.PBXObjectRef addNativeTarget(Map objects, TargetInfo linkTarget, XcodeProjectWriter.PBXObjectRef product, String projectName, List sourceGroupChildren, List frameworkBuildFiles) Add native target to map of objects.- Parameters:
objects
- map of objects.linkTarget
- description of executable or shared library.product
- product.projectName
- project name.sourceGroupChildren
- source files needed to build product.- Returns:
- native target.
-
getProductTypeIndex
-
getProductType
-
getFileType
-
createPBXFileReference
private static XcodeProjectWriter.PBXObjectRef createPBXFileReference(String sourceTree, String baseDir, File file) Create PBXFileReference.- Parameters:
sourceTree
- source tree.baseDir
- base directory.file
- file.- Returns:
- PBXFileReference object.
-
createPBXGroup
private static XcodeProjectWriter.PBXObjectRef createPBXGroup(String name, String sourceTree, List children) Create PBXGroup.- Parameters:
name
- group name.sourceTree
- source tree.children
- list of PBXFileReferences.- Returns:
- group.
-
createPBXProject
private static XcodeProjectWriter.PBXObjectRef createPBXProject(XcodeProjectWriter.PBXObjectRef buildConfigurationList, XcodeProjectWriter.PBXObjectRef mainGroup, String projectDirPath, String projectRoot, List targets) Create PBXProject.- Parameters:
buildConfigurationList
- build configuration list.mainGroup
- main group.projectDirPath
- project directory path.projectRoot
- projectRoot directory relative totargets
- targets.- Returns:
- project.
-
createXCConfigurationList
Create XCConfigurationList.- Parameters:
buildConfigurations
- build configurations.- Returns:
- configuration list.
-
createXCBuildConfiguration
private static XcodeProjectWriter.PBXObjectRef createXCBuildConfiguration(String name, Map buildSettings) Create XCBuildConfiguration.- Parameters:
name
- name.buildSettings
- build settings.- Returns:
- build configuration.
-
createPBXNativeTarget
private static XcodeProjectWriter.PBXObjectRef createPBXNativeTarget(String name, XcodeProjectWriter.PBXObjectRef buildConfigurationList, List buildPhases, List buildRules, List dependencies, String productInstallPath, String productName, XcodeProjectWriter.PBXObjectRef productReference, String productType) Create PBXNativeTarget.- Parameters:
name
- name.buildConfigurationList
- build configuration list.buildPhases
- build phases.buildRules
- build rules.dependencies
- dependencies.productInstallPath
- product install path.productName
- product name.productReference
- file reference for product.productType
- product type.- Returns:
- native target.
-
createPBXSourcesBuildPhase
private static XcodeProjectWriter.PBXObjectRef createPBXSourcesBuildPhase(int buildActionMask, List files, boolean runOnly) Create PBXSourcesBuildPhase.- Parameters:
buildActionMask
- build action mask.files
- source files.runOnly
- if true, phase should only be run on deployment.- Returns:
- PBXSourcesBuildPhase.
-
createPBXBuildFile
private static XcodeProjectWriter.PBXObjectRef createPBXBuildFile(XcodeProjectWriter.PBXObjectRef fileRef, Map settings) Create PBXBuildFile.- Parameters:
fileRef
- source file.settings
- build settings.- Returns:
- PBXBuildFile.
-
createPBXFrameworksBuildPhase
private static XcodeProjectWriter.PBXObjectRef createPBXFrameworksBuildPhase(int buildActionMask, List files, boolean runOnly) Create PBXFrameworksBuildPhase.- Parameters:
buildActionMask
- build action mask.files
- files.runOnly
- if true, phase should only be run on deployment.- Returns:
- PBXFrameworkBuildPhase.
-
createPBXCopyFilesBuildPhase
private static XcodeProjectWriter.PBXObjectRef createPBXCopyFilesBuildPhase(int buildActionMask, String dstPath, String dstSubfolderSpec, List files, boolean runOnly) Create a build phase that copies files to a destination.- Parameters:
buildActionMask
- build action mask.dstPath
- destination path.dstSubfolderSpec
- subfolder spec.files
- files.runOnly
- if true, phase should only be run on deployment.- Returns:
- PBXCopyFileBuildPhase.
-
createPBXContainerItemProxy
private static XcodeProjectWriter.PBXObjectRef createPBXContainerItemProxy(XcodeProjectWriter.PBXObjectRef containerPortal, int proxyType, String remoteInfo) Create a proxy for a file in a different project.- Parameters:
containerPortal
- XcodeProject containing file.proxyType
- proxy type.- Returns:
- PBXContainerItemProxy.
-
createPBXReferenceProxy
private static XcodeProjectWriter.PBXObjectRef createPBXReferenceProxy(XcodeProjectWriter.PBXObjectRef remoteRef, DependencyDef dependency) Create a proxy for a file in a different project.- Parameters:
remoteRef
- PBXContainerItemProxy for reference.dependency
- dependency.- Returns:
- PBXContainerItemProxy.
-
toString
Method returns "1" for true, "0" for false.- Parameters:
b
- boolean value.- Returns:
- "1" for true, "0" for false.
-
getBaseCompilerConfiguration
Gets the first recognized compiler from the compilation targets.- Parameters:
targets
- compilation targets- Returns:
- representative (hopefully) compiler configuration
-