mirror of
https://github.com/mattermost/focalboard.git
synced 2024-11-24 08:22:29 +02:00
Windows app
This commit is contained in:
parent
e55e5fa2a4
commit
dba3a03669
14
Makefile
14
Makefile
@ -1,4 +1,4 @@
|
|||||||
.PHONY: prebuild clean cleanall server server-linux generate watch-server mac linux-app
|
.PHONY: prebuild clean cleanall server server-linux server-win64 generate watch-server webapp mac app linux-app
|
||||||
|
|
||||||
all: server
|
all: server
|
||||||
|
|
||||||
@ -8,6 +8,7 @@ prebuild:
|
|||||||
go get github.com/spf13/viper
|
go get github.com/spf13/viper
|
||||||
go get github.com/lib/pq
|
go get github.com/lib/pq
|
||||||
go get github.com/mattn/go-sqlite3
|
go get github.com/mattn/go-sqlite3
|
||||||
|
cd webapp; npm install
|
||||||
|
|
||||||
server:
|
server:
|
||||||
cd server; go build -o ../bin/octoserver ./main
|
cd server; go build -o ../bin/octoserver ./main
|
||||||
@ -15,6 +16,9 @@ server:
|
|||||||
server-linux:
|
server-linux:
|
||||||
cd server; env GOOS=linux GOARCH=amd64 go build -o ../bin/octoserver ./main
|
cd server; env GOOS=linux GOARCH=amd64 go build -o ../bin/octoserver ./main
|
||||||
|
|
||||||
|
server-win64:
|
||||||
|
cd server; env GOOS=windows GOARCH=amd64 go build -o ../bin/octoserver.exe ./main
|
||||||
|
|
||||||
generate:
|
generate:
|
||||||
cd server; go get -modfile=go.tools.mod github.com/golang/mock/mockgen
|
cd server; go get -modfile=go.tools.mod github.com/golang/mock/mockgen
|
||||||
cd server; go get -modfile=go.tools.mod github.com/jteeuwen/go-bindata
|
cd server; go get -modfile=go.tools.mod github.com/jteeuwen/go-bindata
|
||||||
@ -49,6 +53,14 @@ mac:
|
|||||||
xcodebuild archive -workspace mac/Tasks.xcworkspace -scheme Tasks -archivePath mac/temp/tasks.xcarchive
|
xcodebuild archive -workspace mac/Tasks.xcworkspace -scheme Tasks -archivePath mac/temp/tasks.xcarchive
|
||||||
xcodebuild -exportArchive -archivePath mac/temp/tasks.xcarchive -exportPath mac/dist -exportOptionsPlist mac/export.plist
|
xcodebuild -exportArchive -archivePath mac/temp/tasks.xcarchive -exportPath mac/dist -exportOptionsPlist mac/export.plist
|
||||||
|
|
||||||
|
win: server-win64 webapp
|
||||||
|
cd win; make build
|
||||||
|
cp -R bin/octoserver.exe win/dist
|
||||||
|
cp -R config.json win/dist
|
||||||
|
mkdir -p win/dist/webapp
|
||||||
|
cp -R webapp/pack win/dist/webapp/pack
|
||||||
|
# cd win/dist; zip -r ../tasks-win.zip .
|
||||||
|
|
||||||
linux-app: server-linux webapp
|
linux-app: server-linux webapp
|
||||||
rm -rf linux/temp
|
rm -rf linux/temp
|
||||||
mkdir -p linux/temp/octo-linux-app/webapp
|
mkdir -p linux/temp/octo-linux-app/webapp
|
||||||
|
10
win/Makefile
Normal file
10
win/Makefile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.PHONY: run build
|
||||||
|
|
||||||
|
run:
|
||||||
|
go run ./main.go
|
||||||
|
|
||||||
|
build:
|
||||||
|
mkdir -p dist
|
||||||
|
# env GOOS=windows GOARCH=amd64 go build -ldflags="-H windowsgui" -o dist/tasks-win.exe
|
||||||
|
# env GOOS=windows GOARCH=amd64 go build -ldflags -H=windowsgui -o dist/tasks-win.exe
|
||||||
|
env GOOS=windows GOARCH=amd64 go build -o dist/tasks-win.exe
|
8
win/go.mod
Normal file
8
win/go.mod
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module github.com/mattermost/mattermost-octo-tasks/linux
|
||||||
|
|
||||||
|
go 1.15
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/gonutz/w32 v1.0.0
|
||||||
|
github.com/zserge/lorca v0.1.9
|
||||||
|
)
|
9
win/go.sum
Normal file
9
win/go.sum
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
github.com/gonutz/w32 v1.0.0 h1:3t1z6ZfkFvirjFYBx9pHeHBuKoN/VBVk9yHb/m2Ll/k=
|
||||||
|
github.com/gonutz/w32 v1.0.0/go.mod h1:Rc/YP5K9gv0FW4p6X9qL3E7Y56lfMflEol1fLElfMW4=
|
||||||
|
github.com/zserge/lorca v0.1.9 h1:vbDdkqdp2/rmeg8GlyCewY2X8Z+b0s7BqWyIQL/gakc=
|
||||||
|
github.com/zserge/lorca v0.1.9/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0 h1:MsuvTghUPjX762sGLnGsxC3HM0B5r83wEtYcYR8/vRs=
|
||||||
|
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
63
win/main.go
Normal file
63
win/main.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
|
||||||
|
"github.com/gonutz/w32"
|
||||||
|
"github.com/zserge/lorca"
|
||||||
|
)
|
||||||
|
|
||||||
|
func runOctoTasks(ctx context.Context) *exec.Cmd {
|
||||||
|
// cmd := exec.CommandContext(ctx, "octoserver.exe", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10))
|
||||||
|
cmd := exec.CommandContext(ctx, "octoserver.exe")
|
||||||
|
// cmd := exec.CommandContext(ctx, "cmd.exe", "/C", "start", "./octoserver.exe", "--monitorpid", strconv.FormatInt(int64(os.Getpid()), 10))
|
||||||
|
// cmd := exec.CommandContext(ctx, "cmd.exe", "/C", "start", "./octoserver.exe")
|
||||||
|
|
||||||
|
// cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
go func() {
|
||||||
|
err := cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
log.Printf("Just ran subprocess %d, exiting\n", cmd.Process.Pid)
|
||||||
|
}()
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// log.Printf("PID: %s", strconv.FormatInt(int64(os.Getpid()), 10))
|
||||||
|
hideConsole()
|
||||||
|
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
cmd := runOctoTasks(ctx)
|
||||||
|
|
||||||
|
ui, err := lorca.New("http://localhost:8000", "", 1024, 768)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
// defer ui.Close()
|
||||||
|
|
||||||
|
log.Printf("Started")
|
||||||
|
<-ui.Done()
|
||||||
|
|
||||||
|
log.Printf("App Closed")
|
||||||
|
cancel()
|
||||||
|
if err := cmd.Process.Kill(); err != nil {
|
||||||
|
log.Fatal("failed to kill process: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func hideConsole() {
|
||||||
|
console := w32.GetConsoleWindow()
|
||||||
|
if console != 0 {
|
||||||
|
_, consoleProcID := w32.GetWindowThreadProcessId(console)
|
||||||
|
if w32.GetCurrentProcessId() == consoleProcID {
|
||||||
|
w32.ShowWindowAsync(console, w32.SW_HIDE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user