Skip to content

Commit

Permalink
tt: add tt debug build support
Browse files Browse the repository at this point in the history
Debug build can be performed with `mage build:debug` command.
Default build type is release.
  • Loading branch information
psergee committed Dec 21, 2023
1 parent d7bce7d commit 92606c4
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (

var (
ldflags = []string{
"-s", "-w",
"-X ${PACKAGE}/version.gitTag=${GIT_TAG}",
"-X ${PACKAGE}/version.gitCommit=${GIT_COMMIT}",
"-X ${PACKAGE}/version.gitCommitSinceTag=${GIT_COMMIT_SINCE_TAG}",
Expand All @@ -48,6 +47,10 @@ var (
ttExecutableName = "tt"

generateModePath = filepath.Join(packagePath, "codegen", "generate_code.go")

Aliases = map[string]any{
"build": Build.Release,
}
)

type BuildType string
Expand Down Expand Up @@ -159,9 +162,7 @@ func PatchCC() error {

// Building tt executable. Supported environment variables:
// TT_CLI_BUILD_SSL=(no|static|shared)
func Build() error {
fmt.Println("Building tt...")

func buildTt(ldflags []string) error {
mg.Deps(PatchCC)
mg.Deps(GenerateGoCode)

Expand Down Expand Up @@ -204,6 +205,22 @@ func Build() error {
return nil
}

type Build mg.Namespace

// Building release tt executable without debug info.
func (Build) Release() error {
fmt.Println("Building release tt...")

return buildTt(append(ldflags, "-s", "-w"))
}

// Building debug tt executable.
func (Build) Debug() error {
fmt.Println("Building debug tt...")

return buildTt(ldflags)
}

// Run license checker.
func CheckLicenses() error {
fmt.Println("Running license checker...")
Expand Down

0 comments on commit 92606c4

Please sign in to comment.