From 2ceca7fdee95cd03fcbbba2edb145c536f9a2e1f Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Tue, 25 Jul 2023 19:24:15 -0400 Subject: [PATCH] it's broken but I want to see what changes --- BUILD | 39 ++++++++++++++++++++++++++++++--------- WORKSPACE | 47 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 63 insertions(+), 23 deletions(-) diff --git a/BUILD b/BUILD index 3757a89..847cdda 100644 --- a/BUILD +++ b/BUILD @@ -1,15 +1,36 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + load("@bazel_gazelle//:def.bzl", "gazelle") -# gazelle:prefix code.ndumas.com/ndumas/wikilinks-parser +# 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", +go_library( + name = "obsidian-markdown", + srcs = [ + "lexemetype_string.go", + "lexer.go", + "states.go", + "wikilink.go", + ], + importpath = "code.ndumas.com/ndumas/obsidian-markdown", + 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", ], - command = "update-repos", ) diff --git a/WORKSPACE b/WORKSPACE index 5812c5e..26e7717 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,34 +2,53 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", - sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996", + sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b", 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", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz", ], ) http_archive( name = "bazel_gazelle", - sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405", + sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f", 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", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.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") +load("@bazel_gazelle//:deps.bzl", "gazelle_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(go_repository_default_config = "//:WORKSPACE.bazel") +gazelle_dependencies() + +# release notes at https://github.com/bazelbuild/rules_docker/releases +http_archive( + name = "io_bazel_rules_docker", + sha256 = "59d5b42ac315e7eadffa944e86e90c2990110a1c8075f1cd145f487e999d22b3", + strip_prefix = "rules_docker-0.17.0", + urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.17.0/rules_docker-v0.17.0.tar.gz"], +) + +load( + "@io_bazel_rules_docker//repositories:repositories.bzl", + container_repositories = "repositories", +) +container_repositories() + +load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps") + +container_deps() + +load( + "@io_bazel_rules_docker//go:image.bzl", + _go_image_repos = "repositories", +) + +_go_image_repos()