tool/gocross: add ts_macext build tag for Xcode builds

It's used to control various opt-in functionality for the macOS and iOS
apps, and was lost in the migration to gocross.

Updates tailscale/tailscale#7769

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
Mihai Parparita 2023-04-11 09:47:08 -07:00 committed by Mihai Parparita
parent 33b006cacf
commit bdc7a61c24
2 changed files with 6 additions and 2 deletions

View File

@ -102,6 +102,10 @@ func autoflagsForTest(argv []string, env *Environment, goroot, nativeGOOS, nativ
cgo = nativeGOOS == "darwin"
tags = append(tags, "omitidna", "omitpemdecrypt")
if env.IsSet("XCODE_VERSION_ACTUAL") {
// If we're building via Xcode, we must be making the extension
// version (as opposed to tailscaled on Mac).
tags = append(tags, "ts_macext")
var xcodeFlags []string
// Minimum OS version being targeted, results in
// e.g. -mmacosx-version-min=11.3, -miphoneos-version-min=15.0

View File

@ -301,7 +301,7 @@ func TestAutoflags(t *testing.T) {
wantArgv: []string{
"gocross", "build",
"-trimpath",
"-tags=tailscale_go,omitidna,omitpemdecrypt",
"-tags=tailscale_go,omitidna,omitpemdecrypt,ts_macext",
"-ldflags", "-X tailscale.com/version.longStamp=1.2.3-long -X tailscale.com/version.shortStamp=1.2.3 -X tailscale.com/version.gitCommitStamp=abcd -X tailscale.com/version.extraGitCommitStamp=defg -w",
"./cmd/tailcontrol",
},
@ -333,7 +333,7 @@ func TestAutoflags(t *testing.T) {
wantArgv: []string{
"gocross", "build",
"-trimpath",
"-tags=tailscale_go,omitidna,omitpemdecrypt",
"-tags=tailscale_go,omitidna,omitpemdecrypt,ts_macext",
"-ldflags", "-X tailscale.com/version.longStamp=1.2.3-long -X tailscale.com/version.shortStamp=1.2.3 -X tailscale.com/version.gitCommitStamp=abcd -X tailscale.com/version.extraGitCommitStamp=defg -w",
"./cmd/tailcontrol",
},