|
8 | 8 |
|
9 | 9 | "github.com/bitrise-io/go-utils/fileutil" |
10 | 10 | "github.com/bitrise-io/go-utils/log" |
| 11 | + "github.com/bitrise-io/go-utils/pathutil" |
11 | 12 | "github.com/bitrise-io/go-xcode/xcodebuild" |
12 | 13 | "github.com/bitrise-io/go-xcode/xcodeproject/serialized" |
13 | 14 | "github.com/bitrise-io/go-xcode/xcodeproject/xcodeproj" |
@@ -62,6 +63,31 @@ func (w Workspace) SchemeBuildSettings(scheme, configuration string, customOptio |
62 | 63 | return object, err |
63 | 64 | } |
64 | 65 |
|
| 66 | +// SchemeCodeSignEntitlements returns the code sign entitlements for a scheme and configuration |
| 67 | +func (w Workspace) SchemeCodeSignEntitlements(scheme, configuration string, customOptions ...string) (serialized.Object, error) { |
| 68 | + buildSettings, err := w.SchemeBuildSettings(scheme, configuration, customOptions...) |
| 69 | + if err != nil { |
| 70 | + return nil, err |
| 71 | + } |
| 72 | + |
| 73 | + entitlementsPath, err := buildSettings.String("CODE_SIGN_ENTITLEMENTS") |
| 74 | + if err != nil { |
| 75 | + return nil, err |
| 76 | + } |
| 77 | + |
| 78 | + if pathutil.IsRelativePath(entitlementsPath) { |
| 79 | + entitlementsPath = filepath.Join(filepath.Dir(w.Path), entitlementsPath) |
| 80 | + } |
| 81 | + |
| 82 | + entitlements, _, err := xcodeproj.ReadPlistFile(entitlementsPath) |
| 83 | + if err != nil { |
| 84 | + return nil, err |
| 85 | + } |
| 86 | + |
| 87 | + log.TDebugf("Fetched %s scheme code sign entitlements", scheme) |
| 88 | + return entitlements, nil |
| 89 | +} |
| 90 | + |
65 | 91 | // FileLocations ... |
66 | 92 | func (w Workspace) FileLocations() ([]string, error) { |
67 | 93 | var fileLocations []string |
|
0 commit comments