tweak helpers

This commit is contained in:
Jakub
2020-12-17 00:13:16 +01:00
committed by James Houlahan
parent d3b0871cf1
commit b36ac532c9
4 changed files with 19 additions and 10 deletions

View File

@ -106,7 +106,7 @@ build-linux-qa:
only:
- web
script:
- BUILD_TAGS="build_qa pmapi_qa" make build
- BUILD_TAGS="build_qa" make build
artifacts:
name: "bridge-linux-qa-$CI_COMMIT_SHORT_SHA"
paths:
@ -150,7 +150,7 @@ build-darwin-qa:
only:
- web
script:
- BUILD_TAGS="build_qa pmapi_qa" make build
- BUILD_TAGS="build_qa" make build
artifacts:
name: "bridge-darwin-qa-$CI_COMMIT_SHORT_SHA"
paths:
@ -198,7 +198,7 @@ build-windows-qa:
- apt-get update && apt-get -y install binutils-mingw-w64 tar gzip
- ln -s /usr/bin/x86_64-w64-mingw32-windres /usr/bin/windres
- go mod download
- TARGET_OS=windows BUILD_TAGS="build_qa pmapi_qa" make build
- TARGET_OS=windows BUILD_TAGS="build_qa" make build
artifacts:
name: "bridge-windows-qa-$CI_COMMIT_SHORT_SHA"
paths:

View File

@ -18,6 +18,7 @@ SRC_ICNS:=Bridge.icns
SRC_SVG:=logo.svg
TGT_ICNS:=Bridge.icns
EXE_NAME:=proton-bridge
CONFIGNAME:=bridge
ifeq "${TARGET_CMD}" "Import-Export"
APP_VERSION:=${IE_APP_VERSION}
SRC_ICO:=ie.ico
@ -25,19 +26,24 @@ ifeq "${TARGET_CMD}" "Import-Export"
SRC_SVG:=ie.svg
TGT_ICNS:=ImportExport.icns
EXE_NAME:=proton-ie
CONFIGNAME:=importExport
endif
REVISION:=$(shell git rev-parse --short=10 HEAD)
BUILD_TIME:=$(shell date +%FT%T%z)
BUILD_FLAGS:=-tags='${BUILD_TAGS}'
BUILD_FLAGS_LAUNCHER:=${BUILD_FLAGS}
BUILD_FLAGS_NOGUI:=-tags='${BUILD_TAGS} nogui'
GO_LDFLAGS:=$(addprefix -X github.com/ProtonMail/proton-bridge/internal/constants.,Version=${APP_VERSION} Revision=${REVISION} BuildTime=${BUILD_TIME})
ifneq "${BUILD_LDFLAGS}" ""
GO_LDFLAGS+= ${BUILD_LDFLAGS}
GO_LDFLAGS+=${BUILD_LDFLAGS}
endif
GO_LDFLAGS:=-ldflags '${GO_LDFLAGS}'
BUILD_FLAGS+= ${GO_LDFLAGS}
BUILD_FLAGS_NOGUI+= ${GO_LDFLAGS}
GO_LDFLAGS_LAUNCHER:=${GO_LDFLAGS}
GO_LDFLAGS_LAUNCHER+=$(addprefix -X main.,ConfigName=${CONFIGNAME} ExeName=proton-${APP})
BUILD_FLAGS+=-ldflags '${GO_LDFLAGS}'
BUILD_FLAGS_NOGUI+=-ldflags '${GO_LDFLAGS}'
BUILD_FLAGS_LAUNCHER+=-ldflags '${GO_LDFLAGS_LAUNCHER}'
DEPLOY_DIR:=cmd/${TARGET_CMD}/deploy
ICO_FILES:=
@ -81,13 +87,13 @@ build-ie-nogui:
TARGET_CMD=Import-Export $(MAKE) build-nogui
build-launcher:
go build -tags='${BUILD_TAGS}' -ldflags="-X 'main.ConfigName=bridge' -X 'main.ExeName=proton-bridge'" -o launcher-bridge cmd/launcher/main.go
go build ${BUILD_FLAGS_LAUNCHER} -o launcher-${APP} cmd/launcher/main.go
build-launcher-ie:
go build -tags='${BUILD_TAGS}' -ldflags="-X 'main.ConfigName=importExport' -X 'main.ExeName=Import-Export'" -o launcher-ie cmd/launcher/main.go
TARGET_CMD=Import-Export $(MAKE) build-launcher
versioner:
go build ${BUILD_FLAGS} ${GO_LDFLAGS} -o versioner utils/versioner/main.go
go build ${BUILD_FLAGS} -o versioner utils/versioner/main.go
hasher:
go build -o hasher utils/hasher/main.go

View File

@ -40,6 +40,7 @@ func createApp() *cli.App { // nolint[funlen]
app.Flags = []cli.Flag{
&cli.StringFlag{
Name: "root",
Aliases: []string{"C"},
Usage: "The root directory from which to begin recursive hashing",
Required: true,
},

View File

@ -166,12 +166,14 @@ func fetch(app, platform string) map[string]versionInfo {
res, err := resty.New().R().Get(url)
if err != nil {
println("fetch failed", err.Error())
return make(map[string]versionInfo)
}
var versionMap map[string]versionInfo
if err := json.Unmarshal(res.Body(), &versionMap); err != nil {
println("unmarshal failed", err.Error())
return make(map[string]versionInfo)
}