Skip to content

Commit f569e67

Browse files
committed
Support the deep arg from mitchellh#42
1 parent c3afcf0 commit f569e67

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

cmd/gon/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func realMain() int {
184184
Files: cfg.Source,
185185
Identity: cfg.Sign.ApplicationIdentity,
186186
Entitlements: cfg.Sign.EntitlementsFile,
187+
Deep: cfg.Sign.Deep,
187188
Logger: logger.Named("sign"),
188189
})
189190
if err != nil {
@@ -232,6 +233,7 @@ func realMain() int {
232233
err = sign.Sign(context.Background(), &sign.Options{
233234
Files: []string{cfg.Dmg.OutputPath},
234235
Identity: cfg.Sign.ApplicationIdentity,
236+
Deep: cfg.Sign.Deep,
235237
Logger: logger.Named("dmg"),
236238
})
237239
if err != nil {

internal/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ type Sign struct {
7070
ApplicationIdentity string `hcl:"application_identity"`
7171
// Specify a path to an entitlements file in plist format
7272
EntitlementsFile string `hcl:"entitlements_file,optional"`
73+
// Specific to request a --deep codesigning.
74+
Deep bool `hcl:"deep,optional"`
7375
}
7476

7577
// Dmg are the options for a dmg file as output.

sign/sign.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ type Options struct {
2727
// Entitlements is an (optional) path to a plist format .entitlements file
2828
Entitlements string
2929

30+
// Deep is an (optional) toggle to force the --deep flag when codesigning.
31+
// This can be useful for signing *.app directories and their child files.
32+
Deep bool
33+
3034
// Output is an io.Writer where the output of the command will be written.
3135
// If this is nil then the output will only be sent to the log (if set)
3236
// or in the error result value if signing failed.
@@ -76,6 +80,10 @@ func Sign(ctx context.Context, opts *Options) error {
7680
cmd.Args = append(cmd.Args, "--entitlements", opts.Entitlements)
7781
}
7882

83+
if opts.Deep {
84+
cmd.Args = append(cmd.Args, "--deep")
85+
}
86+
7987
// Append the files that we want to sign
8088
cmd.Args = append(cmd.Args, opts.Files...)
8189

0 commit comments

Comments
 (0)