Skip to main content

XcodeProjectUtility Class

Convenience utilities for working with an exported Xcode project. More...

Public Member Functions

 XcodeProjectUtility (string projectPath)
 Instantiates a new instance of the XcodeProjectUtility class. More...
 
void WriteToDisk ()
 Writes any modifications to disk.
 
void AddFile (string filePath, string projectPath)
 Adds a file to the project. More...
 
void AddDirectory (string directoryPath, string projectPath)
 Adds a directory reference to the project. More...
 
void AddFramework (string framework, bool weak)
 Adds a framework (by name) to the project. More...
 
void AddCustomFramework (DirectoryInfo framework, bool embed=true)
 Adds a custom framework (like an .xcframework) to the project. More...
 
void AddBuildProperty (string name, string value)
 Appends a value to a property's list of values. More...
 
void SetBuildProperty (string name, string value)
 Sets the value of a property. Any existing value(s) will be replaced. More...
 
void AddShellScriptBuildPhase (string shellPath, string shellScript, List< string > inputPaths=null, string name="Run Script")
 Adds a build phase that executes a shell script. More...
 
void SetEntitlementsFile (string entitlementsPath)
 Sets the entitlements file for this project. More...
 

Public Attributes

readonly PBXProject pbxProject
 
readonly PlistDocument plist
 
readonly string pbxProjectPath
 
readonly string resourcesPath
 
readonly string plistPath
 
readonly string projectRoot
 
string targetGuid
 
readonly string frameworkGuid
 
readonly string BFGEnviron = IosBuildConstants.DefaultBfgEnvironment
 
readonly string FacebookDisplayName = "${PRODUCT_NAME}"
 
readonly string FacebookAppID = "1564213973726672"
 
readonly string crashlyticsShellScript
 
readonly string crashlyticsShellPath = "/bin/bash -e"
 
readonly string crashlyticsScriptName = "Run Script"
 
readonly Dictionary< string, string > urlSettings
 
readonly string[] bfgExceptionDomains = IosBuildConstants.BFGExceptionDomains
 
readonly string[] lsApplicationQueries = IosBuildConstants.LSApplicationQueries
 
readonly string[] frameworks
 
readonly string bfgSDKFramework = "bfg_iOS_sdk.framework"
 
readonly string[] dynamicFrameworks
 
readonly string[] facebookFrameworks
 
readonly string[] zendeskFrameworks
 

Properties

static string UnityTargetName [get]
 Main target generated by Unity.
 

Detailed Description

Convenience utilities for working with an exported Xcode project. This is oddly named, but is kept for compatibility. To use, construct an instance by providing the path to an exported Xcode project, manipulate as needed by using the mutator instance methods, then flush to disk using the WriteToDisk method.

Constructor & Destructor Documentation

◆ XcodeProjectUtility()

XcodeProjectUtility.XcodeProjectUtility (string projectPath)
inline
Instantiates a new instance of the XcodeProjectUtility class.
Parameters
projectPathPath to which Unity has exported an Xcode project.

Member Function Documentation

◆ AddBuildProperty()

void XcodeProjectUtility.AddBuildProperty (string name,
string value 
)
inline
Appends a value to a property's list of values.
Parameters
nameProperty name.
valueProperty value to add.

◆ AddCustomFramework()

void XcodeProjectUtility.AddCustomFramework (DirectoryInfo framework,
bool embed = true 
)
inline
Adds a custom framework (like an .xcframework) to the project.
Parameters
frameworkDirectory that represents the framework.
embedWhether the framework needs to be embedded.
Exceptions
ArgumentNullExceptionframework is null.
IOExceptionSpecified framework directory was not found.

◆ AddDirectory()

void XcodeProjectUtility.AddDirectory (string directoryPath,
string projectPath 
)
inline
Adds a directory reference to the project.
Parameters
directoryPathPath to the real directory.
projectPathHow the directory will appear in the workspace.
Exceptions
ArgumentExceptiondirectoryPath could not be found.

◆ AddFile()

void XcodeProjectUtility.AddFile (string filePath,
string projectPath 
)
inline
Adds a file to the project.
Parameters
filePathPath to the real file.
projectPathHow the file will appear in the workspace.
Exceptions
ArgumentExceptionfilePath could not be found.

◆ AddFramework()

void XcodeProjectUtility.AddFramework (string framework,
bool weak 
)
inline
Adds a framework (by name) to the project.
Parameters
frameworkName of the framework to add.
weakWhether the framework will be added as a weak link.

◆ AddShellScriptBuildPhase()

void XcodeProjectUtility.AddShellScriptBuildPhase (string shellPath,
string shellScript,
List< string > inputPaths = null,
string name = "Run Script" 
)
inline
Adds a build phase that executes a shell script.
Parameters
shellPathPath to the shell to use, along with any shell arguments (like '-e').
shellScriptScript contents.
inputPathsThe shell script input dependencies.
nameOptional name to give the build phase.

◆ SetBuildProperty()

void XcodeProjectUtility.SetBuildProperty (string name,
string value 
)
inline
Sets the value of a property. Any existing value(s) will be replaced.
Parameters
nameProperty name.
valueProperty value to use.

◆ SetEntitlementsFile()

void XcodeProjectUtility.SetEntitlementsFile (string entitlementsPath)
inline
Sets the entitlements file for this project.
Parameters
entitlementsPathPath to the real entitlements file.
Exceptions
ArgumentExceptionentitlementsPath could not be found.

Member Data Documentation

◆ BFGEnviron

readonly string XcodeProjectUtility.BFGEnviron = IosBuildConstants.DefaultBfgEnvironment
Deprecated:\n Use instead.

◆ bfgExceptionDomains

readonly string [] XcodeProjectUtility.bfgExceptionDomains = IosBuildConstants.BFGExceptionDomains
Deprecated:\n Use instead.

◆ bfgSDKFramework

readonly string XcodeProjectUtility.bfgSDKFramework = "bfg_iOS_sdk.framework"
Deprecated:\n Unused - Will be removed in a future version.

◆ crashlyticsScriptName

readonly string XcodeProjectUtility.crashlyticsScriptName = "Run Script"
Deprecated:\n The Firebase SDK now attaches the run script automatically.

◆ crashlyticsShellPath

readonly string XcodeProjectUtility.crashlyticsShellPath = "/bin/bash -e"
Deprecated:\n The Firebase SDK now attaches the run script automatically.

◆ crashlyticsShellScript

readonly string XcodeProjectUtility.crashlyticsShellScript
Initial value:
=
"GOOGLE_SERVICE_PLIST=&quot;${SRCROOT}/GoogleService-Info.plist&quot;\n" +
"&quot;${PROJECT_DIR}/Resources/Scripts/upload-symbols&quot; -gsp &quot;${GOOGLE_SERVICE_PLIST}&quot; --build-phase"
Deprecated:\n The Firebase SDK now attaches the run script automatically.

◆ dynamicFrameworks

readonly string [] XcodeProjectUtility.dynamicFrameworks
Initial value:
= {
"AppsFlyerLib.framework",
"openssl.framework",
"RaveSocial.framework",
"WebP.framework"
}
Deprecated:\n Unused - Will be removed in a future version.

◆ FacebookAppID

readonly string XcodeProjectUtility.FacebookAppID = "1564213973726672"
Deprecated:\n Use what's defined in your project's instead.

◆ FacebookDisplayName

readonly string XcodeProjectUtility.FacebookDisplayName = "${PRODUCT_NAME}"
Deprecated:\n Use what's defined in your project's instead.

◆ facebookFrameworks

readonly string [] XcodeProjectUtility.facebookFrameworks
Initial value:
= {
"FBSDKCoreKit.framework",
"FBSDKLoginKit.framework",
"FBSDKPlacesKit.framework",
"FBSDKShareKit.framework"
}
Deprecated:\n Unused - Will be removed in a future version.

◆ frameworks

readonly string [] XcodeProjectUtility.frameworks
Initial value:
=
IosBuildConstants.Frameworks.Concat(IosBuildConstants.WeakFrameworks).ToArray()
Deprecated:\n Use and
BFGSDK.BuildProcessing.IosBuildConstants.WeakFrameworks instead.

◆ lsApplicationQueries

readonly string [] XcodeProjectUtility.lsApplicationQueries = IosBuildConstants.LSApplicationQueries
Deprecated:\n Use instead.

◆ urlSettings

readonly Dictionary<string, string> XcodeProjectUtility.urlSettings
Deprecated:\n No longer maintained; formerly a combination of
BFGSDK.BuildProcessing.IosBuildConstants.BaselinePlistValues and project-specific environment/Facebook settings.

◆ zendeskFrameworks

readonly string [] XcodeProjectUtility.zendeskFrameworks
Initial value:
= {
"CommonUISDK.framework",
"MessagingAPI.framework",
"MessagingSDK.framework",
"SDKConfigurations.framework",
"SupportProvidersSDK.framework",
"SupportSDK.framework",
"ZendeskCoreSDK.framework"
}
Deprecated:\n Unused - Will be removed in a future version.