From bdc6f9fac743035c713f4984f5f290c3c57f8d04 Mon Sep 17 00:00:00 2001 From: Jaden Peterson Date: Fri, 6 Dec 2024 14:12:12 -0500 Subject: [PATCH] Made as many dependencies dev dependencies as can be --- BUILD.bazel | 10 ---------- MODULE.bazel | 10 +++++++--- dev/BUILD.bazel | 10 ++++++++++ dev/stardoc/BUILD.bazel | 30 ++++++++++++++++++++++++++++++ play-routes/BUILD.bazel | 22 +--------------------- scripts/format.sh | 4 ++-- scripts/gen-docs.sh | 2 +- 7 files changed, 51 insertions(+), 37 deletions(-) create mode 100644 dev/BUILD.bazel create mode 100644 dev/stardoc/BUILD.bazel diff --git a/BUILD.bazel b/BUILD.bazel index 2f68935..0a8b7c3 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,4 +1,3 @@ -load("@buildifier_prebuilt//:rules.bzl", "buildifier") load( "@rules_java//toolchains:default_java_toolchain.bzl", "DEFAULT_JAVACOPTS", @@ -16,12 +15,3 @@ default_java_toolchain( source_version = "21", target_version = "21", ) - -buildifier( - name = "buildifier", -) - -buildifier( - name = "buildifier_check", - mode = "check", -) diff --git a/MODULE.bazel b/MODULE.bazel index 77a624d..c73c39b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,10 +1,14 @@ module(name = "rules_play_routes") bazel_dep(name = "bazel_skylib", version = "1.7.1") -bazel_dep(name = "buildifier_prebuilt", version = "7.3.1") + +bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True) + bazel_dep(name = "rules_java", version = "7.11.1") bazel_dep(name = "rules_jvm_external", version = "6.4") -bazel_dep(name = "rules_pkg", version = "1.0.1") + +bazel_dep(name = "rules_pkg", version = "1.0.1", dev_dependency = True) + bazel_dep(name = "rules_scala_annex") rules_scala_annex_version = "bzlmod-migration" @@ -16,7 +20,7 @@ archive_override( urls = ["https://github.com/lucidsoftware/rules_scala/archive/refs/heads/{}.zip".format(rules_scala_annex_version)], ) -bazel_dep(name = "stardoc", version = "0.7.1") +bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True) register_toolchains( "//:repository_default_toolchain_21_definition", diff --git a/dev/BUILD.bazel b/dev/BUILD.bazel new file mode 100644 index 0000000..380f014 --- /dev/null +++ b/dev/BUILD.bazel @@ -0,0 +1,10 @@ +load("@buildifier_prebuilt//:rules.bzl", "buildifier") + +buildifier( + name = "buildifier", +) + +buildifier( + name = "buildifier_check", + mode = "check", +) diff --git a/dev/stardoc/BUILD.bazel b/dev/stardoc/BUILD.bazel new file mode 100644 index 0000000..e435224 --- /dev/null +++ b/dev/stardoc/BUILD.bazel @@ -0,0 +1,30 @@ +load("@bazel_skylib//lib:paths.bzl", "paths") +load("@rules_pkg//:pkg.bzl", "pkg_tar") +load("@stardoc//stardoc:stardoc.bzl", "stardoc") + +bzl_files = ["//play-routes:play-routes.bzl"] + +[ + stardoc( + name = paths + .replace_extension(file, "_doc") + .removeprefix("//play-routes:") + .replace("/", "_"), + out = paths.replace_extension(file, ".md").removeprefix("//play-routes:").replace("/", "_"), + input = file, + symbol_names = ["play_routes"], + deps = [ + "//play-routes:bzl_internal", + ], + ) + for file in bzl_files +] + +pkg_tar( + name = "docs", + srcs = [ + paths.replace_extension(file, ".md").removeprefix("//play-routes:").replace("/", "_") + for file in bzl_files + ], + mode = "0644", +) diff --git a/play-routes/BUILD.bazel b/play-routes/BUILD.bazel index 1407b96..cdf4ba2 100644 --- a/play-routes/BUILD.bazel +++ b/play-routes/BUILD.bazel @@ -1,26 +1,6 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@bazel_skylib//lib:paths.bzl", "paths") -load("@rules_pkg//:pkg.bzl", "pkg_tar") -load("@stardoc//stardoc:stardoc.bzl", "stardoc") -[ - stardoc( - name = paths.replace_extension(file, "_doc").replace("/", "_"), - out = paths.replace_extension(file, ".md").replace("/", "_"), - input = file, - symbol_names = ["play_routes"], - deps = [ - "//play-routes:bzl_internal", - ], - ) - for file in glob(["**/*.bzl"]) -] - -pkg_tar( - name = "docs", - srcs = [paths.replace_extension(file, ".md").replace("/", "_") for file in glob(["**/*.bzl"])], - mode = "0644", -) +exports_files(["play-routes.bzl"]) bzl_library( name = "bzl_internal", diff --git a/scripts/format.sh b/scripts/format.sh index f20b051..7dcd629 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -3,7 +3,7 @@ set -euo pipefail if [ "$#" -eq 0 ] || [ "$1" != check ]; then - bazel run buildifier + bazel run //dev:buildifier else - bazel run buildifier_check + bazel run //dev:buildifier_check fi diff --git a/scripts/gen-docs.sh b/scripts/gen-docs.sh index 768f86e..a84bda7 100755 --- a/scripts/gen-docs.sh +++ b/scripts/gen-docs.sh @@ -11,7 +11,7 @@ set -euxo pipefail rm -fr docs/stardoc mkdir -p docs/stardoc -bazel build play-routes:docs +bazel build //dev/stardoc:docs tar xf "$(bazel info bazel-bin)/play-routes/docs.tar" -C docs/stardoc find docs/stardoc -size 0 -print0 | while read path; do rm $path