-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows build #779
Merged
Merged
Windows build #779
Changes from 16 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
7ba4a95
wip windows build
alexadhy 6733324
fixes *nix build
alexadhy 895d4a8
fix linters windows
alexadhy 7f1d35d
uses cmdutil from https://github.com/skycoin/dmsg/pull/83
alexadhy 5dd3f81
fixes goimports
alexadhy cb0ca00
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 2b34341
fixes windows closing file error, fixes data race in logstore
alexadhy 234013a
update travis golangci-lint version
alexadhy fd9df42
goimports
alexadhy 0a2b000
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 83b2de6
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 8c0ff8c
build with dmsgpty PR
alexadhy f7eb368
makefile fixes
alexadhy 49ab591
Windows build
alexadhy 30dbf40
added hypervisor dmsgpty for windows
alexadhy 8e00ff3
fixes makefile build on *nix
alexadhy 6365ab1
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 0283e59
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 5257972
Fixes windows start visor
alexadhy 9bf21a9
fixes config loading for windows
alexadhy 761f2b1
adjust default config for cli address in windows
alexadhy 48d6bdc
fixes formatting, config, and socket unlink
alexadhy 1a2ca5c
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy b91455d
fixes formatting in windows
alexadhy db8d9de
fixes restart test and hypervisor test windows
alexadhy b8d4cf8
fixes hypervisor test
alexadhy 752e488
lint
alexadhy 5ef1d23
formatting and appveyor fixes
alexadhy da18891
formatting fixes
alexadhy 5360164
Makefile: appveyor specific
alexadhy d3a1055
TODO:fixes non deterministic dmsgtracker on windows
alexadhy 23d671d
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy a03438a
some more fixes for windows
alexadhy bd7acc9
forced: requested changes
alexadhy 215bbd0
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 12dd99e
fixes formatting and vendoring
alexadhy 852a7a9
merge upstream, fixes conflicts
alexadhy 1b1b417
formatting fixes
alexadhy f30408e
make vpn-client works with windows
alexadhy 080acfb
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 514fa4e
signals aren't sendable on windows
alexadhy fd1068d
signals aren't sendable on windows
alexadhy 4095a69
update vendor
alexadhy 9d1ae67
wintun 0.14 API
alexadhy 74d9e93
update docs
alexadhy 2243e39
merge with develop, fixes merge conflict
alexadhy 3cb9998
frontend stuff
alexadhy 5541ce4
fixes merge conflicts, sync to develop
alexadhy 67b16a3
fixes makefile
alexadhy 5e9843c
Merge branch 'windows-build' of https://github.com/alexadhy/skywire i…
alexadhy 62a261b
fixes windows build
alexadhy b74d4d0
enable dmsgpty route on windows
alexadhy c2f146f
merge with develop fixes conflict
alexadhy 12d0138
update wintun dependency
alexadhy 549c296
merge develop changes
alexadhy d2d5f5d
vpn-client added named pipes for shutting down in windows
alexadhy 5eac2fd
fixes ipc shutdown windows
alexadhy c598093
fixes panic in shutdown vpn
alexadhy 07ba357
ipc socket for all apps
alexadhy ea0b8e0
fixes panic on vpn-client
alexadhy a27ae50
Merge remote-tracking branch 'upstream/develop' into windows-build
alexadhy 0fb18e5
fixes appveyor lint issues
alexadhy 2fd4638
update cobra to latest version
alexadhy 7c1471c
fixes makefile for windows, remove redirection to dev/null
alexadhy ba2678c
makefile changes
alexadhy 3aaa550
merge with develop, fixes merge conflict
alexadhy a21c0c8
merge with develop, fixes merge conflict
alexadhy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,13 @@ BRANCH := latest | |
|
||
PROJECT_BASE := github.com/skycoin/skywire | ||
DMSG_BASE := github.com/skycoin/dmsg | ||
OPTS?=GO111MODULE=on | ||
ifeq ($(OS),Windows_NT) | ||
OPTS?=powershell -Command setx GO111MODULE on; | ||
DATE := $(shell powershell -Command date -u ${RFC_3339}) | ||
else | ||
OPTS?=GO111MODULE=on | ||
endif | ||
|
||
STATIC_OPTS?= $(OPTS) CC=musl-gcc | ||
MANAGER_UI_DIR = static/skywire-manager-src | ||
MANAGER_UI_BUILT_DIR=cmd/skywire-visor/static | ||
|
@@ -45,6 +51,8 @@ check: lint test ## Run linters and tests | |
|
||
build: host-apps bin ## Install dependencies, build apps and binaries. `go build` with ${OPTS} | ||
|
||
build-windows: host-apps-windows bin-windows ## Install dependencies, build apps and binaries. `go build` with ${OPTS} | ||
|
||
build-static: host-apps-static bin-static ## Build apps and binaries. `go build` with ${OPTS} | ||
|
||
install-generate: ## Installs required execs for go generate. | ||
|
@@ -63,9 +71,16 @@ clean: ## Clean project: remove created binaries and apps | |
-rm -rf ./apps | ||
-rm -f ./skywire-visor ./skywire-cli ./setup-node | ||
|
||
clean-windows: | ||
powershell -Command Remove-Item -Path ./apps -Force -Recurse | ||
powershell -Command Remove-Item -Path .\skywire-visor.exe,.\skywire-cli.exe,.\setup-node.exe -Force | ||
|
||
install: ## Install `skywire-visor`, `skywire-cli`, `setup-node` | ||
${OPTS} go install ${BUILD_OPTS} ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node | ||
|
||
install-windows: | ||
powershell 'Get-ChildItem .\cmd | % { ${OPTS} go install ${BUILD_OPTS} ./ $$_.FullName }' | ||
|
||
install-static: ## Install `skywire-visor`, `skywire-cli`, `setup-node` | ||
${STATIC_OPTS} go install -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node | ||
|
||
|
@@ -88,6 +103,10 @@ install-linters: ## Install linters | |
${OPTS} go get -u golang.org/x/tools/cmd/goimports | ||
${OPTS} go get -u github.com/incu6us/goimports-reviser/v2 | ||
|
||
install-linters-windows: | ||
${OPTS} go get -u github.com/golangci/golangci-lint/cmd/[email protected] | ||
${OPTS} go get -u golang.org/x/tools/cmd/goimports | ||
|
||
tidy: ## Tidies and vendors dependencies. | ||
${OPTS} go mod tidy -v | ||
|
||
|
@@ -97,29 +116,43 @@ format: tidy ## Formats the code. Must have goimports and goimports-reviser inst | |
${OPTS} goimports -w -local ${PROJECT_BASE} ./internal | ||
find . -type f -name '*.go' -not -path "./vendor/*" -exec goimports-reviser -project-name ${PROJECT_BASE} -file-path {} \; | ||
|
||
format-windows: tidy ## Formats the code. Must have goimports and goimports-reviser installed (use make install-linters). | ||
${OPTS} goimports -w -local ${PROJECT_BASE} ./pkg | ||
${OPTS} goimports -w -local ${PROJECT_BASE} ./cmd | ||
${OPTS} goimports -w -local ${PROJECT_BASE} ./internal | ||
|
||
dep: tidy ## Sorts dependencies | ||
${OPTS} go mod vendor -v | ||
|
||
host-apps: ## Build app | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/skychat ./cmd/apps/skychat | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks ./cmd/apps/skysocks | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks-client ./cmd/apps/skysocks-client | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/vpn-server ./cmd/apps/vpn-server | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/vpn-client ./cmd/apps/vpn-client | ||
mkdir -p ./apps | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/skychat | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/skysocks | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/skysocks-client | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/vpn-server | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/vpn-client | ||
|
||
host-apps-windows: | ||
powershell -Command new-item .\apps -itemtype directory -force | ||
powershell 'Get-ChildItem .\cmd\apps | % { ${OPTS} go build ${BUILD_OPTS} -o ./apps $$_.FullName }' | ||
|
||
# Static Apps | ||
host-apps-static: ## Build app | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/skychat ./cmd/apps/skychat | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/skysocks ./cmd/apps/skysocks | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/skysocks-client ./cmd/apps/skysocks-client | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/vpn-server ./cmd/apps/vpn-server | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/vpn-client ./cmd/apps/vpn-client | ||
mkdir -p ./apps | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/skychat | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/skysocks | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/skysocks-client | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/vpn-server | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/vpn-client | ||
|
||
# Bin | ||
bin: ## Build `skywire-visor`, `skywire-cli` | ||
${OPTS} go build ${BUILD_OPTS} -o ./skywire-visor ./cmd/skywire-visor | ||
${OPTS} go build ${BUILD_OPTS} -o ./skywire-cli ./cmd/skywire-cli | ||
${OPTS} go build ${BUILD_OPTS} -o ./setup-node ./cmd/setup-node | ||
${OPTS} go build ${BUILD_OPTS} -o ./ ./cmd/skywire-visor | ||
${OPTS} go build ${BUILD_OPTS} -o ./ ./cmd/skywire-cli | ||
${OPTS} go build ${BUILD_OPTS} -o ./ ./cmd/setup-node | ||
|
||
bin-windows: | ||
powershell 'Get-ChildItem .\cmd | % { ${OPTS} go build ${BUILD_OPTS} -o ./ $$_.FullName }' | ||
|
||
# Static Bin | ||
bin-static: ## Build `skywire-visor`, `skywire-cli` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// +build !windows | ||
|
||
package commands | ||
|
||
import ( | ||
"os/exec" | ||
"syscall" | ||
"time" | ||
|
||
"github.com/sirupsen/logrus" | ||
|
||
"github.com/skycoin/skywire/pkg/restart" | ||
) | ||
|
||
func detachProcess(delayDuration time.Duration, log logrus.FieldLogger) { | ||
// Versions v0.2.3 and below return 0 exit-code after update and do not trigger systemd to restart a process | ||
// and therefore do not support restart via systemd. | ||
// If --delay flag is passed, version is v0.2.3 or below. | ||
// Systemd has PID 1. If PPID is not 1 and PPID of parent process is 1, then | ||
// this process is a child process that is run after updating by a skywire-visor that is run by systemd. | ||
if delayDuration != 0 && !restartCtx.Systemd() && restartCtx.ParentSystemd() { | ||
// As skywire-visor checks if new process is run successfully in `restart.DefaultCheckDelay` after update, | ||
// new process should be alive after `restart.DefaultCheckDelay`. | ||
time.Sleep(restart.DefaultCheckDelay) | ||
|
||
// When a parent process exits, systemd kills child processes as well, | ||
// so a child process can ask systemd to restart service between after restart.DefaultCheckDelay | ||
// but before (restart.DefaultCheckDelay + restart.extraWaitingTime), | ||
// because after that time a parent process would exit and then systemd would kill its children. | ||
// In this case, systemd would kill both parent and child processes, | ||
// then restart service using an updated binary. | ||
cmd := exec.Command("systemctl", "restart", "skywire-visor") // nolint:gosec | ||
if err := cmd.Run(); err != nil { | ||
log.WithError(err).Errorf("Failed to restart skywire-visor service") | ||
} else { | ||
log.WithError(err).Infof("Restarted skywire-visor service") | ||
} | ||
|
||
// Detach child from parent. | ||
if _, err := syscall.Setsid(); err != nil { | ||
log.WithError(err).Errorf("Failed to call setsid()") | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// +build windows | ||
|
||
package commands | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func detachProcess(_ time.Duration, _ logrus.FieldLogger) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use
DATE := $(shell date -u $(RFC_3339))
inside the else.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's already a DATE variable defined above, so no need to define it twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, what I meant was that
DATE := $(shell date -u $(RFC_3339))
should be inside the else statement asmake
isn't working in windows if it is outside.