From dad9d6a31bca33d548a8978e5ec47a8761f38297 Mon Sep 17 00:00:00 2001 From: danmx Date: Fri, 15 Oct 2021 14:54:50 +0200 Subject: [PATCH 1/2] fix(git-chglog): using correct sources Signed-off-by: danmx --- git-chglog/BUILD | 6 +++--- git-chglog/deps.bzl | 23 ++++++++++------------- git-chglog/git-chglog.BUILD | 4 ++++ git-chglog/git-chglog_windows.BUILD | 4 ++++ 4 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 git-chglog/git-chglog.BUILD create mode 100644 git-chglog/git-chglog_windows.BUILD diff --git a/git-chglog/BUILD b/git-chglog/BUILD index 6712d84..e1d87c0 100644 --- a/git-chglog/BUILD +++ b/git-chglog/BUILD @@ -1,9 +1,9 @@ alias( name = "run", actual = select({ - "@com_github_danmx_bazel_tools//bazel/platforms:linux-x86_64": "@git-chglog-linux-amd64//file:git-chglog", - "@com_github_danmx_bazel_tools//bazel/platforms:macos-x86_64": "@git-chglog-darwin-amd64//file:git-chglog", - "@com_github_danmx_bazel_tools//bazel/platforms:windows-x86_64": "@git-chglog-windows-amd64//file:git-chglog", + "@com_github_danmx_bazel_tools//bazel/platforms:linux-x86_64": "@git-chglog-linux-amd64//:git-chglog", + "@com_github_danmx_bazel_tools//bazel/platforms:macos-x86_64": "@git-chglog-darwin-amd64//:git-chglog", + "@com_github_danmx_bazel_tools//bazel/platforms:windows-x86_64": "@git-chglog-windows-amd64//:git-chglog.exe", }), visibility = ["//visibility:public"], ) diff --git a/git-chglog/deps.bzl b/git-chglog/deps.bzl index 1b37489..e947d5a 100644 --- a/git-chglog/deps.bzl +++ b/git-chglog/deps.bzl @@ -1,24 +1,21 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def git_chglog_dependencies(): - http_file( + http_archive( name = "git-chglog-linux-amd64", - urls = ["https://github.com/git-chglog/git-chglog/releases/download/0.15.0/git-chglog_linux_amd64"], + urls = ["https://github.com/git-chglog/git-chglog/releases/download/v0.15.0/git-chglog_0.15.0_linux_amd64.tar.gz"], sha256 = "815ff0b78b3c3a0cc5e5e456d5f022a56d1f8e34d99165e4476e74be68646854", - executable = True, - downloaded_file_path = "git-chglog", + build_file = "@com_github_danmx_bazel_tools//git-chglog:git-chglog.BUILD", ) - http_file( + http_archive( name = "git-chglog-darwin-amd64", - urls = ["https://github.com/git-chglog/git-chglog/releases/download/0.15.0/git-chglog_darwin_amd64"], + urls = ["https://github.com/git-chglog/git-chglog/releases/download/v0.15.0/git-chglog_0.15.0_darwin_amd64.tar.gz"], sha256 = "286497fb978e1ed70c7a9a1076ee47060547e2a8230b0f1a0d566b112a338e99", - executable = True, - downloaded_file_path = "git-chglog", + build_file = "@com_github_danmx_bazel_tools//git-chglog:git-chglog.BUILD", ) - http_file( + http_archive( name = "git-chglog-windows-amd64", - urls = ["https://github.com/git-chglog/git-chglog/releases/download/0.15.0/git-chglog_windows_amd64.exe"], + urls = ["https://github.com/git-chglog/git-chglog/releases/download/v0.15.0/git-chglog_0.15.0_windows_amd64.zip"], sha256 = "d44ca8282c547c5e02529e10a4fcc11ff00d149b6d2c411ae6cb1b3b1b44ecb4", - executable = True, - downloaded_file_path = "git-chglog", + build_file = "@com_github_danmx_bazel_tools//git-chglog:git-chglog_windows.BUILD", ) diff --git a/git-chglog/git-chglog.BUILD b/git-chglog/git-chglog.BUILD new file mode 100644 index 0000000..0137756 --- /dev/null +++ b/git-chglog/git-chglog.BUILD @@ -0,0 +1,4 @@ +exports_files( + ["git-chglog"], + visibility = ["//visibility:public"], +) diff --git a/git-chglog/git-chglog_windows.BUILD b/git-chglog/git-chglog_windows.BUILD new file mode 100644 index 0000000..64057a8 --- /dev/null +++ b/git-chglog/git-chglog_windows.BUILD @@ -0,0 +1,4 @@ +exports_files( + ["git-chglog.exe"], + visibility = ["//visibility:public"], +) From aca7562021fe1478e9434f9d085293c24add3a4d Mon Sep 17 00:00:00 2001 From: danmx Date: Fri, 15 Oct 2021 16:58:16 +0200 Subject: [PATCH 2/2] bazel: adding buildifier Signed-off-by: danmx --- BUILD | 12 ++++++++++++ WORKSPACE | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/BUILD b/BUILD index e69de29..51bc64b 100644 --- a/BUILD +++ b/BUILD @@ -0,0 +1,12 @@ +load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") + +buildifier( + name = "buildifier", +) + +buildifier( + name = "buildifier_check", + diff_command = "diff -u", + lint_mode = "warn", + mode = "diff", +) diff --git a/WORKSPACE b/WORKSPACE index 65f138e..b604526 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1 +1,52 @@ workspace(name = "com_github_danmx_bazel_tools") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +######################################## +# Buildifier +######################################## +http_archive( + name = "io_bazel_rules_go", + sha256 = "d1ffd055969c8f8d431e2d439813e42326961d0942bdf734d2c95dc30c369566", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +go_rules_dependencies() + +go_register_toolchains() + +http_archive( + name = "bazel_gazelle", + sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", + ], +) + +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") + +gazelle_dependencies() + +http_archive( + name = "com_google_protobuf", + sha256 = "c6003e1d2e7fefa78a3039f19f383b4f3a61e81be8c19356f85b6461998ad3db", + strip_prefix = "protobuf-3.17.3", + urls = ["https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.17.3.tar.gz"], +) + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +http_archive( + name = "com_github_bazelbuild_buildtools", + sha256 = "c28eef4d30ba1a195c6837acf6c75a4034981f5b4002dda3c5aa6e48ce023cf1", + strip_prefix = "buildtools-4.0.1", + url = "https://github.com/bazelbuild/buildtools/archive/refs/tags/4.0.1.tar.gz", +)