mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Backport (#283)
* Develop (#265) * Patch for file dialog on OSX * Update CONTRIBUTORS.md * 262 add wails shutdown method (#264) * feat: support close in bridge mode * feat: WailsShutdown callback Now handles proper shutdown through: * runtime.Window.Close() * Killing the main window * Ctrl-C * chore: version bump * chore: version bump * feat: adjust binary name for OS * fix: allow spaces in gcc path * feat: migrate command * fix: npm/node versions * fix: allow IE for serve * feat: go build script * fix: make runtime ES2015 compliant * fix: remove invoke patch * fix: allow any line endings * chore: remove legacy bridge files * chore: latest assets
This commit is contained in:
parent
dafd9bcb24
commit
914642bd1d
15 changed files with 115 additions and 73 deletions
83
scripts/build.go
Normal file
83
scripts/build.go
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// Default target to run when none is specified
|
||||
// If not set, running mage will list available targets
|
||||
// var Default = Build
|
||||
|
||||
/*
|
||||
# Build runtime
|
||||
echo "**** Building Runtime ****"
|
||||
cd runtime/js
|
||||
npm install
|
||||
npm run build
|
||||
cd ../..
|
||||
|
||||
echo "**** Packing Assets ****"
|
||||
cd cmd
|
||||
mewn
|
||||
cd ..
|
||||
cd lib/renderer
|
||||
mewn
|
||||
cd ../..
|
||||
|
||||
echo "**** Installing Wails locally ****"
|
||||
cd cmd/wails
|
||||
go install
|
||||
cd ../..
|
||||
|
||||
echo "**** Tidying the mods! ****"
|
||||
go mod tidy
|
||||
|
||||
echo "**** WE ARE DONE! ****"
|
||||
|
||||
*/
|
||||
|
||||
func runCommand(command string, args ...string) {
|
||||
cmd := exec.Command(command, args...)
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
cmd.Run()
|
||||
fmt.Println(string(output))
|
||||
}
|
||||
|
||||
// A build step that requires additional params, or platform specific steps for example
|
||||
func main() {
|
||||
|
||||
dir, _ := os.Getwd()
|
||||
|
||||
// Build Runtime
|
||||
fmt.Println("**** Building Runtime ****")
|
||||
runtimeDir, _ := filepath.Abs(filepath.Join(dir, "..", "runtime", "js"))
|
||||
os.Chdir(runtimeDir)
|
||||
runCommand("npm", "install")
|
||||
runCommand("npm", "run", "build")
|
||||
|
||||
// Pack assets
|
||||
fmt.Println("**** Packing Assets ****")
|
||||
rendererDir, _ := filepath.Abs(filepath.Join(dir, "..", "lib", "renderer"))
|
||||
os.Chdir(rendererDir)
|
||||
runCommand("mewn")
|
||||
cmdDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd"))
|
||||
os.Chdir(cmdDir)
|
||||
runCommand("mewn")
|
||||
|
||||
// Install Wails
|
||||
fmt.Println("**** Installing Wails locally ****")
|
||||
execDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd", "wails"))
|
||||
os.Chdir(execDir)
|
||||
runCommand("go", "install")
|
||||
|
||||
baseDir, _ := filepath.Abs(filepath.Join(dir, ".."))
|
||||
os.Chdir(baseDir)
|
||||
runCommand("go", "mod", "tidy")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue