This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from danmx/bazel_run_refactor
Refactoring tools
- Loading branch information
Showing
21 changed files
with
125 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.1.0 | ||
3.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
config_setting( | ||
name = "windows-x86_64", | ||
constraint_values = [ | ||
"@platforms//os:windows", | ||
"@platforms//cpu:x86_64", | ||
], | ||
) | ||
|
||
config_setting( | ||
name = "macos-x86_64", | ||
constraint_values = [ | ||
"@platforms//os:macos", | ||
"@platforms//cpu:x86_64", | ||
], | ||
) | ||
|
||
config_setting( | ||
name = "linux-x86_64", | ||
constraint_values = [ | ||
"@platforms//os:linux", | ||
"@platforms//cpu:x86_64", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
alias( | ||
name = "run", | ||
actual = select({ | ||
"@com_github_danmx_bazel_tools//bazel/platforms:linux-x86_64": "@drone-linux-amd64//:drone", | ||
"@com_github_danmx_bazel_tools//bazel/platforms:macos-x86_64": "@drone-darwin-amd64//:drone", | ||
"@com_github_danmx_bazel_tools//bazel/platforms:windows-x86_64": "@drone-windows-amd64//:drone", | ||
}), | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,21 @@ | ||
_VERSION = "v1.2.1" | ||
_BINARIES = { | ||
"windows-amd64": { | ||
"suffix": "windows_amd64.tar.gz", | ||
"sha256": "58621ce64bbbb060d4eccccc71061bb9671fef7d1980c74200aae12a669810cb", | ||
}, | ||
"linux-amd64": { | ||
"suffix": "linux_amd64.tar.gz", | ||
"sha256": "c28f724eb44ad756e550789824b9c73d4970da884966bc71552a281815c13f0a", | ||
}, | ||
"linux-arm": { | ||
"suffix": "linux_arm.tar.gz", | ||
"sha256": "297ea83310a7da43d5b25b1ea88cd72c62b024197d58bcf7ab6e7f2b36d4f9eb", | ||
}, | ||
"linux-arm64": { | ||
"suffix": "linux_arm64.tar.gz", | ||
"sha256": "31d3faf3cf9ffac1cacbd7695cfd1eadfc9695d6a08d789b0857298fbeacb386", | ||
}, | ||
"darwin-amd64": { | ||
"suffix": "darwin_amd64.tar.gz", | ||
"sha256": "0b0028ed785c10455a4d67a099de4979cce7825bc97af91d7ebca61525766923", | ||
}, | ||
} | ||
_DOWNLOAD_URI = "https://github.com/drone/drone-cli/releases/download/{version}/drone_{suffix}" | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
def _drone_cli_download_impl(ctx): | ||
if ctx.os.name == "linux": | ||
arch = "linux-amd64" | ||
elif ctx.os.name == "mac os x": | ||
arch = "darwin-amd64" | ||
else: | ||
fail("Unsupported operating system: {}".format(ctx.os.name)) | ||
|
||
if arch not in _BINARIES: | ||
fail("Unsupported arch {}".format(arch)) | ||
|
||
url = _DOWNLOAD_URI.format(version = _VERSION, suffix = _BINARIES.get(arch).get("suffix")) | ||
sha256 = _BINARIES.get(arch).get("sha256") | ||
|
||
ctx.template( | ||
"BUILD.bazel", | ||
Label("//drone-cli:drone.build.bazel"), | ||
executable = False, | ||
def drone_cli_dependencies(): | ||
http_archive( | ||
name = "drone-linux-amd64", | ||
urls = ["https://github.com/drone/drone-cli/releases/download/v1.2.2/drone_linux_amd64.tar.gz"], | ||
sha256 = "59969ed403cab2e8fada1caaf8132c23f5689fde1c7dd9a807cef8786ef25924", | ||
build_file = "@com_github_danmx_bazel_tools//drone-cli:drone.BUILD", | ||
) | ||
ctx.download_and_extract( | ||
url = url, | ||
sha256 = sha256, | ||
http_archive( | ||
name = "drone-darwin-amd64", | ||
urls = ["https://github.com/drone/drone-cli/releases/download/v1.2.2/drone_darwin_amd64.tar.gz"], | ||
sha256 = "73f96ad0a9f3038463a86408b231b80758e64aa4ce85534933d85ee718ae096c", | ||
build_file = "@com_github_danmx_bazel_tools//drone-cli:drone.BUILD", | ||
) | ||
|
||
_drone_cli_download = repository_rule( | ||
implementation = _drone_cli_download_impl, | ||
) | ||
|
||
def drone_cli_dependencies(): | ||
_drone_cli_download( | ||
name = "com_github_danmx_bazel_tools_drone-cli", | ||
http_archive( | ||
name = "drone-windows-amd64", | ||
urls = ["https://github.com/drone/drone-cli/releases/download/v1.2.2/drone_windows_amd64.tar.gz"], | ||
sha256 = "8ae9bb0b07ced2536cc8c8c0e236d1d8ae08b53387e1139a470e2cd37076a3ca", | ||
build_file = "@com_github_danmx_bazel_tools//drone-cli:drone.BUILD", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exports_files( | ||
["drone"], | ||
visibility = ["//visibility:public"], | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
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", | ||
}), | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,24 @@ | ||
_VERSION = "0.9.1" | ||
_BINARIES = { | ||
"windows-amd64": { | ||
"suffix": "windows_amd64.exe", | ||
"sha256": "d14da18c6008de0c240b75991368a137068c8a06d3d4c3c240ddc806fd7b9612", | ||
}, | ||
"windows-386": { | ||
"suffix": "windows_386.exe", | ||
"sha256": "00971cd3718084f405002d9732ad8758469b04a059feae96f3a943a0706065dd", | ||
}, | ||
"linux-amd64": { | ||
"suffix": "linux_amd64", | ||
"sha256": "dca7d683a45cf4f0a871735d9981de4e787ef86b82282e8adc813b8738d2c531", | ||
}, | ||
"linux-386": { | ||
"suffix": "linux_386", | ||
"sha256": "25021b185b706e3f0b3cdc56e1f69e1263c5f0d157725e2df0965b31eb2240d8", | ||
}, | ||
"darwin-amd64": { | ||
"suffix": "darwin_amd64", | ||
"sha256": "2023d82b5b505cf8ac4db20f096f439650554e80eb509fe080f5e81b6b477d3c", | ||
}, | ||
"darwin-386": { | ||
"suffix": "darwin_386", | ||
"sha256": "02011ddcbb5f2c21ba71cbd3bbe978cf74362ba579f31f6178ff835addd9f097", | ||
}, | ||
} | ||
_DOWNLOAD_URI = "https://github.com/git-chglog/git-chglog/releases/download/{version}/git-chglog_{suffix}" | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") | ||
|
||
def _git_chglog_download_impl(ctx): | ||
if ctx.os.name == "linux": | ||
arch = "linux-amd64" | ||
elif ctx.os.name == "mac os x": | ||
arch = "darwin-amd64" | ||
else: | ||
fail("Unsupported operating system: {}".format(ctx.os.name)) | ||
|
||
if arch not in _BINARIES: | ||
fail("Unsupported arch {}".format(arch)) | ||
|
||
url = _DOWNLOAD_URI.format(version = _VERSION, suffix = _BINARIES.get(arch).get("suffix")) | ||
sha256 = _BINARIES.get(arch).get("sha256") | ||
|
||
ctx.template( | ||
"BUILD.bazel", | ||
Label("//git-chglog:git-chglog.build.bazel"), | ||
executable = False, | ||
def git_chglog_dependencies(): | ||
http_file( | ||
name = "git-chglog-linux-amd64", | ||
urls = ["https://github.com/git-chglog/git-chglog/releases/download/0.9.1/git-chglog_linux_amd64"], | ||
sha256 = "dca7d683a45cf4f0a871735d9981de4e787ef86b82282e8adc813b8738d2c531", | ||
executable = True, | ||
downloaded_file_path = "git-chglog", | ||
) | ||
ctx.download( | ||
output = "git-chglog", | ||
url = url, | ||
sha256 = sha256, | ||
http_file( | ||
name = "git-chglog-darwin-amd64", | ||
urls = ["https://github.com/git-chglog/git-chglog/releases/download/0.9.1/git-chglog_darwin_amd64"], | ||
sha256 = "2023d82b5b505cf8ac4db20f096f439650554e80eb509fe080f5e81b6b477d3c", | ||
executable = True, | ||
downloaded_file_path = "git-chglog", | ||
) | ||
|
||
_git_chglog_download = repository_rule( | ||
implementation = _git_chglog_download_impl, | ||
) | ||
|
||
def git_chglog_dependencies(): | ||
_git_chglog_download( | ||
name = "com_github_danmx_bazel_tools_git-chglog", | ||
http_file( | ||
name = "git-chglog-windows-amd64", | ||
urls = ["https://github.com/git-chglog/git-chglog/releases/download/0.9.1/git-chglog_windows_amd64.exe"], | ||
sha256 = "d14da18c6008de0c240b75991368a137068c8a06d3d4c3c240ddc806fd7b9612", | ||
executable = True, | ||
downloaded_file_path = "git-chglog", | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
alias( | ||
name = "run", | ||
actual = select({ | ||
"@com_github_danmx_bazel_tools//bazel/platforms:linux-x86_64": "@golangci-lint-linux-amd64//:golangci-lint", | ||
"@com_github_danmx_bazel_tools//bazel/platforms:macos-x86_64": "@golangci-lint-darwin-amd64//:golangci-lint", | ||
"@com_github_danmx_bazel_tools//bazel/platforms:windows-x86_64": "@golangci-lint-windows-amd64//:golangci-lint", | ||
}), | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.