diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..000fc1e --- /dev/null +++ b/.bazelrc @@ -0,0 +1,28 @@ +# https://bazel.build/run/bazelrc + +# https://github.com/bazelbuild/rules_jvm_external/blob/master/docs/bzlmod.md#installation +common --enable_bzlmod + +# https://bazel.build/docs/bazel-and-java#java-versions +build --java_language_version=11 +build --tool_java_language_version=11 + +# https://bazel.build/docs/user-manual#java_runtime_version +build --java_runtime_version=remotejdk_11 +build --tool_java_runtime_version=remotejdk_11 + +# https://github.com/bazelbuild/intellij/issues/1169 +build --incompatible_strict_action_env +run --incompatible_strict_action_env + +# https://bazel.build/reference/command-line-reference#flag--test_output +test --test_output=errors + +# https://bazel.build/reference/command-line-reference#flag--explicit_java_test_deps +test --explicit_java_test_deps + +# Quiet! +# common --noshow_progress +common --ui_event_filters=error,warning,info,-debug,stdout,stderr +# FYI -info also hides :( output from tests and tools such as core_buf_proto_lint (TODO how-to show only if failure?) +# Beware, -stdout breaks IDE integrations! diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000..73d3e3a --- /dev/null +++ b/.bazelversion @@ -0,0 +1,2 @@ +6.4.0 + diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..e69de29 diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..789b7f8 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,6 @@ +# https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/bzlmod.md +bazel_dep(name = "rules_go", version = "0.42.0", repo_name = "io_bazel_rules_go") +bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle") + +go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") +go_sdk.download(version = "1.21.3") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 0000000..8488d15 --- /dev/null +++ b/WORKSPACE.bazel @@ -0,0 +1,8 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "googlecodelabs_tools", + sha256 = "9f2b585333fc582b0a545f6b4bee0f4466ef71c7", + strip_prefix = "", + urls = ["https://github.com/googlecodelabs/tools/archive/9f2b585333fc582b0a545f6b4bee0f4466ef71c7.zip"], +) diff --git a/b b/b new file mode 100755 index 0000000..7ec6d08 --- /dev/null +++ b/b @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Inspired by https://github.com/enola-dev/enola/blob/main/enola + +# TODO Put this into a https://github.com/www-learn-study/bazel-template + +set -euo pipefail + +if [ -x "$(command -v gbazelisk)" ]; then + BZL=gbazelisk +elif [ -x "$(command -v bazelisk)" ]; then + BZL=bazelisk +else + # Also in test.bash + echo "bazelisk is not installed, please run e.g. 'go install github.com/bazelbuild/bazelisk@latest' " + echo "or an equivalent from https://github.com/bazelbuild/bazelisk#installation or see docs/dev/setup.md" + exit 255 +fi + +"$BZL" "$@"