Skip to content

Commit

Permalink
Made as many dependencies dev dependencies as can be
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaden Peterson committed Dec 6, 2024
1 parent 4c0ec8d commit 12a9d24
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 485 deletions.
10 changes: 0 additions & 10 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load(
"@rules_java//toolchains:default_java_toolchain.bzl",
"DEFAULT_TOOLCHAIN_CONFIGURATION",
Expand All @@ -19,12 +18,3 @@ register_scalafmt_toolchain(
name = "annex_scalafmt",
config = ".scalafmt.conf",
)

buildifier(
name = "buildifier",
)

buildifier(
name = "buildifier_check",
mode = "check",
)
10 changes: 5 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ module(name = "rules_scala_annex")

bazel_dep(name = "bazel_skylib", version = "1.7.1")

# TODO: Use buildifier instead of buildifier_prebuilt once
# https://github.com/bazelbuild/bazel-central-registry/issues/380 is resolved
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.12.2")
bazel_dep(name = "rules_jvm_external", version = "6.5")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "stardoc", version = "0.7.1")

bazel_dep(name = "rules_pkg", version = "1.0.1", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True)

register_toolchains(
"//:annex_scalafmt",
Expand Down
10 changes: 10 additions & 0 deletions dev/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

buildifier(
name = "buildifier",
)

buildifier(
name = "buildifier_check",
mode = "check",
)
19 changes: 19 additions & 0 deletions dev/stardoc/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
load("@stardoc//stardoc:stardoc.bzl", "stardoc")
load(":stardoc.bzl", "stardoc_targets")

[
stardoc(
name = stardoc_target.name,
out = stardoc_target.out,
input = stardoc_target.input,
deps = ["//rules:scala-rules"],
)
for stardoc_target in stardoc_targets
]

pkg_tar(
name = "docs",
srcs = [stardoc_target.out for stardoc_target in stardoc_targets],
mode = "0644",
)
10 changes: 5 additions & 5 deletions rules/stardoc.bzl → dev/stardoc/stardoc.bzl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
load("@bazel_skylib//lib:paths.bzl", "paths")

_bzl_files_containing_rules = [
"scala.bzl",
"scala_proto.bzl",
"scala_with_scalafmt.bzl",
"scalafmt.bzl",
"//rules:scala.bzl",
"//rules:scala_proto.bzl",
"//rules:scala_with_scalafmt.bzl",
"//rules:scalafmt.bzl",
"//rules/scalafmt:register_toolchain.bzl",
]

def _get_stardoc_targets():
result = []

for label in _bzl_files_containing_rules:
sanitized_name = label.removeprefix("//rules/").replace(":", "_")
sanitized_name = label.removeprefix("//rules:").removeprefix("//rules/").replace(":", "_")

result.append(
struct(
Expand Down
24 changes: 6 additions & 18 deletions rules/BUILD
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
load("@stardoc//stardoc:stardoc.bzl", "stardoc")
load(":stardoc.bzl", "stardoc_targets")

[
stardoc(
name = stardoc_target.name,
out = stardoc_target.out,
input = stardoc_target.input,
deps = [":scala-rules"],
)
for stardoc_target in stardoc_targets
]

pkg_tar(
name = "docs",
srcs = [stardoc_target.out for stardoc_target in stardoc_targets],
mode = "0644",
)
exports_files([
"scala.bzl",
"scala_proto.bzl",
"scala_with_scalafmt.bzl",
"scalafmt.bzl",
])

bzl_library(
name = "bazel_tools_build_defs_repo",
Expand Down
4 changes: 2 additions & 2 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else
fi

if [ "$1" != check ]; then
bazel run buildifier
bazel run //dev:buildifier
else
bazel run buildifier_check
bazel run //dev:buildifier_check
fi
2 changes: 1 addition & 1 deletion scripts/gen-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ set -x

rm -fr docs/stardoc
mkdir -p docs/stardoc
bazel build rules:docs
bazel build //dev/stardoc:docs
tar xf "$(bazel info bazel-bin)/rules/docs.tar" -C docs/stardoc
1 change: 0 additions & 1 deletion tests/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module(name = "rules_scala_annex_tests")

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_java", version = "7.12.2")
bazel_dep(name = "rules_jvm_external", version = "6.5")
bazel_dep(name = "rules_scala_annex")
Expand Down
473 changes: 30 additions & 443 deletions tests/MODULE.bazel.lock

Large diffs are not rendered by default.

0 comments on commit 12a9d24

Please sign in to comment.