Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '_support/makegen.go')
-rw-r--r--_support/makegen.go54
1 files changed, 51 insertions, 3 deletions
diff --git a/_support/makegen.go b/_support/makegen.go
index 146197857..d0bef95dc 100644
--- a/_support/makegen.go
+++ b/_support/makegen.go
@@ -82,6 +82,18 @@ func (gm *gitalyMake) GitlabShellDir() string {
return filepath.Join(gm.SourceDir(), gm.GitlabShellRelDir())
}
+func (gm *gitalyMake) Git2GoVendorDir() string {
+ return filepath.Join(gm.BuildDir(), "../vendor/github.com/libgit2/git2go/vendor")
+}
+
+func (gm *gitalyMake) LibGit2Version() string {
+ return filepath.Join("0.27.8")
+}
+
+func (gm *gitalyMake) LibGit2SHA() string {
+ return filepath.Join("8313873d49dc01e8b880ec334d7430ae67496a89aaa8c6e7bbd3affb47a00c76")
+}
+
// SourceDir is the location of gitaly's files, inside the _build GOPATH.
func (gm *gitalyMake) SourceDir() string { return filepath.Join(gm.BuildDir(), "src", gm.Pkg()) }
@@ -102,6 +114,10 @@ func (gm *gitalyMake) GitTestRepo() string {
return filepath.Join(gm.TestRepoStoragePath(), "gitlab-git-test.git")
}
+func (gm *gitalyMake) GitalyRemotePackage() string {
+ return filepath.Join(gm.Pkg(), "cmd", "gitaly-remote")
+}
+
func (gm *gitalyMake) CommandPackages() []string {
if len(gm.commandPackages) > 0 {
return gm.commandPackages
@@ -113,6 +129,10 @@ func (gm *gitalyMake) CommandPackages() []string {
}
for _, dir := range entries {
+ //Do not build gitaly-remote by default
+ if dir.Name() == "gitaly-remote" {
+ continue
+ }
if !dir.IsDir() {
continue
}
@@ -234,6 +254,10 @@ func (gm *gitalyMake) AllPackages() []string {
var pkgs []string
for k := range pkgMap {
+ //Do not build gitaly-remote by default
+ if k == "gitlab.com/gitlab-org/gitaly/cmd/gitaly-remote" {
+ continue
+ }
pkgs = append(pkgs, k)
}
@@ -265,6 +289,30 @@ unexport GOBIN
.PHONY: all
all: build
+{{ .Git2GoVendorDir }}/.ok:
+ rm -rf {{ .Git2GoVendorDir }}
+ mkdir -p {{ .Git2GoVendorDir }}
+
+ cd {{ .Git2GoVendorDir }} && curl -L -o libgit2.tar.gz https://github.com/libgit2/libgit2/archive/v{{ .LibGit2Version }}.tar.gz
+ cd {{ .Git2GoVendorDir }} && echo '{{ .LibGit2SHA }} libgit2.tar.gz' | shasum -a256 -c -
+ cd {{ .Git2GoVendorDir }} && tar -xvf libgit2.tar.gz
+ cd {{ .Git2GoVendorDir }} && mv libgit2-{{ .LibGit2Version }} libgit2
+
+ mkdir -p {{ .Git2GoVendorDir }}/libgit2/build
+ mkdir -p {{ .Git2GoVendorDir }}/libgit2/install/lib
+ cd {{ .Git2GoVendorDir }}/libgit2/build && cmake -DTHREADSAFE=ON -DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=../install ..
+ cd {{ .Git2GoVendorDir }}/libgit2/build && cmake --build .
+
+ touch $@
+
+.PHONY: build-gitaly-remote
+build-gitaly-remote: {{ .Git2GoVendorDir }}/.ok
+ cd {{ .SourceDir }} && go install {{ .GoLdFlags }} -tags "$(BUILD_TAGS) static" {{ .GitalyRemotePackage }}
+
+.PHONY: test-gitaly-remote
+test-gitaly-remote: prepare-tests {{ .Git2GoVendorDir }}/.ok
+ @go test -tags "$(BUILD_TAGS) static" -count=1 {{ .GitalyRemotePackage }}
+
.PHONY: build
build: ../.ruby-bundle
# go install
@@ -337,7 +385,7 @@ prepare-tests: {{ .TestRepo }} {{ .GitTestRepo }} ../.ruby-bundle
.PHONY: test
test: test-go rspec rspec-gitlab-shell
-.PHONY: test-go
+.PHONY: test-go
test-go: prepare-tests
@go test -tags "$(BUILD_TAGS)" -count=1 {{ join .AllPackages " " }} # count=1 bypasses go 1.10 test caching
@@ -389,7 +437,7 @@ format: {{ .GoImports }}
.PHONY: staticcheck
staticcheck: {{ .StaticCheck }}
# staticcheck
- @cd {{ .SourceDir }} && {{ .StaticCheck }} {{ join .AllPackages " " }}
+ @cd {{ .SourceDir }} && {{ .StaticCheck }} -tags "$(BUILD_TAGS) static" {{ join .AllPackages " " }}
# Install staticcheck
{{ .StaticCheck }}:
@@ -451,7 +499,7 @@ docker:
{{ $pkg := .Pkg }}
{{ $goLdFlags := .GoLdFlags }}
{{ range $cmd := .Commands }}
- GOOS=linux GOARCH=amd64 go build {{ $goLdFlags }} -o "docker/bin/{{ $cmd }}" {{ $pkg }}/cmd/{{ $cmd }}
+ GOOS=linux GOARCH=amd64 go build -tags "$(BUILD_TAGS)" {{ $goLdFlags }} -o "docker/bin/{{ $cmd }}" {{ $pkg }}/cmd/{{ $cmd }}
{{ end }}
cp {{ .SourceDir }}/Dockerfile docker/
docker build -t gitlab/gitaly:{{ .VersionPrefixed }} -t gitlab/gitaly:latest docker/