Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ dist/
.run

# binary files like goreleaser binary
bin
bin

# Info.plist embedding
Info.generated.plist
8 changes: 5 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ project_name: cirrus
before:
hooks:
- go mod download
- sh -c "sed 's/__VERSION__/{{ .Version }}/g' Info.plist > Info.generated.plist"

builds:
- main: cmd/cirrus/main.go
ldflags: >
-X github.com/cirruslabs/cirrus-cli/internal/version.Version={{.Version}}
-X github.com/cirruslabs/cirrus-cli/internal/version.Commit={{.ShortCommit}}
ldflags:
- -X github.com/cirruslabs/cirrus-cli/internal/version.Version={{.Version}}
- -X github.com/cirruslabs/cirrus-cli/internal/version.Commit={{.ShortCommit}}
- '{{- if eq .Os "darwin" }}-extldflags "-sectcreate __TEXT __info_plist Info.generated.plist"{{ end }}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Force external link mode when adding __info_plist section

go doc cmd/link states that -extldflags are passed to the external linker and that -linkmode controls internal/external/auto behavior; this change adds only -extldflags for darwin without forcing external mode. I checked this repo’s sources with rg 'import "C"|#cgo' and found no cgo files, so auto mode can remain internal and skip -sectcreate, which means Info.generated.plist is not embedded and the bundle identifier requirement from this commit is not reliably met.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting detail.

Improved in ec9dd3c.

env:
- CGO_ENABLED={{if eq .Os "darwin"}}1{{else}}0{{end}}
goos:
Expand Down
18 changes: 18 additions & 0 deletions Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>cirrus</string>
<key>CFBundleDisplayName</key>
<string>cirrus</string>
<key>CFBundleIdentifier</key>
<string>com.github.cirruslabs.cirrus-cli</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleVersion</key>
<string>__VERSION__</string>
</dict>
</plist>
Loading