Skip to content

Commit 993fde1

Browse files
authored
Merge pull request #4143 from josStorer/skipembedcreate
add -skipembedcreate cli option to improve recompile time
2 parents 538ba8d + ae5e3f4 commit 993fde1

File tree

6 files changed

+35
-26
lines changed

6 files changed

+35
-26
lines changed

v2/cmd/wails/build.go

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func buildApplication(f *flags.Build) error {
8585
GarbleArgs: f.GarbleArgs,
8686
SkipBindings: f.SkipBindings,
8787
ProjectData: projectOptions,
88+
SkipEmbedCreate: f.SkipEmbedCreate,
8889
}
8990

9091
tableData := pterm.TableData{

v2/cmd/wails/flags/buildcommon.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package flags
22

33
type BuildCommon struct {
4-
LdFlags string `description:"Additional ldflags to pass to the compiler"`
5-
Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"`
6-
SkipBindings bool `description:"Skips generation of bindings"`
7-
RaceDetector bool `name:"race" description:"Build with Go's race detector"`
8-
SkipFrontend bool `name:"s" description:"Skips building the frontend"`
9-
Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"`
10-
Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"`
11-
NoSyncGoMod bool `description:"Don't sync go.mod"`
12-
SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"`
4+
LdFlags string `description:"Additional ldflags to pass to the compiler"`
5+
Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"`
6+
SkipBindings bool `description:"Skips generation of bindings"`
7+
RaceDetector bool `name:"race" description:"Build with Go's race detector"`
8+
SkipFrontend bool `name:"s" description:"Skips building the frontend"`
9+
Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"`
10+
Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"`
11+
NoSyncGoMod bool `description:"Don't sync go.mod"`
12+
SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"`
13+
SkipEmbedCreate bool `description:"Skips creation of embed files"`
1314
}
1415

1516
func (c BuildCommon) Default() BuildCommon {

v2/cmd/wails/flags/dev.go

+16-15
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,22 @@ func (d *Dev) loadAndMergeProjectConfig() error {
117117
// GenerateBuildOptions creates a build.Options using the flags
118118
func (d *Dev) GenerateBuildOptions() *build.Options {
119119
result := &build.Options{
120-
OutputType: "dev",
121-
Mode: build.Dev,
122-
Devtools: true,
123-
Arch: runtime.GOARCH,
124-
Pack: true,
125-
Platform: runtime.GOOS,
126-
LDFlags: d.LdFlags,
127-
Compiler: d.Compiler,
128-
ForceBuild: d.ForceBuild,
129-
IgnoreFrontend: d.SkipFrontend,
130-
SkipBindings: d.SkipBindings,
131-
Verbosity: d.Verbosity,
132-
WailsJSDir: d.WailsJSDir,
133-
RaceDetector: d.RaceDetector,
134-
ProjectData: d.projectConfig,
120+
OutputType: "dev",
121+
Mode: build.Dev,
122+
Devtools: true,
123+
Arch: runtime.GOARCH,
124+
Pack: true,
125+
Platform: runtime.GOOS,
126+
LDFlags: d.LdFlags,
127+
Compiler: d.Compiler,
128+
ForceBuild: d.ForceBuild,
129+
IgnoreFrontend: d.SkipFrontend,
130+
SkipBindings: d.SkipBindings,
131+
Verbosity: d.Verbosity,
132+
WailsJSDir: d.WailsJSDir,
133+
RaceDetector: d.RaceDetector,
134+
ProjectData: d.projectConfig,
135+
SkipEmbedCreate: d.SkipEmbedCreate,
135136
}
136137

137138
return result

v2/pkg/commands/build/build.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type Options struct {
6969
Obfuscated bool // Indicates that bound methods should be obfuscated
7070
GarbleArgs string // The arguments for Garble
7171
SkipBindings bool // Skip binding generation
72+
SkipEmbedCreate bool // Skip creation of embed files
7273
}
7374

7475
// Build the project!
@@ -120,8 +121,10 @@ func Build(options *Options) (string, error) {
120121
}
121122

122123
// Create embed directories if they don't exist
123-
if err := CreateEmbedDirectories(cwd, options); err != nil {
124-
return "", err
124+
if !options.SkipEmbedCreate {
125+
if err := CreateEmbedDirectories(cwd, options); err != nil {
126+
return "", err
127+
}
125128
}
126129

127130
// Generate bindings

website/docs/reference/cli.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
7373
| -race | Build with Go's race detector | |
7474
| -s | Skip building the frontend | |
7575
| -skipbindings | Skip bindings generation | |
76+
| -skipembedcreate | Skip automatic creation of non-existent embed directories and gitkeep files | |
7677
| -tags "extra tags" | Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated | |
7778
| -trimpath | Remove all file system paths from the resulting executable. | |
7879
| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | |
@@ -203,6 +204,7 @@ Your system is ready for Wails development!
203204
| -s | Skip building the frontend | false |
204205
| -save | Saves the given `assetdir`, `reloaddirs`, `wailsjsdir`, `debounce`, `devserver` and `frontenddevserverurl` flags in `wails.json` to become the defaults for subsequent invocations. | |
205206
| -skipbindings | Skip bindings generation | |
207+
| -skipembedcreate | Skip automatic creation of non-existent embed directories and gitkeep files | |
206208
| -tags "extra tags" | Build tags to pass to compiler (quoted and space separated) | |
207209
| -v | Verbosity level (0 - silent, 1 - standard, 2 - verbose) | 1 |
208210
| -wailsjsdir | The directory to generate the generated Wails JS modules | Value in `wails.json` |

website/src/pages/changelog.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
### Added
2121
- Added "Branding" section to `wails doctor` to correctly identify Windows 11 [#3891](https://github.com/wailsapp/wails/pull/3891) by [@ronen25](https://github.com/ronen25)
22+
- Added `-skipembedcreate` flag to build and dev command to improve compile and recompile speed [#4143](https://github.com/wailsapp/wails/pull/4143) by @josStorer
2223

2324

2425
## v2.10.1 - 2025-02-24

0 commit comments

Comments
 (0)