Documentation ¶
Overview ¶
Example ¶
project, err := Open("project.xcodeproj") if err != nil { panic(err) } for _, target := range project.Proj.Targets { fmt.Printf("%s target default configuration: %s\n", target.Name, target.BuildConfigurationList.DefaultConfigurationName) buildConfiguration := target.BuildConfigurationList.BuildConfigurations[0] bundleID := buildConfiguration.BuildSettings["PRODUCT_BUNDLE_IDENTIFIER"] fmt.Printf("%s target bundle id: %s\n", target.Name, bundleID) } schemes, err := project.Schemes() if err != nil { panic(err) } for _, scheme := range schemes { entry := scheme.BuildAction.BuildActionEntries[0] targetID := entry.BuildableReference.BlueprintIdentifier target, ok := project.Proj.Target(targetID) if ok { fmt.Printf("%s scheme's main target: %s\n", scheme.Name, target.Name) } }
Output:
Index ¶
- Constants
- func IsXcodeProj(pth string) bool
- func ReadPlistFile(path string) (serialized.Object, int, error)
- func WritePlistFile(path string, entitlements serialized.Object, format int) error
- type BuildConfiguration
- type ConfigurationList
- type ProductReference
- type Proj
- type ProjectAtributes
- type Target
- func (t Target) DependsOn(targetID string) bool
- func (t Target) IsAppClipProduct() bool
- func (t Target) IsAppExtensionProduct() bool
- func (t Target) IsAppProduct() bool
- func (t Target) IsExecutableProduct() bool
- func (t Target) IsTest() bool
- func (t Target) IsTestProduct() bool
- func (t Target) IsUITestProduct() bool
- type TargetDependency
- type TargetType
- type TargetsToAppIconSets
- type XcodeProj
- func (p XcodeProj) Attributes() (serialized.Object, error)
- func (p XcodeProj) BuildConfigurationList(targetID string) (serialized.Object, error)
- func (p XcodeProj) BuildConfigurations(buildConfigurationList serialized.Object) ([]serialized.Object, error)
- func (p XcodeProj) DependentTargetsOfTarget(target Target) []Target
- func (p *XcodeProj) ForceCodeSign(configuration, targetName, developmentTeam, codesignIdentity, ... string) error
- func (p XcodeProj) ForceTargetBundleID(target, configuration, bundleID string) error
- func (p XcodeProj) ForceTargetCodeSignEntitlement(target, configuration, entitlement string, value interface{}) error
- func (p XcodeProj) ReCreateSchemes() []xcscheme.Scheme
- func (p XcodeProj) ReadTargetInfoplist(target, configuration string) (serialized.Object, int, error)
- func (p XcodeProj) Save() error
- func (p XcodeProj) SaveSharedScheme(scheme xcscheme.Scheme) error
- func (p XcodeProj) Scheme(name string) (*xcscheme.Scheme, string, error)
- func (p XcodeProj) Schemes() ([]xcscheme.Scheme, error)
- func (p XcodeProj) SchemesWithAutocreateEnabled(isAutocreateSchemesEnabled bool) ([]xcscheme.Scheme, error)
- func (p XcodeProj) TargetAttributes() (serialized.Object, error)
- func (p XcodeProj) TargetBuildSettings(target, configuration string, customOptions ...string) (serialized.Object, error)
- func (p XcodeProj) TargetBundleID(target, configuration string) (string, error)
- func (p XcodeProj) TargetCodeSignEntitlements(target, configuration string) (serialized.Object, error)
- func (p XcodeProj) TargetCodeSignEntitlementsPath(target, configuration string) (string, error)
- func (p XcodeProj) TargetInfoplistPath(target, configuration string) (string, error)
- func (p XcodeProj) WriteTargetInfoplist(infoplist serialized.Object, format int, target, configuration string) error
Examples ¶
Constants ¶
const (
// XcodeProjExtension ...
XcodeProjExtension = ".xcodeproj"
)
Variables ¶
This section is empty.
Functions ¶
func ReadPlistFile ¶
func ReadPlistFile(path string) (serialized.Object, int, error)
ReadPlistFile returns a parsed object representing a plist file residing at path and a format identifier specifying the plist file format. Error is returned if: - file at path cannot be read - file is not a valid plist file Format IDs: - XMLFormat = 1 - BinaryFormat = 2 - OpenStepFormat = 3 - GNUStepFormat = 4
func WritePlistFile ¶
func WritePlistFile(path string, entitlements serialized.Object, format int) error
WritePlistFile writes a parsed object representing a plist file according the format identifier specified. Error is returned if: - file at path cannot be written - format id is incorrect Valid format IDs: - XMLFormat = 1 - BinaryFormat = 2 - OpenStepFormat = 3 - GNUStepFormat = 4
Types ¶
type BuildConfiguration ¶
type BuildConfiguration struct { ID string Name string BuildSettings serialized.Object }
BuildConfiguration ..
type ConfigurationList ¶
type ConfigurationList struct { ID string DefaultConfigurationName string BuildConfigurations []BuildConfiguration }
ConfigurationList ...
type Proj ¶
type Proj struct { ID string BuildConfigurationList ConfigurationList Targets []Target Attributes ProjectAtributes }
Proj ...
type ProjectAtributes ¶
type ProjectAtributes struct {
TargetAttributes serialized.Object
}
ProjectAtributes ...
**Deprecated**: use the func (p XcodeProj) Attributes() (serialized.Object, error) method instead
type Target ¶
type Target struct { Type TargetType ID string Name string BuildConfigurationList ConfigurationList Dependencies []TargetDependency ProductReference ProductReference ProductType string // contains filtered or unexported fields }
Target ...
func (Target) IsAppClipProduct ¶ added in v1.0.6
IsAppClipProduct ...
func (Target) IsAppExtensionProduct ¶
IsAppExtensionProduct ...
func (Target) IsExecutableProduct ¶
IsExecutableProduct ...
func (Target) IsTest ¶
IsTest identifies test targets Based on https://github.com/CocoaPods/Xcodeproj/blob/907c81763a7660978fda93b2f38f05de0cbb51ad/lib/xcodeproj/project/object/native_target.rb#L470
type TargetDependency ¶
type TargetDependency struct { TargetID string // contains filtered or unexported fields }
TargetDependency is a reference to another Target that is a dependency of a given Target
type TargetType ¶
type TargetType string
TargetType ...
const ( NativeTargetType TargetType = "PBXNativeTarget" AggregateTargetType TargetType = "PBXAggregateTarget" LegacyTargetType TargetType = "PBXLegacyTarget" )
TargetTypes
type TargetsToAppIconSets ¶
TargetsToAppIconSets maps target names to an array app icon set absolute paths.
func AppIconSetPaths ¶
func AppIconSetPaths(projectPath string) (TargetsToAppIconSets, error)
AppIconSetPaths parses an Xcode project and returns targets mapped to app icon set absolute paths.
type XcodeProj ¶
type XcodeProj struct { Proj Proj RawProj serialized.Object Format int Name string Path string // contains filtered or unexported fields }
XcodeProj ...
func (XcodeProj) Attributes ¶
func (p XcodeProj) Attributes() (serialized.Object, error)
Attributes ...
func (XcodeProj) BuildConfigurationList ¶
func (p XcodeProj) BuildConfigurationList(targetID string) (serialized.Object, error)
BuildConfigurationList ...
func (XcodeProj) BuildConfigurations ¶
func (p XcodeProj) BuildConfigurations(buildConfigurationList serialized.Object) ([]serialized.Object, error)
BuildConfigurations ...
func (XcodeProj) DependentTargetsOfTarget ¶ added in v1.0.6
DependentTargetsOfTarget returns with all dependencies of a given target, including the transitive dependencies. The returned list contains each target only once, using the target ID for uniqueness.
func (*XcodeProj) ForceCodeSign ¶
func (p *XcodeProj) ForceCodeSign(configuration, targetName, developmentTeam, codesignIdentity, provisioningProfileUUID string) error
ForceCodeSign modifies the project's code signing settings to use manual code signing.
Overrides the target's `ProvisioningStyle`, `DevelopmentTeam` and clears the `DevelopmentTeamName` in the **TargetAttributes**. Overrides the target's `CODE_SIGN_STYLE`, `DEVELOPMENT_TEAM`, `CODE_SIGN_IDENTITY`, `CODE_SIGN_IDENTITY[sdk=iphoneos*]` `PROVISIONING_PROFILE_SPECIFIER`, `PROVISIONING_PROFILE` and `PROVISIONING_PROFILE[sdk=iphoneos*]` in the **BuildSettings**.
func (XcodeProj) ForceTargetBundleID ¶
ForceTargetBundleID updates the projects bundle ID for the specified target and configuration. An error is returned if: - the target or configuration is not found - the given target or configuration is not found
func (XcodeProj) ForceTargetCodeSignEntitlement ¶
func (p XcodeProj) ForceTargetCodeSignEntitlement(target, configuration, entitlement string, value interface{}) error
ForceTargetCodeSignEntitlement updates the project descriptor behind p. It searches for the entitlements file for target and configuration and sets the entitlement key to the value provided. Error is returned: - if there's an error during reading or writing the file - if the file does not exist for the given target and configuration
func (XcodeProj) ReCreateSchemes ¶
ReCreateSchemes creates new schemes based on the available Targets
func (XcodeProj) ReadTargetInfoplist ¶
func (p XcodeProj) ReadTargetInfoplist(target, configuration string) (serialized.Object, int, error)
ReadTargetInfoplist ...
func (XcodeProj) Save ¶
Save the XcodeProj
Overrides the project.pbxproj file of the XcodeProj with the contents of `rawProj`
func (XcodeProj) SaveSharedScheme ¶
SaveSharedScheme saves or overwrites a shared Scheme in the Project The file name will be determined using the Name field of the Scheme
func (XcodeProj) Scheme ¶
Scheme returns the project's scheme by name and the project's absolute path.
func (XcodeProj) Schemes ¶
Schemes returns the schemes considered by Xcode, when opening the given project. The considered schemes are the project shared schemes and the project user schemes (for the current user). The default (shared scheme) is present in the user's xcschememanagement.plist, any schemes related change trigger generating all the schemes as xcscheme files. If no schemes are found, Xcode recreates the default schemes unless 'Autocreate schemes' option is disabled (in this case actions are disabled in Xcode, and 'No schemes' message appears).
func (XcodeProj) SchemesWithAutocreateEnabled ¶ added in v1.0.15
func (p XcodeProj) SchemesWithAutocreateEnabled(isAutocreateSchemesEnabled bool) ([]xcscheme.Scheme, error)
SchemesWithAutocreateEnabled returns the schemes considered by Xcode, when opening the given project as part of a workspace. THIS SHOULD BE CALLED ONLY BY A WORKSPACE. If you want to get the schemes directly, please call XcodeProj.Schemes.
SchemesWithAutocreateEnabled behaves similarly to XcodeProj.Schemes, the only difference is that the 'Autocreate schemes' option is coming from the workspace settings.
func (XcodeProj) TargetAttributes ¶
func (p XcodeProj) TargetAttributes() (serialized.Object, error)
TargetAttributes ...
func (XcodeProj) TargetBuildSettings ¶
func (p XcodeProj) TargetBuildSettings(target, configuration string, customOptions ...string) (serialized.Object, error)
TargetBuildSettings ...
func (XcodeProj) TargetBundleID ¶
TargetBundleID ...
func (XcodeProj) TargetCodeSignEntitlements ¶
func (p XcodeProj) TargetCodeSignEntitlements(target, configuration string) (serialized.Object, error)
TargetCodeSignEntitlements ...
func (XcodeProj) TargetCodeSignEntitlementsPath ¶
TargetCodeSignEntitlementsPath ...
func (XcodeProj) TargetInfoplistPath ¶
TargetInfoplistPath ...
func (XcodeProj) WriteTargetInfoplist ¶
func (p XcodeProj) WriteTargetInfoplist(infoplist serialized.Object, format int, target, configuration string) error
WriteTargetInfoplist ...