From ecf359f9365c1e4e52ac8c3b62d3ce9ebaf7b2fd Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Tue, 25 Jul 2023 18:53:07 -0400 Subject: [PATCH] experimenting with bazel --- BUILD | 15 +++++++++++++++ WORKSPACE | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 BUILD create mode 100644 WORKSPACE diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..3757a89 --- /dev/null +++ b/BUILD @@ -0,0 +1,15 @@ +load("@bazel_gazelle//:def.bzl", "gazelle") + +# gazelle:prefix code.ndumas.com/ndumas/wikilinks-parser +gazelle(name = "gazelle") + +gazelle( + name = "gazelle-update-repos", + args = [ + "-from_file=go.mod", + "-to_macro=deps.bzl%go_dependencies", + "-prune", + "-build_file_proto_mode=disable_global", + ], + command = "update-repos", +) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..5812c5e --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,35 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "io_bazel_rules_go", + sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip", + ], +) + +http_archive( + name = "bazel_gazelle", + sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz", + ], +) + + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") + +############################################################ +# Define your own dependencies here using go_repository. +# Else, dependencies declared by rules_go/gazelle will be used. +# The first declaration of an external repository "wins". +############################################################ + +go_rules_dependencies() + +go_register_toolchains(version = "1.20.5") + +gazelle_dependencies(go_repository_default_config = "//:WORKSPACE.bazel")