Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
29781570
Commit
29781570
authored
Aug 17, 2018
by
Andrew Newdigate
Committed by
Nick Thomas
Aug 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements and cleanup to the Makefile
parent
ef80978f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
46 deletions
+82
-46
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+81
-46
No files found.
.gitignore
View file @
29781570
...
@@ -7,3 +7,4 @@ testdata/public
...
@@ -7,3 +7,4 @@ testdata/public
/_build
/_build
# Avoid distributing redigomock because it is GPLv2
# Avoid distributing redigomock because it is GPLv2
/vendor/github.com/rafaeljusto/redigomock
/vendor/github.com/rafaeljusto/redigomock
coverage.html
Makefile
View file @
29781570
PREFIX
=
/usr/local
PREFIX
=
/usr/local
VERSION
=
$(
shell
git describe
)
-
$(
shell
date
-u
+%Y%m%d.%H%M%S
)
PKG
:=
gitlab.com/gitlab-org/gitlab-workhorse
BUILD_DIR
=
$(
shell
pwd
)
BUILD_DIR
:=
$(CURDIR)
export
GOPATH
=
${BUILD_DIR}
/_build
TARGET_DIR
:=
$(BUILD_DIR)
/_build
export
PATH
:=
${GOPATH}
/bin:
${PATH}
TARGET_SETUP
:=
$(TARGET_DIR)
/.ok
GOBUILD
=
go build
-ldflags
"-X main.Version=
${VERSION}
"
BIN_BUILD_DIR
:=
$(TARGET_DIR)
/bin
PKG
=
gitlab.com/gitlab-org/gitlab-workhorse
PKG_BUILD_DIR
:=
$(TARGET_DIR)
/src/
$(PKG)
PKG_ALL
=
$(
shell
GOPATH
=
${GOPATH}
go list
${PKG}
/... |
grep
-v
/vendor/
)
COVERAGE_DIR
:=
$(TARGET_DIR)
/cover
EXE_ALL
=
gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
VERSION
:=
$(
shell
git describe
)
-
$(
shell
date
-u
+%Y%m%d.%H%M%S
)
GOBUILD
:=
go build
-ldflags
"-X main.Version=
$(VERSION)
"
EXE_ALL
:=
gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
# Some users may have these variables set in their environment, but doing so could break
# their build process, so unset then
un
export
GOROOT
un
export
GOBIN
export
GOPATH
:=
$(TARGET_DIR)
export
PATH
:=
$(GOPATH)
/bin:
$(PATH)
# Returns a list of all non-vendored (local packages)
LOCAL_PACKAGES
=
$(
shell
cd
"
$(PKG_BUILD_DIR)
"
&&
GOPATH
=
$(GOPATH)
go list ./... |
grep
-v
-e
'^
$(PKG)
/vendor/'
-e
'^
$(PKG)
/ruby/'
)
.NOTPARALLEL
:
.PHONY
:
all
all
:
clean-build $(EXE_ALL)
all
:
clean-build $(EXE_ALL)
gitlab-zip-cat
:
${BUILD_DIR}/_build/.sync $(shell find cmd/gitlab-zip-cat/ -name '*.go')
$(TARGET_SETUP)
:
${GOBUILD}
-o
${BUILD_DIR}
/
$@
${PKG}
/cmd/
$@
@
echo
"### Setting up
$(TARGET_SETUP)
"
rm
-rf
$(TARGET_DIR)
mkdir
-p
"
$(
dir
$(PKG_BUILD_DIR)
)
"
ln
-sf
../../../..
"
$(PKG_BUILD_DIR)
"
mkdir
-p
"
$(BIN_BUILD_DIR)
"
touch
"
$(TARGET_SETUP)
"
gitlab-zip-
metadata
:
${BUILD_DIR}/_build/.sync $(shell find cmd/gitlab-zip-metadata
/ -name '*.go')
gitlab-zip-
cat
:
$(TARGET_SETUP) $(shell find cmd/gitlab-zip-cat
/ -name '*.go')
$
{GOBUILD}
-o
${BUILD_DIR}
/
$@
${PKG}
/cmd/
$@
$
(GOBUILD)
-o
$(BUILD_DIR)
/
$@
$(PKG)
/cmd/
$@
gitlab-
workhorse
:
${BUILD_DIR}/_build/.sync $(shell find . -name '*.go' | grep -v '^
\.
/_
')
gitlab-
zip-metadata
:
$(TARGET_SETUP) $(shell find cmd/gitlab-zip-metadata/ -name '*.go
')
$
{GOBUILD}
-o
${BUILD_DIR}
/
$@
${PKG}
$
(GOBUILD)
-o
$(BUILD_DIR)
/
$@
$(PKG)
/cmd/
$@
install
:
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
gitlab-workhorse
:
$(TARGET_SETUP) $(shell find . -name '*.go' | grep -v '^
\.
/_')
mkdir
-p
$(DESTDIR)${PREFIX}
/bin/
$(GOBUILD)
-o
$(BUILD_DIR)
/
$@
$(PKG)
cd
${BUILD_DIR}
&&
install
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
${DESTDIR}${PREFIX}
/bin/
${BUILD_DIR}/_build/.sync
:
.PHONY
:
install
mkdir
-p
${BUILD_DIR}
/_build/src/
${PKG}
install
:
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
tar
-cf
-
--exclude
_build
--exclude
.git
.
|
(
cd
${BUILD_DIR}
/_build/src/
${PKG}
&&
tar
-xf
-
)
@
echo
"### install"
touch
$@
mkdir
-p
$(DESTDIR)$(PREFIX)
/bin/
cd
$(BUILD_DIR)
&&
install
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
$(DESTDIR)$(PREFIX)
/bin/
.PHONY
:
test
.PHONY
:
test
test
:
clean-build clean-workhorse govendor prepare-tests
test
:
$(TARGET_SETUP) govendor prepare-tests
go
fmt
${PKG_ALL}
|
awk
'{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
@
echo
"### verifying formatting with go fmt"
@
go
fmt
$(LOCAL_PACKAGES)
|
awk
'{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
_support/detect-context.sh
_support/detect-context.sh
cd
${GOPATH}
/src/
${PKG}
&&
govendor
sync
cp
$(EXE_ALL)
${GOPATH}
/src/
${PKG}
@echo
"### running govendor sync"
go
test
${PKG_ALL}
cd
$(PKG_BUILD_DIR)
&&
govendor
sync
@echo
"### running tests"
@go
test
$(LOCAL_PACKAGES)
@echo
SUCCESS
@echo
SUCCESS
.PHONY
:
govendor
.PHONY
:
govendor
govendor
:
govendor
:
$(TARGET_SETUP)
command
-v
govendor
||
go get github.com/kardianos/govendor
@
command
-v
govendor
||
go get github.com/kardianos/govendor
coverage
:
.PHONY
:
coverage
go
test
-cover
-coverprofile
=
test.coverage
coverage
:
$(TARGET_SETUP) prepare-tests
@
echo
"### coverage"
@
go
test
-cover
-coverprofile
=
test.coverage
$(LOCAL_PACKAGES)
go tool cover
-html
=
test.coverage
-o
coverage.html
go tool cover
-html
=
test.coverage
-o
coverage.html
rm
-f
test.coverage
rm
-f
test.coverage
.PHONY
:
fmt
fmt
:
fmt
:
go
fmt
${PKG_ALL}
@
echo
"### fmt"
@
go
fmt
$(LOCAL_PACKAGES)
.PHONY
:
clean
.PHONY
:
clean
clean
:
clean-workhorse clean-build
clean
:
clean-workhorse clean-build
@
echo
"### clean"
rm
-rf
testdata/data testdata/scratch
rm
-rf
testdata/data testdata/scratch
.PHONY
:
clean-workhorse
.PHONY
:
clean-workhorse
clean-workhorse
:
clean-workhorse
:
cd
${BUILD_DIR}
&&
rm
-f
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
@
echo
"### clean-workhorse"
rm
-f
$(EXE_ALL)
.PHONY
:
release
release
:
release
:
@
echo
"### release"
sh _support/release.sh
sh _support/release.sh
.PHONY
:
clean-build
.PHONY
:
clean-build
clean-build
:
clean-build
:
rm
-rf
${BUILD_DIR}
/_build
@
echo
"### clean-build"
rm
-rf
$(TARGET_DIR)
.PHONY
:
prepare-tests
.PHONY
:
prepare-tests
prepare-tests
:
testdata/data/group/test.git $(EXE_ALL)
prepare-tests
:
testdata/data/group/test.git $(EXE_ALL)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment