Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core tool buildDesktop detects presence of a cmd directory and builds in there #1382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
14 changes: 13 additions & 1 deletion cmd/core/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,21 @@ func buildDesktop(c *config.Config, platform config.Platform) error {
}
}
ldflags += " " + config.LinkerFlags(c)

inCmd := false
fi, err := os.Stat("cmd")
if err == nil && fi.IsDir() {
os.Chdir("cmd")
inCmd = true
}

args = append(args, "-ldflags", ldflags, "-o", filepath.Join(c.Build.Output, output))

err := xc.Run("go", args...)
err = xc.Run("go", args...)
if inCmd {
os.Rename(output, filepath.Join("..", output))
os.Chdir("../")
}
if err != nil {
return fmt.Errorf("error building for platform %s/%s: %w", platform.OS, platform.Arch, err)
}
Expand Down
Loading