diff --git a/README.md b/README.md index 874d2061..cf7080ef 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,21 @@ -# higherkindness/rules_scala +# lucidsoftware/rules_scala [![Build Status](https://github.com/lucidsoftware/rules_scala/workflows/CI/badge.svg)](https://github.com/lucidsoftware/rules_scala/actions) -`higherkindness/rules_scala` evolved, in part, from the need for Bazel adoption support for large, monorepo Scala projects. -Bazel is wonderful because it makes use of parallelism and caching to vastly improve build times. However, to see these benefits, a project must first be broken down into -tiny packages and make use of fine-grained dependencies. This is not always a realistic short-term goal for large, monorepo Scala projects. +Previously known as [higherkindness/rules_scala](https://github.com/higherkindness/rules_scala), +`lucidsoftware/rules_scala` evolved, in part, from the need for Bazel adoption support for large, +monorepo Scala projects. Bazel is wonderful because it makes use of parallelism and caching to +vastly improve build times. However, to see these benefits, a project must first be broken down into +tiny packages and make use of fine-grained dependencies. This is not always a realistic short-term +goal for large, monorepo Scala projects. -`higherkindness/rules_scala` allows for the optional use of Zinc incremental compilation to provide a stepping stone for these projects as they migrate to Bazel. +`lucidsoftware/rules_scala` allows for the optional use of Zinc incremental compilation to provide a +stepping stone for these projects as they migrate to Bazel. Although we've verified it to be correct +and determinisitc, we recommend leaving this disabled, as fine-grained and isolated targets are +more in-line with the [Bazel philosophy](https://bazel.build/basics/hermeticity). -`higherkindness/rules_scala` is written with maintainability and accessibility in mind. It aims to facilitate the transition to Bazel, and to satisfy use cases throughout the Scala ecosystem. +`lucidsoftware/rules_scala` is written with maintainability and accessibility in mind. It aims to +facilitate the transition to Bazel, and to satisfy use cases throughout the Scala ecosystem. ## Principles @@ -17,7 +24,8 @@ tiny packages and make use of fine-grained dependencies. This is not always a re 3. Be accessible and maintainable. 4. Have high-quality documentation. -If the right design principles are kept, implementing additional features should be simple and straightforward. +If the right design principles are kept, implementing additional features should be simple and +straightforward. ## Features @@ -51,73 +59,71 @@ WORKSPACE ```python load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -# Load rules scala annex -rules_scala_annex_version = "ae99fcb08bbddfc24fef00d7b13f6c065e1df8d5" -rules_scala_annex_sha256 = "1630fc7ecc7a4ffeabcdef73c7600eab9cf3fd2377db1f69b8ce1927560211ff" +# rules_java +http_archive( + name = "rules_java", + sha256 = "a9690bc00c538246880d5c83c233e4deb83fe885f54c21bb445eb8116a180b83", + url = "https://github.com/bazelbuild/rules_java/releases/download/7.12.2/rules_java-7.12.2.tar.gz", +) + +# Load rules_scala_annex +rules_scala_annex_version = "lucid_2024-11-18" + http_archive( name = "rules_scala_annex", - sha256 = rules_scala_annex_sha256, + integrity = "sha256-WjZvojiclkiyVxQ1NqkH1lDeGaDLyzQOGiDsCfhVAec=", strip_prefix = "rules_scala-{}".format(rules_scala_annex_version), - url = "https://github.com/higherkindness/rules_scala/archive/{}.zip".format(rules_scala_annex_version), + type = "zip", + url = "https://github.com/lucidsoftware/rules_scala/archive/{}.zip".format(rules_scala_annex_version), ) -rules_jvm_external_tag = "2.9" -rules_jvm_external_sha256 = "e5b97a31a3e8feed91636f42e19b11c49487b85e5de2f387c999ea14d77c7f45" +rules_jvm_external_version = "6.1" + http_archive( name = "rules_jvm_external", - sha256 = rules_jvm_external_sha256, - strip_prefix = "rules_jvm_external-{}".format(rules_jvm_external_tag), - url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(rules_jvm_external_tag), + sha256 = "42a6d48eb2c08089961c715a813304f30dc434df48e371ebdd868fc3636f0e82", + strip_prefix = "rules_jvm_external-{}".format(rules_jvm_external_version), + type = "zip", + url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(rules_jvm_external_version), +) + +load( + "@rules_scala_annex//rules/scala:workspace.bzl", + "scala_register_toolchains", + "scala_repositories", +) + +load( + "@rules_scala_annex//rules/scala_proto:workspace.bzl", + "scala_proto_register_toolchains", + "scala_proto_repositories", +) + +load( + "@rules_scala_annex//rules/scalafmt:workspace.bzl", + "scalafmt_default_config", + "scalafmt_repositories", ) -load("@rules_scala_annex//rules/scala:workspace.bzl", "scala_register_toolchains", "scala_repositories") scala_repositories() + load("@annex//:defs.bzl", annex_pinned_maven_install = "pinned_maven_install") + annex_pinned_maven_install() -scala_register_toolchains(default_scala_toolchain_name = "annex_zinc_3") -load("@rules_scala_annex//rules/scalafmt:workspace.bzl", "scalafmt_default_config", "scalafmt_repositories") +scala_register_toolchains(default_scala_toolchain_name = "annex_zinc_3") scalafmt_repositories() + load("@annex_scalafmt//:defs.bzl", annex_scalafmt_pinned_maven_install = "pinned_maven_install") + annex_scalafmt_pinned_maven_install() scalafmt_default_config() - -load("@rules_scala_annex//rules/scala_proto:workspace.bzl", "scala_proto_register_toolchains", "scala_proto_repositories",) scala_proto_repositories() + load("@annex_proto//:defs.bzl", annex_proto_pinned_maven_install = "pinned_maven_install") + annex_proto_pinned_maven_install() scala_proto_register_toolchains() - -# Load bazel skylib and google protobuf -bazel_skylib_tag = "1.0.2" -bazel_skylib_sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44" -http_archive( - name = "bazel_skylib", - sha256 = bazel_skylib_sha256, - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{tag}/bazel-skylib-{tag}.tar.gz".format(tag = bazel_skylib_tag), - "https://github.com/bazelbuild/bazel-skylib/releases/download/{tag}/bazel-skylib-{tag}.tar.gz".format(tag = bazel_skylib_tag), - ], -) - -protobuf_tag = "3.10.1" -protobuf_sha256 = "678d91d8a939a1ef9cb268e1f20c14cd55e40361dc397bb5881e4e1e532679b1" -http_archive( - name = "com_google_protobuf", - sha256 = protobuf_sha256, - strip_prefix = "protobuf-{}".format(protobuf_tag), - type = "zip", - url = "https://github.com/protocolbuffers/protobuf/archive/v{}.zip".format(protobuf_tag), -) - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -protobuf_deps() - -# Specify the scala compiler we wish to use; in this case, we'll use the default one specified in rules_scala_annex -bind( - name = "default_scala", - actual = "@rules_scala_annex//src/main/scala:annex_zinc_2_13", -) ``` BUILD @@ -126,8 +132,8 @@ BUILD load("@rules_scala_annex//rules:scala.bzl", "scala_library") scala_library( - name = "example", - srcs = glob(["**/*.scala"]) + name = "example", + srcs = glob(["*.scala"]) ) ```