mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Add flag to skip mod tidy
This commit is contained in:
@@ -38,6 +38,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
compilerCommand := "go"
|
||||
command.StringFlag("compiler", "Use a different go compiler to build, eg go1.15beta1", &compilerCommand)
|
||||
|
||||
skipModTidy := false
|
||||
command.BoolFlag("m", "Skip mod tidy before compile", &skipModTidy)
|
||||
|
||||
compress := false
|
||||
command.BoolFlag("upx", "Compress final binary with UPX (if installed)", &compress)
|
||||
|
||||
@@ -167,6 +170,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
||||
Pack: !noPackage,
|
||||
LDFlags: ldflags,
|
||||
Compiler: compilerCommand,
|
||||
SkipModTidy: skipModTidy,
|
||||
Verbosity: verbosity,
|
||||
ForceBuild: forceBuild,
|
||||
IgnoreFrontend: skipFrontend,
|
||||
|
||||
@@ -198,15 +198,17 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
|
||||
|
||||
verbose := options.Verbosity == VERBOSE
|
||||
// Run go mod tidy first
|
||||
cmd := exec.Command(options.Compiler, "mod", "tidy")
|
||||
cmd.Stderr = os.Stderr
|
||||
if verbose {
|
||||
println("")
|
||||
cmd.Stdout = os.Stdout
|
||||
}
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
if !options.SkipModTidy {
|
||||
cmd := exec.Command(options.Compiler, "mod", "tidy")
|
||||
cmd.Stderr = os.Stderr
|
||||
if verbose {
|
||||
println("")
|
||||
cmd.Stdout = os.Stdout
|
||||
}
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Default go build command
|
||||
@@ -280,7 +282,7 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
|
||||
options.CompiledBinary = compiledBinary
|
||||
|
||||
// Create the command
|
||||
cmd = exec.Command(options.Compiler, commands.AsSlice()...)
|
||||
cmd := exec.Command(options.Compiler, commands.AsSlice()...)
|
||||
cmd.Stderr = os.Stderr
|
||||
if verbose {
|
||||
println(" Build command:", commands.Join(" "))
|
||||
|
||||
@@ -37,6 +37,7 @@ type Options struct {
|
||||
Platform string // The platform to build for
|
||||
Arch string // The architecture to build for
|
||||
Compiler string // The compiler command to use
|
||||
SkipModTidy bool // Skip mod tidy before compile
|
||||
IgnoreFrontend bool // Indicates if the frontend does not need building
|
||||
OutputFile string // Override the output filename
|
||||
BuildDirectory string // Directory to use for building the application
|
||||
|
||||
Reference in New Issue
Block a user