diff --git a/BUILD b/BUILD index 098ab0f..c6f1298 100644 --- a/BUILD +++ b/BUILD @@ -21,6 +21,7 @@ go_library( go_test( name = "obsidian-markdown_test", + size = "small", srcs = [ "lexer_test.go", "wikilink_test.go", diff --git a/MODULE.bazel b/MODULE.bazel index 58675d2..676c97e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -6,7 +6,7 @@ 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") +bazel_dep(name = "rules_pkg", version = "0.9.1") go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//:go.mod") -use_repo(go_deps, "com_github_stretchr_testify", "org_uber_go_zap") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index f28f436..f789ffe 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 1, - "moduleFileHash": "8e0c6ff443921924f3ba7aa090e092ad662b32805bcff4afd18f410026739af9", + "moduleFileHash": "6cd01330e5182d9c2fe78793c2c14fcdd3ba3a439048c3f01595bbf6179ec8f5", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -30,13 +30,10 @@ "usingModule": "", "location": { "file": "@@//:MODULE.bazel", - "line": 10, + "line": 11, "column": 24 }, - "imports": { - "com_github_stretchr_testify": "com_github_stretchr_testify", - "org_uber_go_zap": "org_uber_go_zap" - }, + "imports": {}, "devImports": [], "tags": [ { @@ -45,7 +42,7 @@ "devDependency": false, "location": { "file": "@@//:MODULE.bazel", - "line": 11, + "line": 12, "column": 18 } } @@ -59,7 +56,8 @@ "local_config_platform": "local_config_platform@_", "gazelle": "gazelle@0.32.0", "rules_go": "rules_go@0.41.0", - "rules_oci": "rules_oci@1.2.0" + "rules_oci": "rules_oci@1.2.0", + "rules_pkg": "rules_pkg@0.9.1" } }, "bazel_tools@_": { @@ -187,9 +185,9 @@ "local_config_platform": "local_config_platform@_", "rules_cc": "rules_cc@0.0.2", "rules_java": "rules_java@5.5.0", - "rules_license": "rules_license@0.0.3", + "rules_license": "rules_license@0.0.4", "rules_proto": "rules_proto@4.0.0", - "rules_python": "rules_python@0.4.0", + "rules_python": "rules_python@0.10.2", "platforms": "platforms@0.0.5", "com_google_protobuf": "protobuf@3.19.6", "zlib": "zlib@1.2.13" @@ -472,6 +470,27 @@ "attributes": {"name":"--rules_oci~1.2.0","urls":["--https://github.com/bazel-contrib/rules_oci/releases/download/v1.2.0/rules_oci-v1.2.0.tar.gz"],"integrity":"--sha256-F25gHSHRFR79iLawJ6JOeCSTxdYj2MYhHHdn8wbWVcg=","strip_prefix":"--rules_oci-1.2.0","remote_patches":{"--https://bcr.bazel.build/modules/rules_oci/1.2.0/patches/module_dot_bazel_version.patch":"--sha256-rpNmNQI9MhkcEKM/AIsDtNcJMtKhHn/sY2Tycv0RLQA="},"remote_patch_strip":0} } }, + "rules_pkg@0.9.1": { + "name": "rules_pkg", + "version": "0.9.1", + "key": "rules_pkg@0.9.1", + "repoName": "rules_pkg", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_", + "rules_license": "rules_license@0.0.4", + "bazel_skylib": "bazel_skylib@1.4.1", + "rules_python": "rules_python@0.10.2" + }, + "repoSpec": { + "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": {"name":"--rules_pkg~0.9.1","urls":["--https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz"],"integrity":"--sha256-j57i3BDBrlFO5ZmotC7Zn6Jit1cFj2WtPDhCif9wxLg=","strip_prefix":"--","remote_patches":{},"remote_patch_strip":0} + } + }, "rules_cc@0.0.2": { "name": "rules_cc", "version": "0.0.2", @@ -590,10 +609,10 @@ "attributes": {"name":"--rules_java~5.5.0","urls":["--https://github.com/bazelbuild/rules_java/releases/download/5.5.0/rules_java-5.5.0.tar.gz"],"integrity":"--sha256-vPq/tAfLDIggFBMQ+qEC9/uSzIBrDw4mpiUZYQGwtX4=","strip_prefix":"--","remote_patches":{},"remote_patch_strip":0} } }, - "rules_license@0.0.3": { + "rules_license@0.0.4": { "name": "rules_license", - "version": "0.0.3", - "key": "rules_license@0.0.3", + "version": "0.0.4", + "key": "rules_license@0.0.4", "repoName": "rules_license", "executionPlatformsToRegister": [], "toolchainsToRegister": [], @@ -605,7 +624,7 @@ "repoSpec": { "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", - "attributes": {"name":"--rules_license~0.0.3","urls":["--https://github.com/bazelbuild/rules_license/releases/download/0.0.3/rules_license-0.0.3.tar.gz"],"integrity":"--sha256-AMzA3yExLBJ6xLEogKsPmibBz/mUQtxsWjMXUDYN48M=","strip_prefix":"--","remote_patches":{"--https://bcr.bazel.build/modules/rules_license/0.0.3/patches/module_dot_bazel.patch":"--sha256-yim5cwFqlS1F1UomygmIEM/UQhrkQZyYrwo48WFt4gE="},"remote_patch_strip":0} + "attributes": {"name":"--rules_license~0.0.4","urls":["--https://github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz"],"integrity":"--sha256-YVfh5oN4Uy0CQezRXTxF9uXP2Y/BCEYEVQn7KnzJ44E=","strip_prefix":"--","remote_patches":{"--https://bcr.bazel.build/modules/rules_license/0.0.4/patches/module_dot_bazel.patch":"--sha256-2O91O30x+WJKMjIsPWLJJoOK5W+4CpMWdFoCulGUprA="},"remote_patch_strip":0} } }, "rules_proto@4.0.0": { @@ -628,10 +647,10 @@ "attributes": {"name":"--rules_proto~4.0.0","urls":["--https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.zip"],"integrity":"--sha256-Lr5z6xyuRA19pNtRYMGjKaynwQpck4H/lwYyVjyhoq4=","strip_prefix":"--rules_proto-4.0.0","remote_patches":{"--https://bcr.bazel.build/modules/rules_proto/4.0.0/patches/module_dot_bazel.patch":"--sha256-MclJO7tIAM2ElDAmscNId9pKTpOuDGHgVlW/9VBOIp0="},"remote_patch_strip":0} } }, - "rules_python@0.4.0": { + "rules_python@0.10.2": { "name": "rules_python", - "version": "0.4.0", - "key": "rules_python@0.4.0", + "version": "0.10.2", + "key": "rules_python@0.10.2", "repoName": "rules_python", "executionPlatformsToRegister": [], "toolchainsToRegister": [ @@ -639,20 +658,23 @@ ], "extensionUsages": [ { - "extensionBzlFile": "@rules_python//bzlmod:extensions.bzl", + "extensionBzlFile": "@rules_python//python:extensions.bzl", "extensionName": "pip_install", - "usingModule": "rules_python@0.4.0", + "usingModule": "rules_python@0.10.2", "location": { - "file": "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel", + "file": "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel", "line": 7, "column": 28 }, "imports": { "pypi__click": "pypi__click", + "pypi__colorama": "pypi__colorama", + "pypi__installer": "pypi__installer", + "pypi__pep517": "pypi__pep517", "pypi__pip": "pypi__pip", "pypi__pip_tools": "pypi__pip_tools", - "pypi__pkginfo": "pypi__pkginfo", "pypi__setuptools": "pypi__setuptools", + "pypi__tomli": "pypi__tomli", "pypi__wheel": "pypi__wheel" }, "devImports": [], @@ -668,7 +690,7 @@ "repoSpec": { "bzlFile": "@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", - "attributes": {"name":"--rules_python~0.4.0","urls":["--https://github.com/bazelbuild/rules_python/releases/download/0.4.0/rules_python-0.4.0.tar.gz"],"integrity":"--sha256-lUqom0kb5KCDMEosuDgBnIuMNyCnq7nEy4GseiQjDOo=","strip_prefix":"--","remote_patches":{"--https://bcr.bazel.build/modules/rules_python/0.4.0/patches/propagate_pip_install_dependencies.patch":"--sha256-v7S/dem/mixg63MF4KoRGDA4KEol9ab/tIVp+6Xq0D0=","--https://bcr.bazel.build/modules/rules_python/0.4.0/patches/module_dot_bazel.patch":"--sha256-kG4VIfWxQazzTuh50mvsx6pmyoRVA4lfH5rkto/Oq+Y="},"remote_patch_strip":1} + "attributes": {"name":"--rules_python~0.10.2","urls":["--https://github.com/bazelbuild/rules_python/archive/refs/tags/0.10.2.tar.gz"],"integrity":"--sha256-o6bpn0l74In4HsCCiC5AJGv9Q19S9OgvN+iUSbBFc/Y=","strip_prefix":"--rules_python-0.10.2","remote_patches":{"--https://bcr.bazel.build/modules/rules_python/0.10.2/patches/module_dot_bazel.patch":"--sha256-TScILAmXmmMtjJIwhLrgNZgqGPs6G3OAzXaLXLDNFrA="},"remote_patch_strip":0} } }, "platforms@0.0.5": { @@ -702,7 +724,7 @@ "local_config_platform": "local_config_platform@_", "bazel_skylib": "bazel_skylib@1.4.1", "zlib": "zlib@1.2.13", - "rules_python": "rules_python@0.4.0", + "rules_python": "rules_python@0.10.2", "rules_cc": "rules_cc@0.0.2", "rules_proto": "rules_proto@4.0.0", "rules_java": "rules_java@5.5.0" diff --git a/cmd/demo/BUILD.bazel b/cmd/demo/BUILD.bazel index f2ff98a..f431ee1 100644 --- a/cmd/demo/BUILD.bazel +++ b/cmd/demo/BUILD.bazel @@ -16,3 +16,25 @@ go_binary( embed = [":demo_lib"], visibility = ["//visibility:public"], ) + + +load("@rules_pkg//:pkg.bzl", "pkg_tar") + +pkg_tar( + name = "tar", + srcs = [":demo"], +) + +load("@rules_oci//oci:defs.bzl", "oci_image") + +oci_image( + name = "image", + architecture = select({ + "@platforms//cpu:arm64": "arm64", + "@platforms//cpu:x86_64": "amd64", + }), + base = ":distroless_base", + tars = [":tar"], + entrypoint = ["/app"], + os = "linux", +) diff --git a/cmd/demo/MODULE.bazel b/cmd/demo/MODULE.bazel new file mode 100644 index 0000000..f6fd1ab --- /dev/null +++ b/cmd/demo/MODULE.bazel @@ -0,0 +1,8 @@ +load("@rules_oci//oci:pull.bzl", "oci_pull") + +oci_pull( + name = "distroless_base", + digest = "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86", + image = "gcr.io/distroless/base", + platforms = ["linux/amd64","linux/arm64"], +)