diff --git a/BUILD b/BUILD index 32dd2bd..e69de29 100644 --- a/BUILD +++ b/BUILD @@ -1,45 +0,0 @@ -load("@rules_go//go:def.bzl", "go_library", "go_test") -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", -) - -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/MODULE.bazel b/MODULE.bazel index 1e12151..b4dc01b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -6,3 +6,6 @@ module( 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") + +go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") +go_deps.from_file(go_mod = "//:go.mod") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 9a16010..9f4a1a5 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 1, - "moduleFileHash": "632d10f357e09a25e581aec8f5534e5653cddc1af7910e85c1661d4bf3797328", + "moduleFileHash": "584fb7092f82ede5c56c2e5afbc5553ce6d7e6aa4bbd47c41f4ef0e9bcc90aa1", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -23,7 +23,34 @@ "repoName": "code.ndumas.com_ndumas_obsidian-markdown", "executionPlatformsToRegister": [], "toolchainsToRegister": [], - "extensionUsages": [], + "extensionUsages": [ + { + "extensionBzlFile": "@gazelle//:extensions.bzl", + "extensionName": "go_deps", + "usingModule": "", + "location": { + "file": "@@//:MODULE.bazel", + "line": 10, + "column": 24 + }, + "imports": {}, + "devImports": [], + "tags": [ + { + "tagName": "from_file", + "attributeValues": {"go_mod":"--//:go.mod"}, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 11, + "column": 18 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], "deps": { "bazel_tools": "bazel_tools@_", "local_config_platform": "local_config_platform@_", diff --git a/WORKSPACE b/WORKSPACE index e69de29..45c2ed3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -0,0 +1,4 @@ +load("//:deps.bzl", "go_dependencies") + +# gazelle:repository_macro deps.bzl%go_dependencies +go_dependencies()