From a452a533739f56140d36cfbcfaa873c391907cd2 Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Wed, 26 Jul 2023 23:38:36 -0400 Subject: [PATCH] trying more stuff --- BUILD.bazel | 45 --------------------------------------------- BUILD.bzl | 15 +++++++++++++++ MODULE.bzl | 9 +++++++++ WORKSPACE | 37 ------------------------------------- 4 files changed, 24 insertions(+), 82 deletions(-) delete mode 100644 BUILD.bazel create mode 100644 BUILD.bzl create mode 100644 MODULE.bzl diff --git a/BUILD.bazel b/BUILD.bazel deleted file mode 100644 index 6cace17..0000000 --- a/BUILD.bazel +++ /dev/null @@ -1,45 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") -load("@bazel_gazelle//:def.bzl", "gazelle") - -# gazelle:prefix code.ndumas.com/ndumas/obsidian-markdown -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", -) - -go_library( - name = "obsidian-markdown", - srcs = [ - "lexemetype_string.go", - "lexer.go", - "states.go", - "wikilink.go", - ], - importpath = "code.ndumas.com/ndumas/obsidian-markdown", - visibility = ["//visibility:public"], - deps = [ - "@org_uber_go_zap//:go_default_library", - "@org_uber_go_zap//zapcore:go_default_library", - ], -) - -go_test( - name = "obsidian-markdown_test", - srcs = [ - "lexer_test.go", - "wikilink_test.go", - ], - deps = [ - ":obsidian-markdown", - "@com_github_stretchr_testify//assert:go_default_library", - "@org_uber_go_zap//zapcore:go_default_library", - ], -) diff --git a/BUILD.bzl b/BUILD.bzl new file mode 100644 index 0000000..7b43334 --- /dev/null +++ b/BUILD.bzl @@ -0,0 +1,15 @@ +load("//gazelle:def.bzl", "gazelle") + +# gazelle:prefix code.ndumas.com/ndumas/obsidian-markdown +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/MODULE.bzl b/MODULE.bzl new file mode 100644 index 0000000..042e368 --- /dev/null +++ b/MODULE.bzl @@ -0,0 +1,9 @@ +module( + name = "obsidian-markdown", + version = "?????" + repo_name = "code.ndumas.com/ndumas/obsidian-markdown" +) + +bazel_dep(name = "gazelle", version = "0.32.0") +bazel_dep(name = "rules_go", version = "0.41.0") +bazel_dep(name = "rules_oci", version = "1.2.0") diff --git a/WORKSPACE b/WORKSPACE index 6f43f20..e69de29 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,37 +0,0 @@ -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") -load("//:deps.bzl", "go_dependencies") - -# gazelle:repository_macro deps.bzl%go_dependencies -go_dependencies() - -############################################################ -# 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()