From 14a03463751db6bc7514964d12444e3c42be87c4 Mon Sep 17 00:00:00 2001 From: Manfred Touron <94029+moul@users.noreply.github.com> Date: Fri, 26 Jun 2020 18:20:40 +0200 Subject: [PATCH] chore: remove bazel Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com> --- .../linux/debian/bazel_requirements.txt | 1 - .buildkite/agent_setup/linux/user/.bazelrc | 1 - .github/CODEOWNERS | 4 +- BUILD.bazel | 12 - Makefile | 2 - WORKSPACE | 19 - bazel.make | 122 ------ go/.bazel_fix_commands.json | 5 - go/.gitignore | 2 - go/BUILD.bazel | 12 - go/Makefile | 103 ++---- go/config.bzl | 42 --- go/gen.sum | 2 +- go/repositories.bzl | 55 --- .../PR-554-rebase-master.patch | 149 -------- .../PR-2181-rebase-0.20.1.patch | 347 ------------------ .../PR-2181-rebase-0.23.1.patch | 335 ----------------- .../PR-2181-rebase-master.patch | 347 ------------------ js/.bazelignore | 1 - js/.bazelrc | 6 - js/README.md | 1 - js/packages/berty-app/.bazelrc | 6 - js/packages/berty-app/BUILD.bazel | 31 -- js/packages/berty-app/WORKSPACE | 45 --- js/packages/berty-app/android/BUILD.bazel | 4 - .../berty-app/android/app/build_defs.bzl | 19 - .../android/app/src/main/BUILD.bazel | 54 --- js/packages/berty-app/repositories.bzl | 18 - js/packages/go-bridge/.bazelrc | 6 - js/packages/go-bridge/BUILD.bazel | 18 - js/packages/go-bridge/WORKSPACE | 60 --- js/packages/go-bridge/android/BUILD.bazel | 51 --- js/packages/go-bridge/config.bzl | 15 - js/packages/go-bridge/ios/BUILD.bazel | 8 - js/packages/go-bridge/ios/debug.bzl | 71 ---- js/packages/go-bridge/ios/framework.bzl | 222 ----------- js/packages/go-bridge/repositories.bzl | 45 --- .../android/app/build_defs.bzl | 19 - ...m_github_spacemonkeygo_openssl.BUILD.bazel | 65 ---- tool/docker-bazel/Dockerfile | 33 -- tool/docker-bazel/Makefile | 10 - tool/test/experiment/BUILD.bazel | 3 - tool/test/experiment/dht/BUILD.bazel | 8 - .../experiment/dht/src/bittorrent/BUILD.bazel | 9 - .../test/experiment/dht/src/chord/BUILD.bazel | 9 - .../experiment/dht/src/gnunet/BUILD.bazel | 9 - .../experiment/dht/src/libp2p/BUILD.bazel | 9 - .../experiment/dht/src/matrix/BUILD.bazel | 23 -- .../experiment/dht/src/opendht/BUILD.bazel | 9 - tool/test/experiment/dht/test/BUILD.bazel | 15 - 50 files changed, 36 insertions(+), 2426 deletions(-) delete mode 100644 .buildkite/agent_setup/linux/debian/bazel_requirements.txt delete mode 100644 .buildkite/agent_setup/linux/user/.bazelrc delete mode 100644 BUILD.bazel delete mode 100644 WORKSPACE delete mode 100644 bazel.make delete mode 100644 go/.bazel_fix_commands.json delete mode 100644 go/.gitignore delete mode 100644 go/BUILD.bazel delete mode 100644 go/config.bzl delete mode 100644 go/repositories.bzl delete mode 100644 go/third_party/build_bazel_rules_apple/PR-554-rebase-master.patch delete mode 100644 go/third_party/io_bazel_rules_go/PR-2181-rebase-0.20.1.patch delete mode 100644 go/third_party/io_bazel_rules_go/PR-2181-rebase-0.23.1.patch delete mode 100644 go/third_party/io_bazel_rules_go/PR-2181-rebase-master.patch delete mode 100644 js/.bazelignore delete mode 100644 js/.bazelrc delete mode 100644 js/packages/berty-app/.bazelrc delete mode 100644 js/packages/berty-app/BUILD.bazel delete mode 100644 js/packages/berty-app/WORKSPACE delete mode 100644 js/packages/berty-app/android/BUILD.bazel delete mode 100644 js/packages/berty-app/android/app/build_defs.bzl delete mode 100644 js/packages/berty-app/android/app/src/main/BUILD.bazel delete mode 100644 js/packages/berty-app/repositories.bzl delete mode 100644 js/packages/go-bridge/.bazelrc delete mode 100644 js/packages/go-bridge/BUILD.bazel delete mode 100644 js/packages/go-bridge/WORKSPACE delete mode 100644 js/packages/go-bridge/android/BUILD.bazel delete mode 100644 js/packages/go-bridge/config.bzl delete mode 100644 js/packages/go-bridge/ios/BUILD.bazel delete mode 100644 js/packages/go-bridge/ios/debug.bzl delete mode 100644 js/packages/go-bridge/ios/framework.bzl delete mode 100644 js/packages/go-bridge/repositories.bzl delete mode 100644 js/packages/storybook-mobile/android/app/build_defs.bzl delete mode 100644 tool/build/bazel/com_github_spacemonkeygo_openssl.BUILD.bazel delete mode 100644 tool/docker-bazel/Dockerfile delete mode 100644 tool/docker-bazel/Makefile delete mode 100644 tool/test/experiment/BUILD.bazel delete mode 100644 tool/test/experiment/dht/BUILD.bazel delete mode 100644 tool/test/experiment/dht/src/bittorrent/BUILD.bazel delete mode 100644 tool/test/experiment/dht/src/chord/BUILD.bazel delete mode 100644 tool/test/experiment/dht/src/gnunet/BUILD.bazel delete mode 100644 tool/test/experiment/dht/src/libp2p/BUILD.bazel delete mode 100644 tool/test/experiment/dht/src/matrix/BUILD.bazel delete mode 100644 tool/test/experiment/dht/src/opendht/BUILD.bazel delete mode 100644 tool/test/experiment/dht/test/BUILD.bazel diff --git a/.buildkite/agent_setup/linux/debian/bazel_requirements.txt b/.buildkite/agent_setup/linux/debian/bazel_requirements.txt deleted file mode 100644 index 51fa1544d3..0000000000 --- a/.buildkite/agent_setup/linux/debian/bazel_requirements.txt +++ /dev/null @@ -1 +0,0 @@ -unzip libssl-dev g++ zip diff --git a/.buildkite/agent_setup/linux/user/.bazelrc b/.buildkite/agent_setup/linux/user/.bazelrc deleted file mode 100644 index 2d27116d5f..0000000000 --- a/.buildkite/agent_setup/linux/user/.bazelrc +++ /dev/null @@ -1 +0,0 @@ -build --disk_cache=~/.cache/bazel-disk-cache diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f64daa8820..b122ff2187 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -31,10 +31,8 @@ ## # build -WORKSPACE @berty/build-owners -*.bazel @berty/build-owners -bazel.make @berty/build-owners Makefile @berty/build-owners +*.mk @berty/build-owners ## ## by specific domain diff --git a/BUILD.bazel b/BUILD.bazel deleted file mode 100644 index 99462ac95f..0000000000 --- a/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@bazel_gazelle//:def.bzl", "gazelle") - -# gazelle:prefix berty.tech/berty/v2 -# gazelle:proto disable_global -# gazelle:exclude api -# gazelle:exclude js -# gazelle:exclude doc -# gazelle:exclude test -gazelle( - name = "gazelle", - external = "vendored", -) diff --git a/Makefile b/Makefile index 55f4b79705..9e743ecd37 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,6 @@ regenerate: docker.build: cd go; make docker.build -include bazel.make - .PHONY: goreleaser.dry-run goreleaser.dry-run: goreleaser release --rm-dist --snapshot --skip-publish diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index 524be3e9d6..0000000000 --- a/WORKSPACE +++ /dev/null @@ -1,19 +0,0 @@ -workspace(name = "berty") - -load("@berty//go:repositories.bzl", "berty_go_repositories") - -# fetch berty repos - -berty_go_repositories() - -# check bazel version - -load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version") - -check_bazel_version("2.0.0") - -# config go berty - -load("@berty//go:config.bzl", "berty_go_config") - -berty_go_config() diff --git a/bazel.make b/bazel.make deleted file mode 100644 index bea160f104..0000000000 --- a/bazel.make +++ /dev/null @@ -1,122 +0,0 @@ -BAZEL ?= bazel -BAZEL_ARGS ?= -BAZEL_CMD_ARGS ?= -GO ?= go -GO_TEST_OPTS ?= -test.timeout=180s -GOPATH ?= $(HOME)/go -IBAZEL ?= ibazel --run_output_interactive=false --run_output -USE_IBAZEL ?= false -BAZEL_WRAPPER ?= $(BAZEL) - -ifeq ($(USE_IBAZEL),true) -BAZEL_WRAPPER=$(IBAZEL) -endif - -## -## Functions -## - -bazel = $(BAZEL_WRAPPER) $(BAZEL_ARGS) $(1) $(BAZEL_CMD_ARGS) $(2) -check-program = $(foreach exec,$(1),$(if $(shell PATH="$(PATH)" which $(exec)),,$(error "No $(exec) in PATH"))) - - -SAMPLE_GAZELLE_GENERATED_FILE ?= pkg/bertyprotocol/BUILD.bazel # should be the path of a git-ignored bazel-generated file -VENDOR_BAZEL_OVERRIDEN_FILES = vendor/github.com/libp2p/go-openssl/BUILD.bazel - -## -## Main -## - -.PHONY: bazel.build -bazel.build: bazel.generate - $(call check-program, $(BAZEL)) - $(call bazel, build, //go/...) - -.PHONY: bazel.daemon -bazel.daemon: bazel.generate - $(call check-program, $(BAZEL)) - $(call bazel, run, //go/cmd/berty -- daemon) - -.PHONY: bazel.mini -bazel.mini: bazel.generate - $(call check-program, $(BAZEL)) - $(call bazel, run, //go/cmd/berty -- mini) - -.PHONY: bazel.banner -bazel.banner: bazel.generate - $(call check-program, $(BAZEL)) - $(call bazel, run, //go/cmd/berty -- banner) - -.PHONY: bazel.unittest -bazel.unittest: bazel.generate - $(call check-program, $(BAZEL)) - $(call bazel, test, --cache_test_results=no --test_output=streamed //go/...) - -.PHONY: bazel.rdvp -bazel.rdvp: bazel.generate - $(call check-program, $(BAZEL)) - $(call bazel, run, //go/cmd/rdvp -- serve) - - -.PHONY: bazel.generate -bazel.generate: pb.generate $(SAMPLE_GAZELLE_GENERATED_FILE) - -.PHONY: bazel.clean -bazel.clean: - rm -rf go/{internal,cmd,pkg}/**/BUILD.bazel - -.PHONY: bazel.clean -bazel.fclean: - $(call check-program, $(BAZEL)) - $(BAZEL) clean --expunge - rm -rf go/{internal,cmd,pkg}/**/BUILD.bazel - -## -## ibazel -## - -.PHONY: ibazel.daemon -ibazel.daemon: bazel.generate - USE_IBAZEL=true make bazel.daemon - -.PHONY: ibazel.mini -ibazel.mini: bazel.generate - USE_IBAZEL=true make bazel.mini - -.PHONY: ibazel.build -ibazel.build: bazel.generate - USE_IBAZEL=true make bazel.build - -.PHONY: ibazel.banner -ibazel.banner: bazel.generate - USE_IBAZEL=true make bazel.banner - -.PHONY: ibazel.unittest -ibazel.unittest: bazel.generate - USE_IBAZEL=true make bazel.unittest - -## -## Deps -## - -vendor/github.com/libp2p/go-openssl/BUILD.bazel: build/bazel/com_github_libp2p_go_openssl.BUILD.bzl vendor - cp $< $@ - -$(SAMPLE_GAZELLE_GENERATED_FILE): WORKSPACE vendor $(VENDOR_BAZEL_OVERRIDEN_FILES) - $(call check-program, $(BAZEL)) - find vendor -name BUILD.bazel -delete - $(BAZEL) $(BAZEL_ARGS) run $(BAZEL_CMD_ARGS) //:gazelle - -vendor: go.mod - $(call check-program, $(GO)) - GO111MODULE=on $(GO) mod vendor - touch $@ - -.PHONY: tidy -tidy: pb.generate - $(call check-program, $(GO)) - GO111MODULE=on $(GO) mod tidy - -.PHONY: pb.generate -pb.generate: - cd go; make pb.generate diff --git a/go/.bazel_fix_commands.json b/go/.bazel_fix_commands.json deleted file mode 100644 index 7507f876e7..0000000000 --- a/go/.bazel_fix_commands.json +++ /dev/null @@ -1,5 +0,0 @@ -[{ - "regex": "^No dependencies were provided.", - "command": "bazel", - "args": ["run", "//:gazelle"] -}] diff --git a/go/.gitignore b/go/.gitignore deleted file mode 100644 index 392b3744ed..0000000000 --- a/go/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bazel-* -/*/**/BUILD.bazel diff --git a/go/BUILD.bazel b/go/BUILD.bazel deleted file mode 100644 index 66efcc66c4..0000000000 --- a/go/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@com_github_atlassian_bazel_tools//golangcilint:def.bzl", "golangcilint") - -golangcilint( - name = "golangcilint", - config = "//:.golangci.yml", - paths = [ - "cmd/...", - "pkg/...", - "internal/...", - ], - prefix = "berty.tech/berty/go", -) diff --git a/go/Makefile b/go/Makefile index 91b2e17a11..bc6c39ebdc 100644 --- a/go/Makefile +++ b/go/Makefile @@ -3,35 +3,22 @@ ## GO ?= go -GO_TEST_OPTS ?= -test.timeout=300s -race -cover -coverprofile=coverage.txt -covermode=atomic -GO_TEST_ENV ?= DONT_SKIP_UNSTABLE=0 GOPATH ?= $(HOME)/go +GO_TEST_OPTS ?= -test.timeout=300s -race -cover -coverprofile=coverage.txt -covermode=atomic +GO_TEST_PATH ?= ./... +PROTOC_OPTS ?= -I ../vendor/github.com/grpc-ecosystem/grpc-gateway:../api:../vendor:/protobuf -## -## Functions -## - -check-program = $(foreach exec,$(1),$(if $(shell PATH="$(PATH)" which $(exec)),,$(error "No $(exec) in PATH"))) +BUILD_DATE ?= `date +%s` +VCS_REF ?= `git rev-parse --short HEAD` +VERSION ?= `git describe --tags --always` +LDFLAGS ?= -ldflags="-X berty.tech/berty/v2/go/pkg/bertymessenger.VcsRef=$(VCS_REF) -X berty.tech/berty/v2/go/pkg/bertymessenger.Version=$(VERSION) -X berty.tech/berty/v2/go/pkg/bertymessenger.BuildTime=$(BUILD_DATE)" ## ## General rules ## -.PHONY: build -build: - $(MAKE) -C .. bazel.build - -.PHONY: run -run: - $(MAKE) -C .. bazel.daemon - -.PHONY: dev -dev: - $(MAKE) -C .. ibazel.daemon - -.PHONY: autotest -autotest: - $(MAKE) -C .. ibazel.unittest +.PHONY: test +test: unittest lint tidy .PHONY: unittest unittest: go.unittest @@ -48,62 +35,41 @@ install: go.install .PHONY: clean clean: rm -rf vendor/ out/ - $(MAKE) -C .. bazel.clean - -.PHONY: fclean -fclean: clean - $(MAKE) -C .. bazel.fclean .PHONY: re -re: clean build +re: clean generate install +.PHONY: tidy +tidy: go.tidy + +.PHONY: lint +lint: go.lint ## -## Go rules +## Other rules ## +check-program = $(foreach exec,$(1),$(if $(shell PATH="$(PATH)" which $(exec)),,$(error "No $(exec) in PATH"))) + +.PHONY: go.tidy +go.tidy: pb.generate + $(call check-program, $(GO)) + GO111MODULE=on $(GO) mod tidy + .PHONY: go.lint go.lint: pb.generate $(call check-program, golangci-lint) golangci-lint run --timeout=120s --verbose ./... .PHONY: go.unittest -go.unittest: GO_TEST_PATH ?= ./... go.unittest: pb.generate $(call check-program, $(GO)) $(GO_TEST_ENV) GO111MODULE=on $(GO) test $(GO_TEST_OPTS) $(GO_TEST_PATH) - -VERSION ?= `git describe --tags --always` -VCS_REF ?= `git rev-parse --short HEAD` -BUILD_DATE ?= `date +%s` -GO_INSTALL_OPTS = -ldflags="-X berty.tech/berty/v2/go/pkg/bertymessenger.VcsRef=$(VCS_REF) -X berty.tech/berty/v2/go/pkg/bertymessenger.Version=$(VERSION) -X berty.tech/berty/v2/go/pkg/bertymessenger.BuildTime=$(BUILD_DATE)" - -.PHONY: go.unittest.watch -go.unittest: GO_TEST_PATH ?= ./... -go.unittest.watch: - @if ! command -v watchman &>/dev/null; then brew install watchman; fi - while true; \ - do clear; \ - GO_TEST_PATH=$(GO_TEST_PATH) make go.unittest; \ - watchman-wait . -p "**/*.go"; \ - done - .PHONY: go.install go.install: pb.generate $(call check-program, $(GO)) - GO111MODULE=on $(GO) install $(GO_INSTALL_OPTS) -v ./cmd/... - -.PHONY: test -test: unittest lint tidy - -.PHONY: lint -lint: go.lint - -.PHONY: tidy -tidy: pb.generate - $(call check-program, $(GO)) - GO111MODULE=on $(GO) mod tidy + GO111MODULE=on $(GO) install $(LDFLAGS) -v ./cmd/... .PHONY: docker.build docker.build: pb.generate @@ -123,9 +89,9 @@ docker.fast: pb.generate ## Code gen ## -PROTOS_SRC := $(wildcard ../api/*.proto) $(wildcard ../api/go-internal/*.proto) -GEN_SRC := $(PROTOS_SRC) Makefile -GEN_SUM := gen.sum +protos_src := $(wildcard ../api/*.proto) $(wildcard ../api/go-internal/*.proto) +gen_src := $(protos_src) Makefile +gen_sum := gen.sum .PHONY: gen.clean gen.clean: @@ -133,10 +99,10 @@ gen.clean: .PHONY: pb.generate pb.generate: gen.sum -$(GEN_SUM): $(GEN_SRC) +$(gen_sum): $(gen_src) $(call check-program, shasum docker $(GO)) - @shasum $(GEN_SRC) | sort -k 2 > $(GEN_SUM).tmp - @diff -q $(GEN_SUM).tmp $(GEN_SUM) || ( \ + @shasum $(gen_src) | sort -k 2 > $(gen_sum).tmp + @diff -q $(gen_sum).tmp $(gen_sum) || ( \ uid=`id -u`; \ set -xe; \ $(GO) mod vendor; \ @@ -151,11 +117,10 @@ $(GEN_SUM): $(GEN_SRC) $(MAKE) tidy \ ) -PROTOC_OPTS = -I ../vendor/github.com/grpc-ecosystem/grpc-gateway:../api:../vendor:/protobuf .PHONY: generate_local generate_local: $(call check-program, goimports shasum protoc) - @set -e; for proto in $(PROTOS_SRC); do ( set -xe; \ + @set -e; for proto in $(protos_src); do ( set -xe; \ protoc $(PROTOC_OPTS) \ --gogo_out="plugins=grpc:$(GOPATH)/src" "$$proto" \ --grpc-gateway_out="logtostderr=true:$(GOPATH)/src" \ @@ -167,12 +132,12 @@ generate_local: @### end of custom goimports -w ./pkg ./cmd ./internal - shasum $(GEN_SRC) | sort -k 2 > $(GEN_SUM).tmp - mv $(GEN_SUM).tmp $(GEN_SUM) + shasum $(gen_src) | sort -k 2 > $(gen_sum).tmp + mv $(gen_sum).tmp $(gen_sum) ## ## Dev ## print-%: - @echo $*: $($*) + @echo $* = $($*) diff --git a/go/config.bzl b/go/config.bzl deleted file mode 100644 index ba7ca9ae6d..0000000000 --- a/go/config.bzl +++ /dev/null @@ -1,42 +0,0 @@ -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") -load("@com_github_atlassian_bazel_tools//golangcilint:deps.bzl", "golangcilint_dependencies") - -def berty_go_config(): - # go config - - go_rules_dependencies() - - go_register_toolchains(go_version = "1.14.3") - - # gazelle config - - gazelle_dependencies() - - # golangci-lint - - golangcilint_dependencies() - - # grpc - - go_repository( - name = "org_golang_google_grpc", - build_file_proto_mode = "disable", - importpath = "google.golang.org/grpc", - sum = "h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=", - version = "v1.22.0", - ) - - go_repository( - name = "org_golang_x_net", - importpath = "golang.org/x/net", - sum = "h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=", - version = "v0.0.0-20190311183353-d8887717615a", - ) - - go_repository( - name = "org_golang_x_text", - importpath = "golang.org/x/text", - sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=", - version = "v0.3.0", - ) diff --git a/go/gen.sum b/go/gen.sum index 33241eb3a9..a32326bf36 100644 --- a/go/gen.sum +++ b/go/gen.sum @@ -4,4 +4,4 @@ b60b4f16d4cd499d0b5a3f7b03bc5d5ebc10889c ../api/bertyprotocol.proto f8f05c10a1cf5c8b42f9bde6bb572d0bc687979e ../api/errcode.proto 5589d560e33f2da4a466ad965eb9c8bd3d7612cd ../api/go-internal/handshake.proto 6708726752b27f538549fe0c30b8f73f7e3574a5 ../api/go-internal/records.proto -d67a3a825a67a8eac77dd04de65860148f61ce4e Makefile +3662f8093cff11f8282dfc4110be8f0df04337e6 Makefile diff --git a/go/repositories.bzl b/go/repositories.bzl deleted file mode 100644 index 1028d58b86..0000000000 --- a/go/repositories.bzl +++ /dev/null @@ -1,55 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -def berty_go_repositories(): - # utils - maybe( - git_repository, - name = "bazel_skylib", - remote = "https://github.com/bazelbuild/bazel-skylib", - commit = "e59b620b392a8ebbcf25879fc3fde52b4dc77535", - shallow_since = "1570639401 -0400", - ) - maybe( - http_archive, - name = "build_bazel_rules_nodejs", - sha256 = "ad4be2c6f40f5af70c7edf294955f9d9a0222c8e2756109731b25f79ea2ccea0", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.38.3/rules_nodejs-0.38.3.tar.gz"], - ) - - # go - maybe( - http_archive, - name = "io_bazel_rules_go", - sha256 = "87f0fb9747854cb76a0a82430adccb6269f7d394237104a4523b51061c469171", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.23.1/rules_go-v0.23.1.tar.gz", - "https://github.com/bazelbuild/rules_go/releases/download/v0.23.1/rules_go-v0.23.1.tar.gz", - ], - patches = [ - "@berty//go:third_party/io_bazel_rules_go/PR-2181-rebase-0.23.1.patch", - ], - patch_tool = "git", - patch_args = ["apply"], - ) - - # gazelle - maybe( - http_archive, - name = "bazel_gazelle", - sha256 = "bfd86b3cbe855d6c16c6fce60d76bd51f5c8dbc9cfcaef7a2bb5c1aafd0710e8", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.0/bazel-gazelle-v0.21.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.0/bazel-gazelle-v0.21.0.tar.gz", - ], - ) - - # golangci-lint - maybe( - http_archive, - name = "com_github_atlassian_bazel_tools", - strip_prefix = "bazel-tools-a2138311856f55add11cd7009a5abc8d4fd6f163", - sha256 = "9db3d3eededb398ae7d5a00b428d32b59577da0b3f4b4eb07daf710509008bfc", - urls = ["https://github.com/atlassian/bazel-tools/archive/a2138311856f55add11cd7009a5abc8d4fd6f163.zip"], - ) diff --git a/go/third_party/build_bazel_rules_apple/PR-554-rebase-master.patch b/go/third_party/build_bazel_rules_apple/PR-554-rebase-master.patch deleted file mode 100644 index e2abd75e10..0000000000 --- a/go/third_party/build_bazel_rules_apple/PR-554-rebase-master.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 0e819e967266e99c2238a206f72fc94589a218c5 Mon Sep 17 00:00:00 2001 -From: Steeve Morin -Date: Tue, 20 Aug 2019 16:51:34 +0200 -Subject: [PATCH] Fetch public headers via the multi arch split - -Fetch headers via the apple_common.multi_arch_split so that proper -transitions are done. Since headers are assumed to be the same for all -architectures, only the headers from the first split will be used. - -This is mostly useful if headers are generated. - -Fixes #466 - -Signed-off-by: Steeve Morin ---- - apple/internal/ios_rules.bzl | 8 ++++++-- - apple/internal/rule_factory.bzl | 4 ++++ - apple/internal/tvos_rules.bzl | 6 +++++- - apple/internal/utils/split.bzl | 25 +++++++++++++++++++++++++ - 4 files changed, 40 insertions(+), 3 deletions(-) - create mode 100644 apple/internal/utils/split.bzl - -diff --git a/apple/internal/ios_rules.bzl b/apple/internal/ios_rules.bzl -index 986e59f..d771865 100644 ---- a/apple/internal/ios_rules.bzl -+++ b/apple/internal/ios_rules.bzl -@@ -58,6 +58,10 @@ load( - "@build_bazel_rules_apple//apple/internal/aspects:swift_static_framework_aspect.bzl", - "SwiftStaticFrameworkInfo", - ) -+load( -+ "@build_bazel_rules_apple//apple/internal/utils:split.bzl", -+ "split", -+) - load( - "@build_bazel_rules_apple//apple:providers.bzl", - "IosApplicationBundleInfo", -@@ -215,7 +219,7 @@ def _ios_framework_impl(ctx): - embeddable_targets = ctx.attr.frameworks, - ), - partials.extension_safe_validation_partial(is_extension_safe = ctx.attr.extension_safe), -- partials.framework_headers_partial(hdrs = ctx.files.hdrs), -+ partials.framework_headers_partial(hdrs = split.files(ctx.attr.hdrs)), - partials.framework_provider_partial( - binary_provider = binary_target[apple_common.AppleDylibBinary], - ), -@@ -328,7 +332,7 @@ def _ios_static_framework_impl(ctx): - else: - processor_partials.append( - partials.static_framework_header_modulemap_partial( -- hdrs = ctx.files.hdrs, -+ hdrs = split.files(ctx.attr.hdrs), - umbrella_header = ctx.file.umbrella_header, - binary_objc_provider = binary_target[apple_common.Objc], - ), -diff --git a/apple/internal/rule_factory.bzl b/apple/internal/rule_factory.bzl -index 81f0eee..4e609ac 100644 ---- a/apple/internal/rule_factory.bzl -+++ b/apple/internal/rule_factory.bzl -@@ -537,6 +537,7 @@ Required. - # what to do with this. - "hdrs": attr.label_list( - allow_files = [".h"], -+ cfg = apple_common.multi_arch_split, - ), - "extension_safe": attr.bool( - default = False, -@@ -550,6 +551,7 @@ use only extension-safe APIs. - attrs.append({ - "hdrs": attr.label_list( - allow_files = [".h"], -+ cfg = apple_common.multi_arch_split, - doc = """ - A list of `.h` files that will be publicly exposed by this framework. These headers should have - framework-relative imports, and if non-empty, an umbrella header named `%{bundle_name}.h` will also -@@ -558,6 +560,7 @@ be generated that imports all of the headers listed here. - ), - "umbrella_header": attr.label( - allow_single_file = [".h"], -+ cfg = apple_common.multi_arch_split, - doc = """ - An optional single .h file to use as the umbrella header for this framework. Usually, this header - will have the same name as this target, so that clients can load the header using the #import -@@ -720,6 +723,7 @@ def _get_tvos_attrs(rule_descriptor): - # what to do with this. - "hdrs": attr.label_list( - allow_files = [".h"], -+ cfg = apple_common.multi_arch_split, - ), - "extension_safe": attr.bool( - default = False, -diff --git a/apple/internal/tvos_rules.bzl b/apple/internal/tvos_rules.bzl -index 3a55630..17d12c9 100644 ---- a/apple/internal/tvos_rules.bzl -+++ b/apple/internal/tvos_rules.bzl -@@ -50,6 +50,10 @@ load( - "@build_bazel_rules_apple//apple/internal/aspects:swift_static_framework_aspect.bzl", - "SwiftStaticFrameworkInfo", - ) -+load( -+ "@build_bazel_rules_apple//apple/internal/utils:split.bzl", -+ "split", -+) - load( - "@build_bazel_rules_apple//apple:providers.bzl", - "TvosApplicationBundleInfo", -@@ -174,7 +178,7 @@ def _tvos_framework_impl(ctx): - embeddable_targets = ctx.attr.frameworks, - ), - partials.extension_safe_validation_partial(is_extension_safe = ctx.attr.extension_safe), -- partials.framework_headers_partial(hdrs = ctx.files.hdrs), -+ partials.framework_headers_partial(hdrs = split.files(ctx.attr.hdrs)), - partials.framework_provider_partial(binary_provider = binary_provider), - partials.resources_partial( - bundle_id = bundle_id, -diff --git a/apple/internal/utils/split.bzl b/apple/internal/utils/split.bzl -new file mode 100644 -index 0000000..2ee4816 ---- /dev/null -+++ b/apple/internal/utils/split.bzl -@@ -0,0 +1,25 @@ -+# Copyright 2019 The Bazel Authors. All rights reserved. -+# -+# Licensed under the Apache License, Version 2.0 (the "License"); -+# you may not use this file except in compliance with the License. -+# You may obtain a copy of the License at -+# -+# http://www.apache.org/licenses/LICENSE-2.0 -+# -+# Unless required by applicable law or agreed to in writing, software -+# distributed under the License is distributed on an "AS IS" BASIS, -+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+# See the License for the specific language governing permissions and -+# limitations under the License. -+ -+"""Convenience functions for split_attr.""" -+ -+def _files(attr): -+ """Get the files from the first split.""" -+ for v in attr: -+ return v.files.to_list() -+ return [] -+ -+split = struct( -+ files = _files, -+) --- -2.21.0 (Apple Git-122) - diff --git a/go/third_party/io_bazel_rules_go/PR-2181-rebase-0.20.1.patch b/go/third_party/io_bazel_rules_go/PR-2181-rebase-0.20.1.patch deleted file mode 100644 index 93b5e5db6c..0000000000 --- a/go/third_party/io_bazel_rules_go/PR-2181-rebase-0.20.1.patch +++ /dev/null @@ -1,347 +0,0 @@ -From e40c2d9b20458ef2628e8190a108c4e8e670ed27 Mon Sep 17 00:00:00 2001 -From: Steeve Morin -Date: Wed, 7 Aug 2019 22:04:59 +0200 -Subject: [PATCH] go_path: add go_archive_aspect properties - -GoPath can trigger compilation via include_pkg, thus, it should -propagate the mode via go_archive_aspect. - -Signed-off-by: Steeve Morin - -go_path: add include_transitive to optionally remove transitive deps - -It can be useful when combined with include_pkg=True. Sometimes the -transitive GOPATH is not needed. - -Signed-off-by: Steeve Morin ---- - go/core.rst | 83 +++++++++++++++++++++++- - go/private/tools/path.bzl | 72 +++++++++++++++++++- - tests/core/go_path/BUILD.bazel | 10 +++ - tests/core/go_path/go_path_test.go | 13 +++- - tests/core/go_path/pkg/lib/BUILD.bazel | 8 +++ - tests/core/go_path/pkg/lib/transitive.go | 5 ++ - 6 files changed, 186 insertions(+), 5 deletions(-) - create mode 100644 tests/core/go_path/pkg/lib/transitive.go - -diff --git a/go/core.rst b/go/core.rst -index 0bd0d242..e5ed564d 100644 ---- a/go/core.rst -+++ b/go/core.rst -@@ -61,7 +61,7 @@ These mappings are collected up across the entire transitive dependancies of a - binary. This means you can set a value using :param:`x_defs` in a - ``go_library``, and any binary that links that library will be stamped with that - value. You can also override stamp values from libraries using :param:`x_defs` --on the ``go_binary`` rule if needed. The ``--[no]stamp`` option controls whether -+on the ``go_binary`` rule if needed. The ``--[no]stamp`` option controls whether - stamping of workspace variables is enabled. - - Example -@@ -998,6 +998,87 @@ Attributes - | included in the output directory. Files listed in the :param:`data` attribute | - | for this rule will be included regardless of this attribute. | - +----------------------------+-----------------------------+---------------------------------------+ -+| :param:`include_transitive`| :type:`bool` | :value:`True` | -++----------------------------+-----------------------------+---------------------------------------+ -+| When true, transitive dependencies are included in the output directory. Setting this to `False` | -+| can sometimes be useful when needing a specific set of packages, thus limiting the potential for | -+| build graph invalidation. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`include_pkg` | :type:`bool` | :value:`False` | -++----------------------------+-----------------------------+---------------------------------------+ -+| When true, targets in `deps` will get compiled as archives and put in the `pkg/` directory of | -+| the output directory. Because this will trigger compilation of packages, like `go_binary`, the | -+| rule has `mode attributes`_. See below. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`pure` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to link in pure_ mode. | -+| It should be one of :value:`on`, :value:`off` or :value:`auto`. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`static` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to link in static_ mode. | -+| It should be one of :value:`on`, :value:`off` or :value:`auto`. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`race` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to instrument | -+| code for data race detection. It may be :value:`on`, :value:`off`, or | -+| :value:`auto`. In most cases, it's better to enable race detection globally | -+| with ``--features=race`` on the command line. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`msan` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to instrument | -+| code for memory santization. It may be :value:`on`, :value:`off`, or | -+| :value:`auto`. In most cases, it's better to enable memory sanitization | -+| globally with ``--features=msan`` on the command line. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`goos` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls which goos_ to compile and link for. | -+| | -+| If set to anything other than :value:`auto` this overrides the default as set by the current | -+| target platform and allows for single builds to make binaries for multiple architectures. | -+| | -+| Because this has no control over the cc toolchain, it does not work for cgo, so if this | -+| attribute is set then :param:`pure` must be set to :value:`on`. | -+| | -+| This attribute has several limitations and should only be used in situations where the | -+| ``--platforms`` flag does not work. See `Cross compilation`_ and `Note on goos and goarch | -+| attributes`_ for more information. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`goarch` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls which goarch_ to compile and link for. | -+| | -+| If set to anything other than :value:`auto` this overrides the default as set by the current | -+| target platform and allows for single builds to make binaries for multiple architectures. | -+| | -+| Because this has no control over the cc toolchain, it does not work for cgo, so if this | -+| attribute is set then :param:`pure` must be set to :value:`on`. | -+| | -+| This attribute has several limitations and should only be used in situations where the | -+| ``--platforms`` flag does not work. See `Cross compilation`_ and `Note on goos and goarch | -+| attributes`_ for more information. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`linkmode` | :type:`string` | :value:`"normal"` | -++----------------------------+-----------------------------+---------------------------------------+ -+| Determines how the binary should be built and linked. This accepts some of | -+| the same values as ``go build -buildmode`` and works the same way. | -+| | -+| :value:`normal` | -+| Builds a normal executable with position-dependent code. | -+| :value:`pie` | -+| Builds a position-independent executable. | -+| :value:`plugin` | -+| Builds a shared library that can be loaded as a Go plugin. Only supported | -+| on platforms that support plugins. | -+| :value:`c-shared` | -+| Builds a shared library that can be linked into a C program. | -+| :value:`c-archive` | -+| Builds an archive that can be linked into a C program. | -++----------------------------+-----------------------------+---------------------------------------+ - - go_rule - ~~~~~~~ -diff --git a/go/private/tools/path.bzl b/go/private/tools/path.bzl -index 261b9696..43788c42 100644 ---- a/go/private/tools/path.bzl -+++ b/go/private/tools/path.bzl -@@ -28,11 +28,30 @@ load( - "as_iterable", - "as_list", - ) -+load( -+ "@io_bazel_rules_go//go/private:rules/rule.bzl", -+ "go_rule", -+) -+load( -+ "@io_bazel_rules_go//go/private:rules/aspect.bzl", -+ "go_archive_aspect", -+) -+load( -+ "@io_bazel_rules_go//go/platform:list.bzl", -+ "GOARCH", -+ "GOOS", -+) -+load( -+ "@io_bazel_rules_go//go/private:mode.bzl", -+ "LINKMODES", -+ "LINKMODE_NORMAL", -+) - - def _go_path_impl(ctx): - # Gather all archives. Note that there may be multiple packages with the same - # importpath (e.g., multiple vendored libraries, internal tests). The same - # package may also appear in different modes. -+ go = go_context(ctx) - mode_to_deps = {} - for dep in ctx.attr.deps: - archive = get_archive(dep) -@@ -42,7 +61,9 @@ def _go_path_impl(ctx): - mode_to_archive = {} - for mode, archives in mode_to_deps.items(): - direct = [a.data for a in archives] -- transitive = [a.transitive for a in archives] -+ transitive = [] -+ if ctx.attr.include_transitive: -+ transitive = [a.transitive for a in archives] - mode_to_archive[mode] = depset(direct = direct, transitive = transitive) - - # Collect sources and data files from archives. Merge archives into packages. -@@ -152,10 +173,13 @@ def _go_path_impl(ctx): - ), - ] - --go_path = rule( -+go_path = go_rule( - _go_path_impl, - attrs = { -- "deps": attr.label_list(providers = [GoArchive]), -+ "deps": attr.label_list( -+ providers = [GoArchive], -+ aspects = [go_archive_aspect], -+ ), - "data": attr.label_list(allow_files = True), - "mode": attr.string( - default = "copy", -@@ -167,6 +191,48 @@ go_path = rule( - ), - "include_data": attr.bool(default = True), - "include_pkg": attr.bool(default = False), -+ "include_transitive": attr.bool(default = True), -+ "pure": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "static": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "race": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "msan": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "goos": attr.string( -+ values = GOOS.keys() + ["auto"], -+ default = "auto", -+ ), -+ "goarch": attr.string( -+ values = GOARCH.keys() + ["auto"], -+ default = "auto", -+ ), -+ "linkmode": attr.string(values = LINKMODES, default = LINKMODE_NORMAL), - "_go_path": attr.label( - default = "@io_bazel_rules_go//go/tools/builders:go_path", - executable = True, -diff --git a/tests/core/go_path/BUILD.bazel b/tests/core/go_path/BUILD.bazel -index a594ad93..5c91eb4a 100644 ---- a/tests/core/go_path/BUILD.bazel -+++ b/tests/core/go_path/BUILD.bazel -@@ -27,6 +27,14 @@ go_path( - deps = ["//tests/core/go_path/pkg/lib:go_default_library"], - ) - -+go_path( -+ name = "notransitive_path", -+ testonly = True, -+ include_transitive = False, -+ mode = "copy", -+ deps = ["//tests/core/go_path/pkg/lib:go_default_library"], -+) -+ - go_test( - name = "go_path_test", - srcs = ["go_path_test.go"], -@@ -35,12 +43,14 @@ go_test( - "-copy_path=$(location :copy_path)", - "-link_path=tests/core/go_path/link_path", # can't use location; not a single file - "-nodata_path=$(location :nodata_path)", -+ "-notransitive_path=$(location :notransitive_path)", - ], - data = [ - ":archive_path", - ":copy_path", - ":link_path", - ":nodata_path", -+ ":notransitive_path", - ], - deps = ["//go/tools/bazel:go_default_library"], - rundir = ".", -diff --git a/tests/core/go_path/go_path_test.go b/tests/core/go_path/go_path_test.go -index c1181741..0ed22127 100644 ---- a/tests/core/go_path/go_path_test.go -+++ b/tests/core/go_path/go_path_test.go -@@ -29,7 +29,7 @@ import ( - "github.com/bazelbuild/rules_go/go/tools/bazel" - ) - --var copyPath, linkPath, archivePath, nodataPath string -+var copyPath, linkPath, archivePath, nodataPath, notransitivePath string - - var defaultMode = runtime.GOOS + "_" + runtime.GOARCH - -@@ -58,6 +58,7 @@ func TestMain(m *testing.M) { - flag.StringVar(&linkPath, "link_path", "", "path to symlinked go_path") - flag.StringVar(&archivePath, "archive_path", "", "path to archive go_path") - flag.StringVar(&nodataPath, "nodata_path", "", "path to go_path without data") -+ flag.StringVar(¬ransitivePath, "notransitive_path", "", "path to go_path without transitive dependencies") - flag.Parse() - os.Exit(m.Run()) - } -@@ -133,6 +134,16 @@ func TestNoDataPath(t *testing.T) { - checkPath(t, nodataPath, files) - } - -+func TestNoTransitivePath(t *testing.T) { -+ if notransitivePath == "" { -+ t.Fatal("-notransitive_path not set") -+ } -+ files := []string{ -+ "-src/example.com/repo/pkg/lib/transitive/transitive.go", -+ } -+ checkPath(t, notransitivePath, files) -+} -+ - // checkPath checks that dir contains a list of files. files is a list of - // slash-separated paths relative to dir. Files that start with "-" should be - // absent. Files that end with "/" should be directories. -diff --git a/tests/core/go_path/pkg/lib/BUILD.bazel b/tests/core/go_path/pkg/lib/BUILD.bazel -index 7dd03ae3..1aa7ad03 100644 ---- a/tests/core/go_path/pkg/lib/BUILD.bazel -+++ b/tests/core/go_path/pkg/lib/BUILD.bazel -@@ -8,6 +8,7 @@ go_library( - "data.txt", - "testdata/testdata.txt", - ], -+ deps = [":transitive_lib"], - importpath = "example.com/repo/pkg/lib", - visibility = ["//visibility:public"], - ) -@@ -42,3 +43,10 @@ go_library( - importmap = "example.com/repo/vendor/example.com/repo2", - visibility = ["//visibility:public"], - ) -+ -+go_library( -+ name = "transitive_lib", -+ srcs = ["transitive.go"], -+ importpath = "example.com/repo/pkg/lib/transitive", -+ visibility = ["//visibility:public"], -+) -diff --git a/tests/core/go_path/pkg/lib/transitive.go b/tests/core/go_path/pkg/lib/transitive.go -new file mode 100644 -index 00000000..a505a296 ---- /dev/null -+++ b/tests/core/go_path/pkg/lib/transitive.go -@@ -0,0 +1,5 @@ -+package transitive -+ -+var ( -+ _ = "" -+) --- -2.21.0 (Apple Git-122) - diff --git a/go/third_party/io_bazel_rules_go/PR-2181-rebase-0.23.1.patch b/go/third_party/io_bazel_rules_go/PR-2181-rebase-0.23.1.patch deleted file mode 100644 index f4fcffd6c5..0000000000 --- a/go/third_party/io_bazel_rules_go/PR-2181-rebase-0.23.1.patch +++ /dev/null @@ -1,335 +0,0 @@ -diff --git a/go/core.rst b/go/core.rst -index 26839775..ac1325ea 100644 ---- a/go/core.rst -+++ b/go/core.rst -@@ -80,7 +80,7 @@ These mappings are collected up across the entire transitive dependencies of a - binary. This means you can set a value using :param:`x_defs` in a - ``go_library``, and any binary that links that library will be stamped with that - value. You can also override stamp values from libraries using :param:`x_defs` --on the ``go_binary`` rule if needed. The ``--[no]stamp`` option controls whether -+on the ``go_binary`` rule if needed. The ``--[no]stamp`` option controls whether - stamping of workspace variables is enabled. - - Example -@@ -1029,6 +1029,87 @@ Attributes - | included in the output directory. Files listed in the :param:`data` attribute | - | for this rule will be included regardless of this attribute. | - +----------------------------+-----------------------------+---------------------------------------+ -+| :param:`include_transitive`| :type:`bool` | :value:`True` | -++----------------------------+-----------------------------+---------------------------------------+ -+| When true, transitive dependencies are included in the output directory. Setting this to `False` | -+| can sometimes be useful when needing a specific set of packages, thus limiting the potential for | -+| build graph invalidation. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`include_pkg` | :type:`bool` | :value:`False` | -++----------------------------+-----------------------------+---------------------------------------+ -+| When true, targets in `deps` will get compiled as archives and put in the `pkg/` directory of | -+| the output directory. Because this will trigger compilation of packages, like `go_binary`, the | -+| rule has `mode attributes`_. See below. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`pure` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to link in pure_ mode. | -+| It should be one of :value:`on`, :value:`off` or :value:`auto`. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`static` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to link in static_ mode. | -+| It should be one of :value:`on`, :value:`off` or :value:`auto`. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`race` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to instrument | -+| code for data race detection. It may be :value:`on`, :value:`off`, or | -+| :value:`auto`. In most cases, it's better to enable race detection globally | -+| with ``--features=race`` on the command line. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`msan` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to instrument | -+| code for memory santization. It may be :value:`on`, :value:`off`, or | -+| :value:`auto`. In most cases, it's better to enable memory sanitization | -+| globally with ``--features=msan`` on the command line. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`goos` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls which goos_ to compile and link for. | -+| | -+| If set to anything other than :value:`auto` this overrides the default as set by the current | -+| target platform and allows for single builds to make binaries for multiple architectures. | -+| | -+| Because this has no control over the cc toolchain, it does not work for cgo, so if this | -+| attribute is set then :param:`pure` must be set to :value:`on`. | -+| | -+| This attribute has several limitations and should only be used in situations where the | -+| ``--platforms`` flag does not work. See `Cross compilation`_ and `Note on goos and goarch | -+| attributes`_ for more information. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`goarch` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls which goarch_ to compile and link for. | -+| | -+| If set to anything other than :value:`auto` this overrides the default as set by the current | -+| target platform and allows for single builds to make binaries for multiple architectures. | -+| | -+| Because this has no control over the cc toolchain, it does not work for cgo, so if this | -+| attribute is set then :param:`pure` must be set to :value:`on`. | -+| | -+| This attribute has several limitations and should only be used in situations where the | -+| ``--platforms`` flag does not work. See `Cross compilation`_ and `Note on goos and goarch | -+| attributes`_ for more information. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`linkmode` | :type:`string` | :value:`"normal"` | -++----------------------------+-----------------------------+---------------------------------------+ -+| Determines how the binary should be built and linked. This accepts some of | -+| the same values as ``go build -buildmode`` and works the same way. | -+| | -+| :value:`normal` | -+| Builds a normal executable with position-dependent code. | -+| :value:`pie` | -+| Builds a position-independent executable. | -+| :value:`plugin` | -+| Builds a shared library that can be loaded as a Go plugin. Only supported | -+| on platforms that support plugins. | -+| :value:`c-shared` | -+| Builds a shared library that can be linked into a C program. | -+| :value:`c-archive` | -+| Builds an archive that can be linked into a C program. | -++----------------------------+-----------------------------+---------------------------------------+ - - Cross compilation - ----------------- -diff --git a/go/private/tools/path.bzl b/go/private/tools/path.bzl -index fe2206fe..b27636d3 100644 ---- a/go/private/tools/path.bzl -+++ b/go/private/tools/path.bzl -@@ -12,6 +12,7 @@ - # See the License for the specific language governing permissions and - # limitations under the License. - -+ - load( - "@io_bazel_rules_go//go/private:providers.bzl", - "GoArchive", -@@ -19,16 +20,39 @@ load( - "effective_importpath_pkgpath", - "get_archive", - ) -+load( -+ "@io_bazel_rules_go//go/private:context.bzl", -+ "go_context", -+) - load( - "@io_bazel_rules_go//go/private:common.bzl", - "as_iterable", - "as_list", - ) -+load( -+ "@io_bazel_rules_go//go/private:rules/rule.bzl", -+ "go_rule", -+) -+load( -+ "@io_bazel_rules_go//go/private:rules/aspect.bzl", -+ "go_archive_aspect", -+) -+load( -+ "@io_bazel_rules_go//go/platform:list.bzl", -+ "GOARCH", -+ "GOOS", -+) -+load( -+ "@io_bazel_rules_go//go/private:mode.bzl", -+ "LINKMODES", -+ "LINKMODE_NORMAL", -+) - - def _go_path_impl(ctx): - # Gather all archives. Note that there may be multiple packages with the same - # importpath (e.g., multiple vendored libraries, internal tests). The same - # package may also appear in different modes. -+ go = go_context(ctx) - mode_to_deps = {} - for dep in ctx.attr.deps: - archive = get_archive(dep) -@@ -38,7 +62,9 @@ def _go_path_impl(ctx): - mode_to_archive = {} - for mode, archives in mode_to_deps.items(): - direct = [a.data for a in archives] -- transitive = [a.transitive for a in archives] -+ transitive = [] -+ if ctx.attr.include_transitive: -+ transitive = [a.transitive for a in archives] - mode_to_archive[mode] = depset(direct = direct, transitive = transitive) - - # Collect sources and data files from archives. Merge archives into packages. -@@ -148,10 +174,13 @@ def _go_path_impl(ctx): - ), - ] - --go_path = rule( -+go_path = go_rule( - _go_path_impl, - attrs = { -- "deps": attr.label_list(providers = [GoArchive]), -+ "deps": attr.label_list( -+ providers = [GoArchive], -+ aspects = [go_archive_aspect], -+ ), - "data": attr.label_list(allow_files = True), - "mode": attr.string( - default = "copy", -@@ -163,6 +192,48 @@ go_path = rule( - ), - "include_data": attr.bool(default = True), - "include_pkg": attr.bool(default = False), -+ "include_transitive": attr.bool(default = True), -+ "pure": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "static": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "race": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "msan": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "goos": attr.string( -+ values = GOOS.keys() + ["auto"], -+ default = "auto", -+ ), -+ "goarch": attr.string( -+ values = GOARCH.keys() + ["auto"], -+ default = "auto", -+ ), -+ "linkmode": attr.string(values = LINKMODES, default = LINKMODE_NORMAL), - "_go_path": attr.label( - default = "@io_bazel_rules_go//go/tools/builders:go_path", - executable = True, -diff --git a/tests/core/go_path/BUILD.bazel b/tests/core/go_path/BUILD.bazel -index a594ad93..5c91eb4a 100644 ---- a/tests/core/go_path/BUILD.bazel -+++ b/tests/core/go_path/BUILD.bazel -@@ -27,6 +27,14 @@ go_path( - deps = ["//tests/core/go_path/pkg/lib:go_default_library"], - ) - -+go_path( -+ name = "notransitive_path", -+ testonly = True, -+ include_transitive = False, -+ mode = "copy", -+ deps = ["//tests/core/go_path/pkg/lib:go_default_library"], -+) -+ - go_test( - name = "go_path_test", - srcs = ["go_path_test.go"], -@@ -35,12 +43,14 @@ go_test( - "-copy_path=$(location :copy_path)", - "-link_path=tests/core/go_path/link_path", # can't use location; not a single file - "-nodata_path=$(location :nodata_path)", -+ "-notransitive_path=$(location :notransitive_path)", - ], - data = [ - ":archive_path", - ":copy_path", - ":link_path", - ":nodata_path", -+ ":notransitive_path", - ], - deps = ["//go/tools/bazel:go_default_library"], - rundir = ".", -diff --git a/tests/core/go_path/go_path_test.go b/tests/core/go_path/go_path_test.go -index c1181741..0ed22127 100644 ---- a/tests/core/go_path/go_path_test.go -+++ b/tests/core/go_path/go_path_test.go -@@ -29,7 +29,7 @@ import ( - "github.com/bazelbuild/rules_go/go/tools/bazel" - ) - --var copyPath, linkPath, archivePath, nodataPath string -+var copyPath, linkPath, archivePath, nodataPath, notransitivePath string - - var defaultMode = runtime.GOOS + "_" + runtime.GOARCH - -@@ -58,6 +58,7 @@ func TestMain(m *testing.M) { - flag.StringVar(&linkPath, "link_path", "", "path to symlinked go_path") - flag.StringVar(&archivePath, "archive_path", "", "path to archive go_path") - flag.StringVar(&nodataPath, "nodata_path", "", "path to go_path without data") -+ flag.StringVar(¬ransitivePath, "notransitive_path", "", "path to go_path without transitive dependencies") - flag.Parse() - os.Exit(m.Run()) - } -@@ -133,6 +134,16 @@ func TestNoDataPath(t *testing.T) { - checkPath(t, nodataPath, files) - } - -+func TestNoTransitivePath(t *testing.T) { -+ if notransitivePath == "" { -+ t.Fatal("-notransitive_path not set") -+ } -+ files := []string{ -+ "-src/example.com/repo/pkg/lib/transitive/transitive.go", -+ } -+ checkPath(t, notransitivePath, files) -+} -+ - // checkPath checks that dir contains a list of files. files is a list of - // slash-separated paths relative to dir. Files that start with "-" should be - // absent. Files that end with "/" should be directories. -diff --git a/tests/core/go_path/pkg/lib/BUILD.bazel b/tests/core/go_path/pkg/lib/BUILD.bazel -index 7dd03ae3..1aa7ad03 100644 ---- a/tests/core/go_path/pkg/lib/BUILD.bazel -+++ b/tests/core/go_path/pkg/lib/BUILD.bazel -@@ -8,6 +8,7 @@ go_library( - "data.txt", - "testdata/testdata.txt", - ], -+ deps = [":transitive_lib"], - importpath = "example.com/repo/pkg/lib", - visibility = ["//visibility:public"], - ) -@@ -42,3 +43,10 @@ go_library( - importmap = "example.com/repo/vendor/example.com/repo2", - visibility = ["//visibility:public"], - ) -+ -+go_library( -+ name = "transitive_lib", -+ srcs = ["transitive.go"], -+ importpath = "example.com/repo/pkg/lib/transitive", -+ visibility = ["//visibility:public"], -+) -diff --git a/tests/core/go_path/pkg/lib/transitive.go b/tests/core/go_path/pkg/lib/transitive.go -new file mode 100644 -index 00000000..a505a296 ---- /dev/null -+++ b/tests/core/go_path/pkg/lib/transitive.go -@@ -0,0 +1,5 @@ -+package transitive -+ -+var ( -+ _ = "" -+) diff --git a/go/third_party/io_bazel_rules_go/PR-2181-rebase-master.patch b/go/third_party/io_bazel_rules_go/PR-2181-rebase-master.patch deleted file mode 100644 index 3b390be1f8..0000000000 --- a/go/third_party/io_bazel_rules_go/PR-2181-rebase-master.patch +++ /dev/null @@ -1,347 +0,0 @@ -From d4f963abda8f03f8b77d4915a517e9177f566705 Mon Sep 17 00:00:00 2001 -From: Steeve Morin -Date: Wed, 7 Aug 2019 22:04:59 +0200 -Subject: [PATCH] go_path: add go_archive_aspect properties - -GoPath can trigger compilation via include_pkg, thus, it should -propagate the mode via go_archive_aspect. - -Signed-off-by: Steeve Morin - -go_path: add include_transitive to optionally remove transitive deps - -It can be useful when combined with include_pkg=True. Sometimes the -transitive GOPATH is not needed. - -Signed-off-by: Steeve Morin ---- - go/core.rst | 83 +++++++++++++++++++++++- - go/private/tools/path.bzl | 72 +++++++++++++++++++- - tests/core/go_path/BUILD.bazel | 10 +++ - tests/core/go_path/go_path_test.go | 13 +++- - tests/core/go_path/pkg/lib/BUILD.bazel | 8 +++ - tests/core/go_path/pkg/lib/transitive.go | 5 ++ - 6 files changed, 186 insertions(+), 5 deletions(-) - create mode 100644 tests/core/go_path/pkg/lib/transitive.go - -diff --git a/go/core.rst b/go/core.rst -index 0bd0d242..e5ed564d 100644 ---- a/go/core.rst -+++ b/go/core.rst -@@ -61,7 +61,7 @@ These mappings are collected up across the entire transitive dependancies of a - binary. This means you can set a value using :param:`x_defs` in a - ``go_library``, and any binary that links that library will be stamped with that - value. You can also override stamp values from libraries using :param:`x_defs` --on the ``go_binary`` rule if needed. The ``--[no]stamp`` option controls whether -+on the ``go_binary`` rule if needed. The ``--[no]stamp`` option controls whether - stamping of workspace variables is enabled. - - Example -@@ -998,6 +998,87 @@ Attributes - | included in the output directory. Files listed in the :param:`data` attribute | - | for this rule will be included regardless of this attribute. | - +----------------------------+-----------------------------+---------------------------------------+ -+| :param:`include_transitive`| :type:`bool` | :value:`True` | -++----------------------------+-----------------------------+---------------------------------------+ -+| When true, transitive dependencies are included in the output directory. Setting this to `False` | -+| can sometimes be useful when needing a specific set of packages, thus limiting the potential for | -+| build graph invalidation. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`include_pkg` | :type:`bool` | :value:`False` | -++----------------------------+-----------------------------+---------------------------------------+ -+| When true, targets in `deps` will get compiled as archives and put in the `pkg/` directory of | -+| the output directory. Because this will trigger compilation of packages, like `go_binary`, the | -+| rule has `mode attributes`_. See below. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`pure` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to link in pure_ mode. | -+| It should be one of :value:`on`, :value:`off` or :value:`auto`. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`static` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to link in static_ mode. | -+| It should be one of :value:`on`, :value:`off` or :value:`auto`. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`race` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to instrument | -+| code for data race detection. It may be :value:`on`, :value:`off`, or | -+| :value:`auto`. In most cases, it's better to enable race detection globally | -+| with ``--features=race`` on the command line. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`msan` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls whether to instrument | -+| code for memory santization. It may be :value:`on`, :value:`off`, or | -+| :value:`auto`. In most cases, it's better to enable memory sanitization | -+| globally with ``--features=msan`` on the command line. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`goos` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls which goos_ to compile and link for. | -+| | -+| If set to anything other than :value:`auto` this overrides the default as set by the current | -+| target platform and allows for single builds to make binaries for multiple architectures. | -+| | -+| Because this has no control over the cc toolchain, it does not work for cgo, so if this | -+| attribute is set then :param:`pure` must be set to :value:`on`. | -+| | -+| This attribute has several limitations and should only be used in situations where the | -+| ``--platforms`` flag does not work. See `Cross compilation`_ and `Note on goos and goarch | -+| attributes`_ for more information. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`goarch` | :type:`string` | :value:`auto` | -++----------------------------+-----------------------------+---------------------------------------+ -+| This is one of the `mode attributes`_ that controls which goarch_ to compile and link for. | -+| | -+| If set to anything other than :value:`auto` this overrides the default as set by the current | -+| target platform and allows for single builds to make binaries for multiple architectures. | -+| | -+| Because this has no control over the cc toolchain, it does not work for cgo, so if this | -+| attribute is set then :param:`pure` must be set to :value:`on`. | -+| | -+| This attribute has several limitations and should only be used in situations where the | -+| ``--platforms`` flag does not work. See `Cross compilation`_ and `Note on goos and goarch | -+| attributes`_ for more information. | -++----------------------------+-----------------------------+---------------------------------------+ -+| :param:`linkmode` | :type:`string` | :value:`"normal"` | -++----------------------------+-----------------------------+---------------------------------------+ -+| Determines how the binary should be built and linked. This accepts some of | -+| the same values as ``go build -buildmode`` and works the same way. | -+| | -+| :value:`normal` | -+| Builds a normal executable with position-dependent code. | -+| :value:`pie` | -+| Builds a position-independent executable. | -+| :value:`plugin` | -+| Builds a shared library that can be loaded as a Go plugin. Only supported | -+| on platforms that support plugins. | -+| :value:`c-shared` | -+| Builds a shared library that can be linked into a C program. | -+| :value:`c-archive` | -+| Builds an archive that can be linked into a C program. | -++----------------------------+-----------------------------+---------------------------------------+ - - go_rule - ~~~~~~~ -diff --git a/go/private/tools/path.bzl b/go/private/tools/path.bzl -index 261b9696..43788c42 100644 ---- a/go/private/tools/path.bzl -+++ b/go/private/tools/path.bzl -@@ -28,11 +28,30 @@ load( - "as_iterable", - "as_list", - ) -+load( -+ "@io_bazel_rules_go//go/private:rules/rule.bzl", -+ "go_rule", -+) -+load( -+ "@io_bazel_rules_go//go/private:rules/aspect.bzl", -+ "go_archive_aspect", -+) -+load( -+ "@io_bazel_rules_go//go/platform:list.bzl", -+ "GOARCH", -+ "GOOS", -+) -+load( -+ "@io_bazel_rules_go//go/private:mode.bzl", -+ "LINKMODES", -+ "LINKMODE_NORMAL", -+) - - def _go_path_impl(ctx): - # Gather all archives. Note that there may be multiple packages with the same - # importpath (e.g., multiple vendored libraries, internal tests). The same - # package may also appear in different modes. -+ go = go_context(ctx) - mode_to_deps = {} - for dep in ctx.attr.deps: - archive = get_archive(dep) -@@ -42,7 +61,9 @@ def _go_path_impl(ctx): - mode_to_archive = {} - for mode, archives in mode_to_deps.items(): - direct = [a.data for a in archives] -- transitive = [a.transitive for a in archives] -+ transitive = [] -+ if ctx.attr.include_transitive: -+ transitive = [a.transitive for a in archives] - mode_to_archive[mode] = depset(direct = direct, transitive = transitive) - - # Collect sources and data files from archives. Merge archives into packages. -@@ -152,10 +173,13 @@ def _go_path_impl(ctx): - ), - ] - --go_path = rule( -+go_path = go_rule( - _go_path_impl, - attrs = { -- "deps": attr.label_list(providers = [GoArchive]), -+ "deps": attr.label_list( -+ providers = [GoArchive], -+ aspects = [go_archive_aspect], -+ ), - "data": attr.label_list(allow_files = True), - "mode": attr.string( - default = "copy", -@@ -167,6 +191,48 @@ go_path = rule( - ), - "include_data": attr.bool(default = True), - "include_pkg": attr.bool(default = False), -+ "include_transitive": attr.bool(default = True), -+ "pure": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "static": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "race": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "msan": attr.string( -+ values = [ -+ "on", -+ "off", -+ "auto", -+ ], -+ default = "auto", -+ ), -+ "goos": attr.string( -+ values = GOOS.keys() + ["auto"], -+ default = "auto", -+ ), -+ "goarch": attr.string( -+ values = GOARCH.keys() + ["auto"], -+ default = "auto", -+ ), -+ "linkmode": attr.string(values = LINKMODES, default = LINKMODE_NORMAL), - "_go_path": attr.label( - default = "@io_bazel_rules_go//go/tools/builders:go_path", - executable = True, -diff --git a/tests/core/go_path/BUILD.bazel b/tests/core/go_path/BUILD.bazel -index a594ad93..5c91eb4a 100644 ---- a/tests/core/go_path/BUILD.bazel -+++ b/tests/core/go_path/BUILD.bazel -@@ -27,6 +27,14 @@ go_path( - deps = ["//tests/core/go_path/pkg/lib:go_default_library"], - ) - -+go_path( -+ name = "notransitive_path", -+ testonly = True, -+ include_transitive = False, -+ mode = "copy", -+ deps = ["//tests/core/go_path/pkg/lib:go_default_library"], -+) -+ - go_test( - name = "go_path_test", - srcs = ["go_path_test.go"], -@@ -35,12 +43,14 @@ go_test( - "-copy_path=$(location :copy_path)", - "-link_path=tests/core/go_path/link_path", # can't use location; not a single file - "-nodata_path=$(location :nodata_path)", -+ "-notransitive_path=$(location :notransitive_path)", - ], - data = [ - ":archive_path", - ":copy_path", - ":link_path", - ":nodata_path", -+ ":notransitive_path", - ], - deps = ["//go/tools/bazel:go_default_library"], - rundir = ".", -diff --git a/tests/core/go_path/go_path_test.go b/tests/core/go_path/go_path_test.go -index c1181741..0ed22127 100644 ---- a/tests/core/go_path/go_path_test.go -+++ b/tests/core/go_path/go_path_test.go -@@ -29,7 +29,7 @@ import ( - "github.com/bazelbuild/rules_go/go/tools/bazel" - ) - --var copyPath, linkPath, archivePath, nodataPath string -+var copyPath, linkPath, archivePath, nodataPath, notransitivePath string - - var defaultMode = runtime.GOOS + "_" + runtime.GOARCH - -@@ -58,6 +58,7 @@ func TestMain(m *testing.M) { - flag.StringVar(&linkPath, "link_path", "", "path to symlinked go_path") - flag.StringVar(&archivePath, "archive_path", "", "path to archive go_path") - flag.StringVar(&nodataPath, "nodata_path", "", "path to go_path without data") -+ flag.StringVar(¬ransitivePath, "notransitive_path", "", "path to go_path without transitive dependencies") - flag.Parse() - os.Exit(m.Run()) - } -@@ -133,6 +134,16 @@ func TestNoDataPath(t *testing.T) { - checkPath(t, nodataPath, files) - } - -+func TestNoTransitivePath(t *testing.T) { -+ if notransitivePath == "" { -+ t.Fatal("-notransitive_path not set") -+ } -+ files := []string{ -+ "-src/example.com/repo/pkg/lib/transitive/transitive.go", -+ } -+ checkPath(t, notransitivePath, files) -+} -+ - // checkPath checks that dir contains a list of files. files is a list of - // slash-separated paths relative to dir. Files that start with "-" should be - // absent. Files that end with "/" should be directories. -diff --git a/tests/core/go_path/pkg/lib/BUILD.bazel b/tests/core/go_path/pkg/lib/BUILD.bazel -index 7dd03ae3..1aa7ad03 100644 ---- a/tests/core/go_path/pkg/lib/BUILD.bazel -+++ b/tests/core/go_path/pkg/lib/BUILD.bazel -@@ -8,6 +8,7 @@ go_library( - "data.txt", - "testdata/testdata.txt", - ], -+ deps = [":transitive_lib"], - importpath = "example.com/repo/pkg/lib", - visibility = ["//visibility:public"], - ) -@@ -42,3 +43,10 @@ go_library( - importmap = "example.com/repo/vendor/example.com/repo2", - visibility = ["//visibility:public"], - ) -+ -+go_library( -+ name = "transitive_lib", -+ srcs = ["transitive.go"], -+ importpath = "example.com/repo/pkg/lib/transitive", -+ visibility = ["//visibility:public"], -+) -diff --git a/tests/core/go_path/pkg/lib/transitive.go b/tests/core/go_path/pkg/lib/transitive.go -new file mode 100644 -index 00000000..a505a296 ---- /dev/null -+++ b/tests/core/go_path/pkg/lib/transitive.go -@@ -0,0 +1,5 @@ -+package transitive -+ -+var ( -+ _ = "" -+) --- -2.21.0 (Apple Git-122) - diff --git a/js/.bazelignore b/js/.bazelignore deleted file mode 100644 index 3c3629e647..0000000000 --- a/js/.bazelignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/js/.bazelrc b/js/.bazelrc deleted file mode 100644 index 4acfe2a2a2..0000000000 --- a/js/.bazelrc +++ /dev/null @@ -1,6 +0,0 @@ -common --experimental_allow_incremental_repository_updates -build --ios_minimum_os=9.0 -build --strip=never -build --extra_toolchains=@androidndk//:all -build --fat_apk_cpu=x86,x86_64,arm64-v8a -build --ios_multi_cpus=armv7,arm64,x86_64,i386 diff --git a/js/README.md b/js/README.md index 3dad770005..1dbd1f1b5f 100644 --- a/js/README.md +++ b/js/README.md @@ -15,7 +15,6 @@ In addition to the _**General requirements for React Native**_ below, you'll nee - An installation of [golang](https://golang.org/dl/), plus: - Your `$GOPATH` explicitly set to your golang directory (usually `$HOME/go`) - The gomobile package: `go get golang.org/x/mobile/cmd/gomobile/... && gomobile init` -- [Bazel](https://docs.bazel.build/versions/master/install-os-x.html#install-with-installer-mac-os-x) - _Android only:_ Java 8. If you already have another version of Java, you can use a version manager and Homebrew to add another installation. Some nice instructions are given [here](https://java.christmas/2019/16). ### 1. Run required services diff --git a/js/packages/berty-app/.bazelrc b/js/packages/berty-app/.bazelrc deleted file mode 100644 index 4acfe2a2a2..0000000000 --- a/js/packages/berty-app/.bazelrc +++ /dev/null @@ -1,6 +0,0 @@ -common --experimental_allow_incremental_repository_updates -build --ios_minimum_os=9.0 -build --strip=never -build --extra_toolchains=@androidndk//:all -build --fat_apk_cpu=x86,x86_64,arm64-v8a -build --ios_multi_cpus=armv7,arm64,x86_64,i386 diff --git a/js/packages/berty-app/BUILD.bazel b/js/packages/berty-app/BUILD.bazel deleted file mode 100644 index f607c57276..0000000000 --- a/js/packages/berty-app/BUILD.bazel +++ /dev/null @@ -1,31 +0,0 @@ -load("@rules_jvm_external//:defs.bzl", "maven_install") - -alias( - name = "react_native_aar_file", - actual = "//:node_modules/react-native/android/com/facebook/react/react-native/0.61.2/react-native-0.61.2.aar", - visibility = ["//visibility:public"], -) - -alias( - name = "jsc_aar_file", - actual = "//:node_modules/jsc-android/dist/org/webkit/android-jsc-intl/r245459/android-jsc-intl-r245459.aar", - visibility = ["//visibility:public"], -) - -filegroup( - name = "node_modules", - srcs = glob( - include = ["node_modules/**/*"], - exclude = [ - # Files under test & docs may contain file names that - # are not legal Bazel labels (e.g., - # node_modules/ecstatic/test/public/中文/檔案.html) - "node_modules/test/**", - "node_modules/docs/**", - # Files with spaces are not allowed in Bazel runfiles - # See https://github.com/bazelbuild/bazel/issues/4327 - "node_modules/**/* */**", - "node_modules/**/* *", - ], - ), -) diff --git a/js/packages/berty-app/WORKSPACE b/js/packages/berty-app/WORKSPACE deleted file mode 100644 index 4e2f1767b5..0000000000 --- a/js/packages/berty-app/WORKSPACE +++ /dev/null @@ -1,45 +0,0 @@ -workspace(name = "berty_app") - -# berty go -local_repository( - name = "berty", - path = "../../..", -) - -# berty chat bridge -local_repository( - name = "berty_bridge", - path = "../go-bridge", -) - -# configure android sdk/ndk -android_sdk_repository( - name = "androidsdk", - api_level = 28, - build_tools_version = "28.0.3", -) - -android_ndk_repository( - name = "androidndk", - api_level = 28, -) - -load("@berty_app//:repositories.bzl", "berty_app_repositories") -berty_app_repositories() - -load("@berty_bridge//:repositories.bzl", "berty_bridge_repositories") -berty_bridge_repositories() - -# check bazel version -load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version") -check_bazel_version("0.29.1") - -# berty app config -load("@berty_app//:config.bzl", "berty_app_config") -berty_app_config() - -# chat bridge config -load("@berty_bridge//:config.bzl", "berty_bridge_config") -berty_bridge_config() - -register_toolchains("@androidndk//:all") diff --git a/js/packages/berty-app/android/BUILD.bazel b/js/packages/berty-app/android/BUILD.bazel deleted file mode 100644 index a480471324..0000000000 --- a/js/packages/berty-app/android/BUILD.bazel +++ /dev/null @@ -1,4 +0,0 @@ -alias( - name = "app", - actual = "//android/app/src/main:app", -) diff --git a/js/packages/berty-app/android/app/build_defs.bzl b/js/packages/berty-app/android/app/build_defs.bzl deleted file mode 100644 index fff270f8d1..0000000000 --- a/js/packages/berty-app/android/app/build_defs.bzl +++ /dev/null @@ -1,19 +0,0 @@ -"""Helper definitions to glob .aar and .jar targets""" - -def create_aar_targets(aarfiles): - for aarfile in aarfiles: - name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] - lib_deps.append(":" + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -def create_jar_targets(jarfiles): - for jarfile in jarfiles: - name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] - lib_deps.append(":" + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) diff --git a/js/packages/berty-app/android/app/src/main/BUILD.bazel b/js/packages/berty-app/android/app/src/main/BUILD.bazel deleted file mode 100644 index 680cfdb4e0..0000000000 --- a/js/packages/berty-app/android/app/src/main/BUILD.bazel +++ /dev/null @@ -1,54 +0,0 @@ -aar_import( - name = "org_webkit_android_jsc", - aar = "@berty_app//:jsc_aar_file", -) - -aar_import( - name = "com_facebook_react_react_native", - aar = "@berty_app//:react_native_aar_file", - # srcjar = "@berty_app//:react_native_aar_file", - exports = [ - "@maven//:com_facebook_soloader_soloader", - ], - deps = [ - # these values come from the .pom next to the aar - "@maven//:androidx_appcompat_appcompat", - "@maven//:com_facebook_fresco_fresco", - "@maven//:com_facebook_fresco_imagepipeline_okhttp3", - "@maven//:com_facebook_infer_annotation_infer_annotation", - "@maven//:com_facebook_soloader_soloader", - "@maven//:com_google_code_findbugs_jsr305", - "@maven//:com_squareup_okhttp3_okhttp", - "@maven//:com_squareup_okhttp3_okhttp_urlconnection", - "@maven//:com_squareup_okio_okio", - "@maven//:javax_inject_javax_inject", - ], -) - -aar_import( - name = "berty_bridge", - aar = "@berty_bridge//:prebuilt_aar", - deps = [ - ":com_facebook_react_react_native", - ], -) - -android_binary( - name = "app", - srcs = glob( - ["java/**/*.java"], - exclude = ["**/*.template.java"], - ), - manifest = "AndroidManifest.xml", - manifest_values = { - "minSdkVersion": "16", - "compileSdkVersion": "28", - "targetSdkVersion": "28", - }, - resource_files = glob(["res/**"]), - visibility = ["//visibility:public"], - deps = [ - ":berty_bridge", - ":com_facebook_react_react_native", - ], -) diff --git a/js/packages/berty-app/repositories.bzl b/js/packages/berty-app/repositories.bzl deleted file mode 100644 index 15b9bca7fe..0000000000 --- a/js/packages/berty-app/repositories.bzl +++ /dev/null @@ -1,18 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -def berty_app_repositories(): - # utils - maybe( - http_archive, - name = "rules_jvm_external", - sha256 = "79c9850690d7614ecdb72d68394f994fef7534b292c4867ce5e7dec0aa7bdfad", - strip_prefix = "rules_jvm_external-2.8", - url = "https://github.com/bazelbuild/rules_jvm_external/archive/2.8.zip", - ) - maybe( - http_archive, - name = "build_bazel_rules_nodejs", - sha256 = "ad4be2c6f40f5af70c7edf294955f9d9a0222c8e2756109731b25f79ea2ccea0", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.38.3/rules_nodejs-0.38.3.tar.gz"], - ) diff --git a/js/packages/go-bridge/.bazelrc b/js/packages/go-bridge/.bazelrc deleted file mode 100644 index 426d9f36b8..0000000000 --- a/js/packages/go-bridge/.bazelrc +++ /dev/null @@ -1,6 +0,0 @@ -common --experimental_allow_incremental_repository_updates -build --ios_minimum_os=9.0 -build --strip=never -build --extra_toolchains=@androidndk//:all -build --fat_apk_cpu=x86,x86_64,arm64-v8a -# build --ios_multi_cpus=armv7,arm64,x86_64,i386 diff --git a/js/packages/go-bridge/BUILD.bazel b/js/packages/go-bridge/BUILD.bazel deleted file mode 100644 index 1be848b32f..0000000000 --- a/js/packages/go-bridge/BUILD.bazel +++ /dev/null @@ -1,18 +0,0 @@ -alias( - name = "prebuilt_aar", - actual = "bazel-bin/android/bridge_library.aar", - visibility = ["//visibility:public"], -) - - -alias( - name = "react_native_aar_file", - actual = "//:node_modules/react-native/android/com/facebook/react/react-native/0.61.2/react-native-0.61.2.aar", - visibility = ["//visibility:public"], -) - -alias( - name = "jsc_aar_file", - actual = "//:node_modules/jsc-android/dist/org/webkit/android-jsc-intl/r245459/android-jsc-intl-r245459.aar", - visibility = ["//visibility:public"], -) diff --git a/js/packages/go-bridge/WORKSPACE b/js/packages/go-bridge/WORKSPACE deleted file mode 100644 index 522d7e48b5..0000000000 --- a/js/packages/go-bridge/WORKSPACE +++ /dev/null @@ -1,60 +0,0 @@ -workspace(name = "berty_bridge") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# berty go -local_repository( - name = "berty", - path = "../../..", -) - -load("@berty_bridge//:repositories.bzl", "berty_bridge_repositories") - -berty_bridge_repositories() - -# check bazel version - -load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version") - -check_bazel_version("0.29.1") - -# berty go config - -load("@berty_bridge//:config.bzl", "berty_bridge_config") - -berty_bridge_config() - -http_archive( - name = "rules_jvm_external", - sha256 = "79c9850690d7614ecdb72d68394f994fef7534b292c4867ce5e7dec0aa7bdfad", - strip_prefix = "rules_jvm_external-2.8", - url = "https://github.com/bazelbuild/rules_jvm_external/archive/2.8.zip", -) - -load("@rules_jvm_external//:defs.bzl", "maven_install") - -maven_install( - artifacts = [ - "com.facebook.infer.annotation:infer-annotation:0.11.2", - "javax.inject:javax.inject:1", - "androidx.appcompat:appcompat:1.0.2", - "com.facebook.fresco:fresco:2.0.0", - "com.facebook.fresco:imagepipeline-okhttp3:2.0.0", - "com.facebook.soloader:soloader:0.6.0", - "com.google.code.findbugs:jsr305:3.0.2", - "com.squareup.okhttp3:okhttp:3.12.1", - "com.squareup.okhttp3:okhttp-urlconnection:3.12.1", - "com.squareup.okio:okio:1.15.0", - ], - repositories = [ - "https://repo1.maven.org/maven2/", - "https://maven.google.com/", - "https://jcenter.bintray.com/", - # "https://dl.bintray.com/facebook/maven/", - ], -) - -local_repository( - name = "berty_app", - path = "../berty-app", -) diff --git a/js/packages/go-bridge/android/BUILD.bazel b/js/packages/go-bridge/android/BUILD.bazel deleted file mode 100644 index 7d2bc30e86..0000000000 --- a/js/packages/go-bridge/android/BUILD.bazel +++ /dev/null @@ -1,51 +0,0 @@ -load("@co_znly_rules_gomobile//:java.bzl", "gobind_java") - -aar_import( - name = "org_webkit_android_jsc", - aar = "@berty_bridge//:jsc_aar_file", -) - -aar_import( - name = "com_facebook_react_react_native", - aar = "@berty_bridge//:react_native_aar_file", - # srcjar = "@berty_app//:react_native_aar_file", - exports = [ - "@maven//:com_facebook_soloader_soloader", - ], - deps = [ - # these values come from the .pom next to the aar - "@maven//:androidx_appcompat_appcompat", - "@maven//:com_facebook_fresco_fresco", - "@maven//:com_facebook_fresco_imagepipeline_okhttp3", - "@maven//:com_facebook_infer_annotation_infer_annotation", - "@maven//:com_facebook_soloader_soloader", - "@maven//:com_google_code_findbugs_jsr305", - "@maven//:com_squareup_okhttp3_okhttp", - "@maven//:com_squareup_okhttp3_okhttp_urlconnection", - "@maven//:com_squareup_okio_okio", - "@maven//:javax_inject_javax_inject", - ], -) - -gobind_java( - name = "bridge", - java_package = "tech.berty.gobridge", - tags = [], - deps = [ - "@berty//go:framework/gobridge:go_default_library", - ], - gc_linkopts = [ - "-compressdwarf=false", - ], -) - -android_library( - name = "bridge_library", - srcs = [":bridge.java.artifacts"] + glob(["src/**/*.java"]), - custom_package = "tech.berty.chat", - visibility = ["//visibility:public"], - exports = [":bridge.java.cc"], - deps = [ - ":com_facebook_react_react_native", - ], -) diff --git a/js/packages/go-bridge/config.bzl b/js/packages/go-bridge/config.bzl deleted file mode 100644 index 22493603bc..0000000000 --- a/js/packages/go-bridge/config.bzl +++ /dev/null @@ -1,15 +0,0 @@ -load("@berty//go:config.bzl", "berty_go_config") -load("@co_znly_rules_gomobile//:repositories.bzl", "gomobile_repositories") -load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") -load("@build_bazel_rules_swift//swift:repositories.bzl", "swift_rules_dependencies") - -def berty_bridge_config(): - # fetch and config berty go dependencies - berty_go_config() - - # config gomobile repositories - gomobile_repositories() - - # config ios - apple_support_dependencies() - swift_rules_dependencies() diff --git a/js/packages/go-bridge/ios/BUILD.bazel b/js/packages/go-bridge/ios/BUILD.bazel deleted file mode 100644 index d4c253202b..0000000000 --- a/js/packages/go-bridge/ios/BUILD.bazel +++ /dev/null @@ -1,8 +0,0 @@ -load("@co_znly_rules_gomobile//:java.bzl", "gobind_java") -load("@berty_bridge//ios:framework.bzl", "gen_framework") - -gen_framework( - name = "bridge_framework", - bundle_name = "Gobridge", -) - diff --git a/js/packages/go-bridge/ios/debug.bzl b/js/packages/go-bridge/ios/debug.bzl deleted file mode 100644 index 32b23fac30..0000000000 --- a/js/packages/go-bridge/ios/debug.bzl +++ /dev/null @@ -1,71 +0,0 @@ -def dump(obj, obj_name): - s = '\n' + _dumpstr(obj, obj_name) - print(s) - -def _dumpstr(root_obj, root_obj_name): - BLACKLIST = [ - "InputFileConfiguredTarget.output_group", - "Label.Label", - "Label.relative", - "License.to_json", - "RuleConfiguredTarget.output_group", - "ctx.action", - "ctx.check_placeholders", - "ctx.empty_action", - "ctx.expand", - "ctx.expand_location", - "ctx.expand_make_variables", - "ctx.file_action", - "ctx.middle_man", - "ctx.new_file", - "ctx.resolve_command", - "ctx.rule", - "ctx.runfiles", - "ctx.template_action", - "ctx.tokenize", - "fragments.apple", - "fragments.cpp", - "fragments.java", - "fragments.jvm", - "fragments.objc", - "runfiles.symlinks", - "struct.output_licenses", - "struct.to_json", - "struct.to_proto", - ] - MAXLINES = 4000 - ROOT_MAXDEPTH = 5 - - # List of printable lines - lines = [] - - # Bazel doesn't allow a function to recursively call itself, so - # use an explicit stack - stack = [(root_obj, root_obj_name, 0, ROOT_MAXDEPTH)] - # No while() in Bazel, so use for loop over large range - for _ in range(MAXLINES): - if len(stack) == 0: - break - obj, obj_name, indent, maxdepth = stack.pop() - - obj_type = type(obj) - indent_str = ' '*indent - line = '{indent_str}{obj_name}[{obj_type}]:'.format( - indent_str=indent_str, obj_name=obj_name, obj_type=obj_type) - - if maxdepth == 0 or obj_type in ['dict', 'list', 'set', 'string']: - # Dump value as string, inline - line += ' ' + str(obj) - else: - # Dump all of value's fields on separate lines - attrs = dir(obj) - # Push each field to stack in reverse order, so they pop - # in sorted order - for attr in reversed(attrs): - if "%s.%s" % (obj_type, attr) in BLACKLIST: - value = '' % attr - else: - value = getattr(obj, attr, '' % attr) - stack.append((value, attr, indent+4, maxdepth-1)) - lines.append(line) - return '\n'.join(lines) diff --git a/js/packages/go-bridge/ios/framework.bzl b/js/packages/go-bridge/ios/framework.bzl deleted file mode 100644 index 53b492c958..0000000000 --- a/js/packages/go-bridge/ios/framework.bzl +++ /dev/null @@ -1,222 +0,0 @@ -load("@build_bazel_rules_apple//apple:versioning.bzl", "apple_bundle_version") -load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework") -load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") -load("@co_znly_rules_gomobile//:objc.bzl", "gobind_objc") - -_MODULE_MAP_TPL = """\ -framework module {name} {{ -{headers} - - export * -}} -""" - -_UMBRELLA_HEADER_TPL = """\ -#ifndef __{name}_FRAMEWORK_H__ -#define __{name}_FRAMEWORK_H__ - -{includes} - -#endif -""" - -def _module_map_impl(ctx): - headers = [ hdr.basename for hdr in ctx.attr.objc.output_groups.hdrs.to_list()] - headers.append(ctx.attr.bundle_id + ".h") - ctx.actions.write(ctx.outputs.module_map, _MODULE_MAP_TPL.format( - name = ctx.attr.bundle_id, - headers = "\n".join([ - "header \"{}\"".format(hdr) - for hdr in headers - ]), - )) - -def _umbrella_header_impl(ctx): - ctx.actions.write(ctx.outputs.umbrella, _UMBRELLA_HEADER_TPL.format( - name = ctx.attr.bundle_id, - includes = "\n".join([ - "#include \"{}\"".format(hdr.basename) - for hdr in ctx.attr.objc.output_groups.hdrs.to_list() - ]), - )) - - -#TODO: postprocess action - -# def _postprocess_impl(ctx): -# ctx.actions.run( -# outputs = [], -# cmd = "ls .", -# ) - - -# postprocess = rule( -# implementation = _postprocess_impl, -# attrs = { -# "script": attr.string( -# exec -# mandatory = True, -# ), -# "framework": attr.label( -# mandatory = True, -# ), -# }, -# ) - - -module_map = rule( - implementation = _module_map_impl, - attrs = { - "bundle_id": attr.string( - mandatory = True, - ), - "objc": attr.label( - mandatory = True, - ), - }, - outputs = { - "module_map": "module.modulemap" - }, -) - -umbrella_header = rule( - implementation = _umbrella_header_impl, - attrs = { - "bundle_id": attr.string( - mandatory = True, - ), - "objc": attr.label( - mandatory = True, - ), - }, - outputs = { - "umbrella": "umbrella.h" - }, -) - -def gen_framework(name, bundle_name): - gobind_objc( - name = "bridge", - objc_prefix = "", - tags = [], - deps = [ - "@berty//go/framework/gobridge:go_default_library", - ], - gc_linkopts = [ - "-compressdwarf=false", - ] - ) - - native.objc_import( - name = "bridge_lib", - hdrs = [":bridge.objc.hdrs"], - alwayslink = True, - archives = [ - ":bridge.objc.binary" - ], - ) - - apple_bundle_version( - name = "bridge_version", - build_label_pattern = "bridge_{version}/build_{build}", - build_version = "{version}.{build}", - capture_groups = { - "version": "\d+\.\d+", - "build": "\d+", - }, - short_version_string = "{version}", - fallback_build_label = "bridge_99.99/build_999", - ) - - ios_static_framework( - name = "bridge_sdk", - bundle_name = bundle_name, - minimum_os_version = "9.0", - version = ":bridge_version", - deps = [ - ":bridge_lib", - ], - ) - - module_map( - name = "modules", - bundle_id = bundle_name, - objc = ":bridge.objc", - ) - - umbrella_header( - name = "umbrella", - bundle_id = bundle_name, - objc = ":bridge.objc", - ) - - native.genrule( - name = "bridge_umbrella", - srcs = [":umbrella"], - outs = [bundle_name + ".h"], - cmd = "cat $< > $@", - ) - - native.filegroup( - name = "bridge_resources", - srcs = native.glob(["*.plist"]), - ) - - native.genrule( - name = "bridge_binary", - srcs = [":bridge_sdk.apple_static_library"], - outs = [bundle_name], - cmd = "cat $< > $@", - ) - - pkg_tar( - name = "bridge_framework_binary", - package_dir = "Versions/A", - srcs = [":bridge_binary"], - ) - - pkg_tar( - name = "bridge_framework_headers", - package_dir = "Versions/A/Headers", - srcs = [ - ":bridge_umbrella", - ":bridge.objc.hdrs", - ], - ) - - pkg_tar( - name = "bridge_framework_modules", - package_dir = "Versions/A/Modules", - srcs = [":modules"], - ) - - pkg_tar( - name = "bridge_framework_resources", - package_dir = "Versions/A/Resources", - srcs = [":bridge_resources"], - ) - - symls = {} - symls["Modules"] = "Versions/A/Modules" - symls["Headers"] = "Versions/A/Headers" - symls["Resources"] = "Versions/A/Resources" - symls[bundle_name] = "Versions/A/" + bundle_name - symls["Versions/Current"] = "A" - - pkg_tar( - name = name, - extension = "tar.gz", - symlinks = symls, - deps = [ - ":bridge_framework_modules", - ":bridge_framework_binary", - ":bridge_framework_resources", - ":bridge_framework_headers", - ], - ) - - # postprocess( - # name = name, - # script = "bazel_process_framework.sh", - # framework = ":framework", - # ) diff --git a/js/packages/go-bridge/repositories.bzl b/js/packages/go-bridge/repositories.bzl deleted file mode 100644 index fd10246c85..0000000000 --- a/js/packages/go-bridge/repositories.bzl +++ /dev/null @@ -1,45 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@berty//go:repositories.bzl", "berty_go_repositories") - -def berty_bridge_repositories(): - # utils - maybe( - git_repository, - name = "bazel_skylib", - remote = "https://github.com/bazelbuild/bazel-skylib", - commit = "e59b620b392a8ebbcf25879fc3fde52b4dc77535", - shallow_since = "1570639401 -0400", - ) - maybe( - http_archive, - name = "build_bazel_rules_nodejs", - sha256 = "ad4be2c6f40f5af70c7edf294955f9d9a0222c8e2756109731b25f79ea2ccea0", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.38.3/rules_nodejs-0.38.3.tar.gz"], - ) - - # gomobile - maybe( - git_repository, - name = "co_znly_rules_gomobile", - remote = "https://github.com/znly/rules_gomobile", - commit = "ef471f52c2b5cd7f7b8de417d9e6ded3f4d19e72", - shallow_since = "1566492765 +0200", - ) - maybe( - git_repository, - name = "build_bazel_rules_swift", - remote = "https://github.com/bazelbuild/rules_swift.git", - commit = "ebef63d4fd639785e995b9a2b20622ece100286a", - shallow_since = "1570649187 -0700", - ) - maybe( - git_repository, - name = "build_bazel_apple_support", - remote = "https://github.com/bazelbuild/apple_support.git", - commit = "8c585c66c29b9d528e5fcf78da8057a6f3a4f001", - shallow_since = "1570646613 -0700", - ) - - berty_go_repositories() diff --git a/js/packages/storybook-mobile/android/app/build_defs.bzl b/js/packages/storybook-mobile/android/app/build_defs.bzl deleted file mode 100644 index fff270f8d1..0000000000 --- a/js/packages/storybook-mobile/android/app/build_defs.bzl +++ /dev/null @@ -1,19 +0,0 @@ -"""Helper definitions to glob .aar and .jar targets""" - -def create_aar_targets(aarfiles): - for aarfile in aarfiles: - name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] - lib_deps.append(":" + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -def create_jar_targets(jarfiles): - for jarfile in jarfiles: - name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] - lib_deps.append(":" + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) diff --git a/tool/build/bazel/com_github_spacemonkeygo_openssl.BUILD.bazel b/tool/build/bazel/com_github_spacemonkeygo_openssl.BUILD.bazel deleted file mode 100644 index 90605dcb55..0000000000 --- a/tool/build/bazel/com_github_spacemonkeygo_openssl.BUILD.bazel +++ /dev/null @@ -1,65 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -# gazelle:ignore - -go_library( - name = "go_default_library", - srcs = [ - "bio.go", - "build.go", - "cert.go", - "ciphers.go", - "ciphers_gcm.go", - "conn.go", - "ctx.go", - "dh.go", - "dhparam.go", - "digest.go", - "engine.go", - "fips.go", - "hmac.go", - "hostname.c", - "hostname.go", - "http.go", - "init.go", - "init_posix.go", - "init_windows.go", - "key.go", - "mapping.go", - "md4.go", - "md5.go", - "net.go", - "nid.go", - "pem.go", - "sha1.go", - "sha256.go", - "shim.c", - "shim.h", - "sni.c", - "ssl.go", - "tickets.go", - ], - cgo = True, - clinkopts = select({ - "@bazel_tools//src/conditions:darwin": [ - "-L/usr/local/opt/openssl/lib" - ], - "//conditions:default": [], - }) + [ - "-lssl", - "-lcrypto", - ], - copts = select({ - "@bazel_tools//src/conditions:darwin": [ - "-I/usr/local/opt/openssl/include" - ], - "//conditions:default": [], - }), - importmap = "berty.tech/berty/go/vendor/github.com/spacemonkeygo/openssl", - importpath = "github.com/spacemonkeygo/openssl", - visibility = ["//visibility:public"], - deps = [ - "//vendor/github.com/spacemonkeygo/openssl/utils:go_default_library", - "//vendor/github.com/spacemonkeygo/spacelog:go_default_library", - ], -) diff --git a/tool/docker-bazel/Dockerfile b/tool/docker-bazel/Dockerfile deleted file mode 100644 index 4d665b763e..0000000000 --- a/tool/docker-bazel/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# https://docs.bazel.build/versions/master/install-ubuntu.html - -# We need go because we use vendored dependencies -FROM golang:1.14.3-buster - -RUN apt-get update \ - && apt-get install -y \ - pkg-config \ - zip \ - g++ \ - zlib1g-dev \ - unzip \ - python3 \ - git \ - libssl-dev \ - patch \ - && rm -rf /var/lib/apt/lists/* - -# libssl-dev is needed by go-openssl -# patch is needed by rules_go to build org_golang_x_tools with go 1.12.10 -# git is needed by circleci -# the rest is bazel dependencies - -ADD https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-installer-linux-x86_64.sh \ - /tmp/bazel-3.1.0-installer-linux-x86_64.sh - -RUN chmod +x /tmp/bazel-3.1.0-installer-linux-x86_64.sh - -RUN /tmp/bazel-3.1.0-installer-linux-x86_64.sh --user - -RUN chmod o+x /root - -ENV PATH="${PATH}:/root/bin" diff --git a/tool/docker-bazel/Makefile b/tool/docker-bazel/Makefile deleted file mode 100644 index 817758d0be..0000000000 --- a/tool/docker-bazel/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -IMAGE ?= bertytech/bazel -VERSION ?= 3.1.0-buster-r0 - -build: - docker build -t $(IMAGE):$(VERSION) . - -publish: build - docker tag $(IMAGE):$(VERSION) $(IMAGE):latest - docker push $(IMAGE):$(VERSION) - docker push $(IMAGE):latest diff --git a/tool/test/experiment/BUILD.bazel b/tool/test/experiment/BUILD.bazel deleted file mode 100644 index 2af718c5a5..0000000000 --- a/tool/test/experiment/BUILD.bazel +++ /dev/null @@ -1,3 +0,0 @@ -# gazelle:prefix berty.tech/berty/experiment -# gazelle:proto package -# gazelle:proto_group go_package diff --git a/tool/test/experiment/dht/BUILD.bazel b/tool/test/experiment/dht/BUILD.bazel deleted file mode 100644 index 796388e0fe..0000000000 --- a/tool/test/experiment/dht/BUILD.bazel +++ /dev/null @@ -1,8 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["dht.go"], - importpath = "berty.tech/berty/experiment/dht", - visibility = ["//visibility:public"], -) diff --git a/tool/test/experiment/dht/src/bittorrent/BUILD.bazel b/tool/test/experiment/dht/src/bittorrent/BUILD.bazel deleted file mode 100644 index 09a55d2c70..0000000000 --- a/tool/test/experiment/dht/src/bittorrent/BUILD.bazel +++ /dev/null @@ -1,9 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["dht.go"], - importpath = "berty.tech/berty/experiment/dht/src/bittorrent", - visibility = ["//visibility:public"], - deps = ["//dht:go_default_library"], -) diff --git a/tool/test/experiment/dht/src/chord/BUILD.bazel b/tool/test/experiment/dht/src/chord/BUILD.bazel deleted file mode 100644 index 9d713c273a..0000000000 --- a/tool/test/experiment/dht/src/chord/BUILD.bazel +++ /dev/null @@ -1,9 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["dht.go"], - importpath = "berty.tech/berty/experiment/dht/src/chord", - visibility = ["//visibility:public"], - deps = ["//dht:go_default_library"], -) diff --git a/tool/test/experiment/dht/src/gnunet/BUILD.bazel b/tool/test/experiment/dht/src/gnunet/BUILD.bazel deleted file mode 100644 index ac6cf946a1..0000000000 --- a/tool/test/experiment/dht/src/gnunet/BUILD.bazel +++ /dev/null @@ -1,9 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["dht.go"], - importpath = "berty.tech/berty/experiment/dht/src/gnunet", - visibility = ["//visibility:public"], - deps = ["//dht:go_default_library"], -) diff --git a/tool/test/experiment/dht/src/libp2p/BUILD.bazel b/tool/test/experiment/dht/src/libp2p/BUILD.bazel deleted file mode 100644 index f187b09a64..0000000000 --- a/tool/test/experiment/dht/src/libp2p/BUILD.bazel +++ /dev/null @@ -1,9 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["dht.go"], - importpath = "berty.tech/berty/experiment/dht/src/libp2p", - visibility = ["//visibility:public"], - deps = ["//dht:go_default_library"], -) diff --git a/tool/test/experiment/dht/src/matrix/BUILD.bazel b/tool/test/experiment/dht/src/matrix/BUILD.bazel deleted file mode 100644 index 9f9d532bd9..0000000000 --- a/tool/test/experiment/dht/src/matrix/BUILD.bazel +++ /dev/null @@ -1,23 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -go_library( - name = "go_default_library", - srcs = [ - "client.go", - "dht.go", - ], - importpath = "berty.tech/berty/experiment/dht/src/matrix", - visibility = ["//visibility:public"], - deps = [ - "//dht:go_default_library", - "@com_github_matrix_org_gomatrix//:go_default_library", - "@com_github_pkg_errors//:go_default_library", - ], -) - -go_test( - name = "go_default_test", - srcs = ["dht_test.go"], - embed = [":go_default_library"], - deps = ["@com_github_smartystreets_goconvey//convey:go_default_library"], -) diff --git a/tool/test/experiment/dht/src/opendht/BUILD.bazel b/tool/test/experiment/dht/src/opendht/BUILD.bazel deleted file mode 100644 index 9d945a2bbe..0000000000 --- a/tool/test/experiment/dht/src/opendht/BUILD.bazel +++ /dev/null @@ -1,9 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["dht.go"], - importpath = "berty.tech/berty/experiment/dht/src/opendht", - visibility = ["//visibility:public"], - deps = ["//dht:go_default_library"], -) diff --git a/tool/test/experiment/dht/test/BUILD.bazel b/tool/test/experiment/dht/test/BUILD.bazel deleted file mode 100644 index e3b913513a..0000000000 --- a/tool/test/experiment/dht/test/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_test") - -go_test( - name = "go_default_test", - srcs = ["basic_test.go"], - deps = [ - "//dht:go_default_library", - "//dht/src/bittorrent:go_default_library", - "//dht/src/chord:go_default_library", - "//dht/src/gnunet:go_default_library", - "//dht/src/libp2p:go_default_library", - "//dht/src/matrix:go_default_library", - "@com_github_smartystreets_goconvey//convey:go_default_library", - ], -)