mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Add support for build tags to the wails project schema and update pro… (#4439)
* Add support for build tags to the wails project schema and update project-config documentation for guidance * Support project tags in dev mode * Satisfy coderabbit nitpick relating to error variable name * Added changelog entry for `build:tags` project feature --------- Co-authored-by: symball <contact@simonball.me> Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
parent
6cbe626e7f
commit
43bfb094c2
5 changed files with 23 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/wailsapp/wails/v2/pkg/commands/buildtags"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
|
@ -59,6 +60,13 @@ func buildApplication(f *flags.Build) error {
|
|||
f.GarbleArgs = projectOptions.GarbleArgs
|
||||
}
|
||||
|
||||
projectTags, err := buildtags.Parse(projectOptions.BuildTags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
userTags := f.GetTags()
|
||||
compiledTags := append(projectTags, userTags...)
|
||||
|
||||
// Create BuildOptions
|
||||
buildOptions := &build.Options{
|
||||
Logger: logger,
|
||||
|
|
@ -76,7 +84,7 @@ func buildApplication(f *flags.Build) error {
|
|||
IgnoreFrontend: f.SkipFrontend,
|
||||
Compress: f.Upx,
|
||||
CompressFlags: f.UpxFlags,
|
||||
UserTags: f.GetTags(),
|
||||
UserTags: compiledTags,
|
||||
WebView2Strategy: f.GetWebView2Strategy(),
|
||||
TrimPath: f.TrimPath,
|
||||
RaceDetector: f.RaceDetector,
|
||||
|
|
@ -106,7 +114,7 @@ func buildApplication(f *flags.Build) error {
|
|||
{"Package", bool2Str(!f.NoPackage)},
|
||||
{"Clean Bin Dir", bool2Str(f.Clean)},
|
||||
{"LDFlags", f.LdFlags},
|
||||
{"Tags", "[" + strings.Join(f.GetTags(), ",") + "]"},
|
||||
{"Tags", "[" + strings.Join(compiledTags, ",") + "]"},
|
||||
{"Race Detector", bool2Str(f.RaceDetector)},
|
||||
}...)
|
||||
if len(buildOptions.OutputFile) > 0 && f.GetTargets().Length() == 1 {
|
||||
|
|
|
|||
|
|
@ -76,10 +76,15 @@ func Application(f *flags.Dev, logger *clilogger.CLILogger) error {
|
|||
return err
|
||||
}
|
||||
|
||||
buildOptions.UserTags = userTags
|
||||
|
||||
projectConfig := f.ProjectConfig()
|
||||
|
||||
projectTags, err := buildtags.Parse(projectConfig.BuildTags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
compiledTags := append(projectTags, userTags...)
|
||||
buildOptions.UserTags = compiledTags
|
||||
|
||||
// Setup signal handler
|
||||
quitChannel := make(chan os.Signal, 1)
|
||||
signal.Notify(quitChannel, os.Interrupt, syscall.SIGTERM)
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ type Project struct {
|
|||
// Build directory
|
||||
BuildDir string `json:"build:dir"`
|
||||
|
||||
// BuildTags Extra tags to process during build
|
||||
BuildTags string `json:"build:tags"`
|
||||
|
||||
// The output filename
|
||||
OutputFilename string `json:"outputfilename"`
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ The project config resides in the `wails.json` file in the project directory. Th
|
|||
"reloaddirs": "",
|
||||
// The directory where the build files reside. Defaults to 'build'
|
||||
"build:dir": "",
|
||||
// Additional tags to include at build time regardless of environment
|
||||
"build:tags": "",
|
||||
// Relative path to the frontend directory. Defaults to 'frontend'
|
||||
"frontend:dir": "",
|
||||
// The command to install node dependencies, run in the frontend directory - often `npm install`
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Configure Vite timeout by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/4374)
|
||||
- Added `ContentProtection` option to allow hiding the application window from screen sharing software [#4241](https://github.com/wailsapp/wails/pull/4241) by [@Taiterbase](https://github.com/Taiterbase)
|
||||
- Added `build:tags` to project specification for automatically adding compilation tags by @symball in [PR](https://github.com/wailsapp/wails/pull/4439)
|
||||
|
||||
## v2.10.2 - 2025-07-06
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue