mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:54:44 +01:00
Use build tags to control when and where cmount is built
This commit is contained in:
parent
7daf97f90a
commit
8f54dc06a2
@ -31,12 +31,12 @@ build_script:
|
|||||||
- make version > %TEMP%\version
|
- make version > %TEMP%\version
|
||||||
- set /p RCLONE_VERSION=<%TEMP%\version
|
- set /p RCLONE_VERSION=<%TEMP%\version
|
||||||
- set PATH=%PATHCC32%
|
- set PATH=%PATHCC32%
|
||||||
- go run bin/cross-compile.go -release beta-latest -git-log %TEMP%\git-log.txt -include "^windows/386" -cgo %RCLONE_VERSION%
|
- go run bin/cross-compile.go -release beta-latest -git-log %TEMP%\git-log.txt -include "^windows/386" -cgo -tags cmount %RCLONE_VERSION%
|
||||||
- set PATH=%PATHCC64%
|
- set PATH=%PATHCC64%
|
||||||
- go run bin/cross-compile.go -release beta-latest -git-log %TEMP%\git-log.txt -include "^windows/amd64" -cgo -no-clean %RCLONE_VERSION%
|
- go run bin/cross-compile.go -release beta-latest -git-log %TEMP%\git-log.txt -include "^windows/amd64" -cgo -no-clean -tags cmount %RCLONE_VERSION%
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- make quicktest
|
- make GOTAGS=cmount quicktest
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: rclone.exe
|
- path: rclone.exe
|
||||||
|
@ -18,6 +18,7 @@ jobs:
|
|||||||
xgo \
|
xgo \
|
||||||
--image=billziss/xgo-cgofuse \
|
--image=billziss/xgo-cgofuse \
|
||||||
--targets=darwin/386,darwin/amd64,linux/386,linux/amd64,windows/386,windows/amd64 \
|
--targets=darwin/386,darwin/amd64,linux/386,linux/amd64,windows/386,windows/amd64 \
|
||||||
|
-tags cmount \
|
||||||
.
|
.
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
|
@ -16,6 +16,8 @@ script:
|
|||||||
- make check
|
- make check
|
||||||
- make quicktest
|
- make quicktest
|
||||||
env:
|
env:
|
||||||
|
global:
|
||||||
|
- GOTAGS=cmount
|
||||||
matrix:
|
matrix:
|
||||||
secure: gU8gCV9R8Kv/Gn0SmCP37edpfIbPoSvsub48GK7qxJdTU628H0KOMiZW/T0gtV5d67XJZ4eKnhJYlxwwxgSgfejO32Rh5GlYEKT/FuVoH0BD72dM1GDFLSrUiUYOdoHvf/BKIFA3dJFT4lk2ASy4Zh7SEoXHG6goBlqUpYx8hVA=
|
secure: gU8gCV9R8Kv/Gn0SmCP37edpfIbPoSvsub48GK7qxJdTU628H0KOMiZW/T0gtV5d67XJZ4eKnhJYlxwwxgSgfejO32Rh5GlYEKT/FuVoH0BD72dM1GDFLSrUiUYOdoHvf/BKIFA3dJFT4lk2ASy4Zh7SEoXHG6goBlqUpYx8hVA=
|
||||||
addons:
|
addons:
|
||||||
@ -29,7 +31,7 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- os: osx
|
- os: osx
|
||||||
go: 1.8.1
|
go: 1.8.1
|
||||||
env: CGO_ENABLED=0
|
env: GOTAGS=""
|
||||||
deploy:
|
deploy:
|
||||||
provider: script
|
provider: script
|
||||||
script: make travis_beta
|
script: make travis_beta
|
||||||
|
24
Makefile
24
Makefile
@ -6,12 +6,16 @@ GO_VERSION := $(shell go version)
|
|||||||
GO_FILES := $(shell go list ./... | grep -v /vendor/ )
|
GO_FILES := $(shell go list ./... | grep -v /vendor/ )
|
||||||
GO_LATEST := $(findstring go1.8,$(GO_VERSION))
|
GO_LATEST := $(findstring go1.8,$(GO_VERSION))
|
||||||
BETA_URL := https://beta.rclone.org/$(TAG)/
|
BETA_URL := https://beta.rclone.org/$(TAG)/
|
||||||
|
# Pass in GOTAGS=xyz on the make command line to set build tags
|
||||||
|
ifdef GOTAGS
|
||||||
|
BUILDTAGS=-tags "$(GOTAGS)"
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: rclone vars version
|
.PHONY: rclone vars version
|
||||||
|
|
||||||
rclone:
|
rclone:
|
||||||
touch fs/version.go
|
touch fs/version.go
|
||||||
go install -v --ldflags "-s -X github.com/ncw/rclone/fs.Version=$(TAG)"
|
go install -v --ldflags "-s -X github.com/ncw/rclone/fs.Version=$(TAG)" $(BUILDTAGS)
|
||||||
cp -av `go env GOPATH`/bin/rclone .
|
cp -av `go env GOPATH`/bin/rclone .
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
@ -28,19 +32,19 @@ version:
|
|||||||
|
|
||||||
# Full suite of integration tests
|
# Full suite of integration tests
|
||||||
test: rclone
|
test: rclone
|
||||||
go test $(GO_FILES)
|
go test $(BUILDTAGS) $(GO_FILES)
|
||||||
cd fs && go run test_all.go
|
cd fs && go run $(BUILDTAGS) test_all.go
|
||||||
|
|
||||||
# Quick test
|
# Quick test
|
||||||
quicktest:
|
quicktest:
|
||||||
RCLONE_CONFIG="/notfound" go test $(GO_FILES)
|
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) $(GO_FILES)
|
||||||
if [ "$$CGO_ENABLED" != "0" ]; then RCLONE_CONFIG="/notfound" go test -cpu=2 -race $(GO_FILES) ; fi
|
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) -cpu=2 -race $(GO_FILES)
|
||||||
|
|
||||||
# Do source code quality checks
|
# Do source code quality checks
|
||||||
check: rclone
|
check: rclone
|
||||||
ifdef GO_LATEST
|
ifdef GO_LATEST
|
||||||
go tool vet -printfuncs Debugf,Infof,Logf,Errorf . 2>&1 | grep -E -v vendor/ ; test $$? -eq 1
|
go tool vet $(BUILDTAGS) -printfuncs Debugf,Infof,Logf,Errorf . 2>&1 | grep -E -v vendor/ ; test $$? -eq 1
|
||||||
errcheck $(GO_FILES)
|
errcheck $(BUILDTAGS) $(GO_FILES)
|
||||||
find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1
|
find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1
|
||||||
go list ./... | grep -v /vendor/ | xargs -i golint {} | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1
|
go list ./... | grep -v /vendor/ | xargs -i golint {} | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1
|
||||||
else
|
else
|
||||||
@ -101,10 +105,10 @@ upload_github:
|
|||||||
./bin/upload-github $(TAG)
|
./bin/upload-github $(TAG)
|
||||||
|
|
||||||
cross: doc
|
cross: doc
|
||||||
go run bin/cross-compile.go -release current $(TAG)
|
go run bin/cross-compile.go -release current $(BUILDTAGS) $(TAG)
|
||||||
|
|
||||||
beta:
|
beta:
|
||||||
go run bin/cross-compile.go $(TAG)β
|
go run bin/cross-compile.go $(BUILDTAGS) $(TAG)β
|
||||||
rclone -v copy build/ memstore:pub-rclone-org/$(TAG)β
|
rclone -v copy build/ memstore:pub-rclone-org/$(TAG)β
|
||||||
@echo Beta release ready at https://pub.rclone.org/$(TAG)%CE%B2/
|
@echo Beta release ready at https://pub.rclone.org/$(TAG)%CE%B2/
|
||||||
|
|
||||||
@ -118,7 +122,7 @@ upload_beta:
|
|||||||
|
|
||||||
travis_beta:
|
travis_beta:
|
||||||
git log $(LAST_TAG).. > /tmp/git-log.txt
|
git log $(LAST_TAG).. > /tmp/git-log.txt
|
||||||
go run bin/cross-compile.go -release beta-latest -git-log /tmp/git-log.txt -exclude "^windows/" $(TAG)β
|
go run bin/cross-compile.go -release beta-latest -git-log /tmp/git-log.txt -exclude "^windows/" $(BUILDTAGS) $(TAG)β
|
||||||
rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ memstore:beta-rclone-org/$(TAG)
|
rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ memstore:beta-rclone-org/$(TAG)
|
||||||
rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' build/ memstore:beta-rclone-org
|
rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' build/ memstore:beta-rclone-org
|
||||||
@echo Beta release ready at $(BETA_URL)
|
@echo Beta release ready at $(BETA_URL)
|
||||||
|
@ -27,6 +27,7 @@ var (
|
|||||||
exclude = flag.String("exclude", "^$", "os/arch regexp to exclude")
|
exclude = flag.String("exclude", "^$", "os/arch regexp to exclude")
|
||||||
cgo = flag.Bool("cgo", false, "Use cgo for the build")
|
cgo = flag.Bool("cgo", false, "Use cgo for the build")
|
||||||
noClean = flag.Bool("no-clean", false, "Don't clean the build directory before running.")
|
noClean = flag.Bool("no-clean", false, "Don't clean the build directory before running.")
|
||||||
|
tags = flag.String("tags", "", "Space separated list of build tags")
|
||||||
)
|
)
|
||||||
|
|
||||||
// GOOS/GOARCH pairs we build for
|
// GOOS/GOARCH pairs we build for
|
||||||
@ -100,6 +101,7 @@ func compileArch(version, goos, goarch, dir string) {
|
|||||||
"--ldflags", "-s -X github.com/ncw/rclone/fs.Version=" + version,
|
"--ldflags", "-s -X github.com/ncw/rclone/fs.Version=" + version,
|
||||||
"-i",
|
"-i",
|
||||||
"-o", output,
|
"-o", output,
|
||||||
|
"-tags", *tags,
|
||||||
"..",
|
"..",
|
||||||
}
|
}
|
||||||
env := []string{
|
env := []string{
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build linux darwin freebsd windows
|
// +build linux darwin freebsd windows
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//
|
//
|
||||||
// This uses the cgo based cgofuse library
|
// This uses the cgo based cgofuse library
|
||||||
|
|
||||||
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build linux darwin freebsd windows
|
// +build linux darwin freebsd windows
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build linux darwin freebsd windows
|
// +build linux darwin freebsd windows
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build linux darwin freebsd
|
// +build linux darwin freebsd
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Build for cmount for unsupported platforms to stop go complaining
|
// Build for cmount for unsupported platforms to stop go complaining
|
||||||
// about "no buildable Go source files "
|
// about "no buildable Go source files "
|
||||||
|
|
||||||
// +build !linux,!darwin,!freebsd,!windows !cgo
|
// +build !linux,!darwin,!freebsd,!windows !cgo !cmount
|
||||||
|
|
||||||
package cmount
|
package cmount
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// +build cmount
|
||||||
// +build cgo
|
// +build cgo
|
||||||
// +build windows
|
// +build windows
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user