diff --git a/.bazelrc_shared b/.bazelrc_shared index c0df5d822..6edd7c17d 100644 --- a/.bazelrc_shared +++ b/.bazelrc_shared @@ -41,3 +41,4 @@ test --test_output=all common:rules --disk_cache=.bazel_cache common:tests --disk_cache=../.bazel_cache +common:tests --@rules_scala_annex//rules/scala:scala-toolchain=test_zinc_2_13 diff --git a/BUILD b/BUILD index 249327e92..9dbcdf5eb 100644 --- a/BUILD +++ b/BUILD @@ -1,9 +1,9 @@ -load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") load( "@rules_java//toolchains:default_java_toolchain.bzl", "DEFAULT_TOOLCHAIN_CONFIGURATION", "default_java_toolchain", ) +load("//rules/scalafmt:register_toolchain.bzl", "register_scalafmt_toolchain") default_java_toolchain( name = "repository_default_toolchain_21", @@ -14,11 +14,7 @@ default_java_toolchain( target_version = "21", ) -buildifier( - name = "buildifier", -) - -buildifier( - name = "buildifier_check", - mode = "check", +register_scalafmt_toolchain( + name = "annex_scalafmt", + config = ".scalafmt.conf", ) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99e97e958..8be9f7a08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,27 +21,32 @@ $ ./scripts/format.sh ## Maven deps -[rules_jvm_external](https://github.com/bazel-contrib/rules_jvm_external) is used to generate maven deps. If you need to change -dependencies, modify `maven_install` in the following different `workspace.bzl` files +[rules_jvm_external](https://github.com/bazel-contrib/rules_jvm_external) is used to resolve Maven +dependencies. If you need to change dependencies, add your artifacts to the `annex*.install` calls +in [`MODULE.bazel`](MODULE.bazel) or [`tests/MODULE.bazel`](tests/MODULE.bazel). -``` -rules/scala/workspace.bzl -rules/scala_proto/workspace.bzl -rules/scalafmt/workspace.bzl -tests/workspace.bzl -``` -To reference the dependency, use the `name` attribute of the `maven_install` rule as the repository name and the versionless dependency as the target. E.g. `@//:`. +To reference the dependency, use the `name` attribute of the `annex*.install` call as the +repository name and the versionless dependency as the target. E.g. +`@//:`. -For example, if you'd like to add `org.scala-sbt:compiler-interface:1.2.1` as a dependency, simply add it to the `artifacts` list in `maven_install` with the attribute `name = "annex"`, and then refer to it with `@annex//:org_scala_sbt_compiler_interface`. +For example, if you'd like to add `org.scala-sbt:compiler-interface:1.2.1` as a dependency, simply +add it to the `artifacts` list of the `maven.install` call, and then refer to it with +`@annex//:org_scala_sbt_compiler_interface`. -``` -maven_install( +```starlark +annex.install( name = "annex", artifacts = [ + ..., "org.scala-sbt:compiler-interface:1.2.1", + ..., ], + fetch_sources = True, + lock_file = "//:annex_install.json", repositories = [ "https://repo.maven.apache.org/maven2", + "https://maven-central.storage-download.googleapis.com/maven2", + "https://mirror.bazel.build/repo1.maven.org/maven2", ], ) ``` diff --git a/MODULE.bazel b/MODULE.bazel index 00bb18361..c5e0cb679 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,147 @@ -############################################################################### -# Bazel now uses Bzlmod by default to manage external dependencies. -# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. -# -# For more details, please check https://github.com/bazelbuild/bazel/issues/18958 -############################################################################### +module(name = "rules_scala_annex") + +bazel_dep(name = "bazel_skylib", version = "1.7.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", dev_dependency = True) +bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True) + +register_toolchains( + "//:annex_scalafmt", + "//:repository_default_toolchain_21_definition", + "//rules/scala_proto:scalapb_scala_proto_toolchain", + "//src/main/scala:annex_bootstrap_2_13", + "//src/main/scala:annex_bootstrap_3", + "//src/main/scala:annex_zinc_2_13", + "//src/main/scala:annex_zinc_3", +) + +# Please ensure these stay up-to-date with the versions in `/rules/scala/versions.bzl`, +# `/tests/MODULE.bazel`, and `/MODULE.bazel`. Unfortunately, `MODULE.bazel` files can't call `load`, +# so we have to copy them here. +scala_2_12_version = "2.12.19" + +scala_2_13_version = "2.13.15" + +scala_3_version = "3.5.2" + +scalapb_version = "0.11.17" + +zinc_version = "1.10.4" + +annex = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +annex.install( + name = "annex", + artifacts = [ + "ch.epfl.scala:bloop-frontend_2.12:1.0.0", + "com.thesamet.scalapb:lenses_2.13:{}".format(scalapb_version), + "com.thesamet.scalapb:scalapb-runtime_2.13:{}".format(scalapb_version), + "net.sourceforge.argparse4j:argparse4j:0.8.1", + "org.jacoco:org.jacoco.core:0.7.5.201505241946", + "org.scala-lang:scala-compiler:{}".format(scala_2_13_version), + "org.scala-lang:scala-library:{}".format(scala_2_13_version), + "org.scala-lang:scala-reflect:{}".format(scala_2_13_version), + "org.scala-lang:scala3-compiler_3:{}".format(scala_3_version), + "org.scala-lang:scala3-library_3:{}".format(scala_3_version), + "org.scala-sbt:compiler-interface:{}".format(zinc_version), + "org.scala-sbt:io_2.13:1.10.1", + "org.scala-sbt:test-interface:1.0", + "org.scala-sbt:util-interface:{}".format(zinc_version), + "org.scala-sbt:util-logging_2.13:{}".format(zinc_version), + "org.scala-sbt:zinc_2.13:{}".format(zinc_version), + "org.scala-sbt:zinc-apiinfo_2.13:{}".format(zinc_version), + "org.scala-sbt:zinc-classpath_2.13:{}".format(zinc_version), + "org.scala-sbt:zinc-compile-core_2.13:{}".format(zinc_version), + "org.scala-sbt:zinc-core_2.13:{}".format(zinc_version), + "org.scala-sbt:zinc-persist_2.13:{}".format(zinc_version), + ], + fetch_sources = True, + lock_file = "//:annex_install.json", + repositories = [ + "https://repo.maven.apache.org/maven2", + "https://maven-central.storage-download.googleapis.com/maven2", + "https://mirror.bazel.build/repo1.maven.org/maven2", + ], +) + +# The compiler bridge has a dependency on compiler-interface, which has a dependency on the Scala 2 +# library. We need to set this to neverlink = True to avoid this the Scala 2 library being pulled +# onto the Scala 3, and other Scala versions like 2.12, compiler classpath during runtime. +annex.artifact( + name = "annex", + artifact = "scala3-sbt-bridge", + group = "org.scala-lang", + neverlink = True, + version = scala_3_version, +) + +# The compiler bridge has a dependency on compiler-interface, which has a dependency on the Scala 2 +# library. We need to set this to neverlink = True to avoid this the Scala 2 library being pulled +# onto the Scala 3, and other Scala versions like 2.12, compiler classpath during runtime. +annex.artifact( + name = "annex", + artifact = "compiler-bridge_2.13", + group = "org.scala-sbt", + neverlink = True, + version = zinc_version, +) +use_repo(annex, "annex") + +annex_scalafmt = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +annex_scalafmt.install( + name = "annex_scalafmt", + artifacts = [ + "org.scalameta:parsers_2.13:4.9.7", + "org.scalameta:metaconfig-core_2.13:0.13.0", + "org.scalameta:scalafmt-core_2.13:3.8.2", + ], + fetch_sources = True, + lock_file = "//:annex_scalafmt_install.json", + repositories = [ + "https://repo.maven.apache.org/maven2", + "https://maven-central.storage-download.googleapis.com/maven2", + "https://mirror.bazel.build/repo1.maven.org/maven2", + ], +) +use_repo(annex_scalafmt, "annex_scalafmt") + +annex_proto = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +annex_proto.install( + name = "annex_proto", + artifacts = [ + "com.github.os72:protoc-jar:3.11.4", + "com.thesamet.scalapb:compilerplugin_2.13:0.11.17", + "com.thesamet.scalapb:protoc-bridge_2.13:0.9.7", + ], + fetch_sources = True, + lock_file = "//:annex_proto_install.json", + repositories = [ + "https://repo.maven.apache.org/maven2", + "https://maven-central.storage-download.googleapis.com/maven2", + "https://mirror.bazel.build/repo1.maven.org/maven2", + ], +) +use_repo(annex_proto, "annex_proto") + +java_launcher_version = "7.4.1" + +java_launcher_template_sha = "ee4aa47ae5e639632c67be5cc0ccbc4e941a67a1b884a1ce0c4329357a4b62b2" + +java_stub_template_url = ( + "raw.githubusercontent.com/bazelbuild/bazel/" + + java_launcher_version + + "/src/main/java/com/google/devtools/build/lib/bazel/rules/java/" + + "java_stub_template.txt" +) + +http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") + +http_file( + name = "anx_java_stub_template", + sha256 = java_launcher_template_sha, + urls = ["https://%s" % java_stub_template_url], +) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index d62a47c0f..ca31a6db1 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -4,54 +4,95 @@ "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", + "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/source.json": "035b6f1911e17340db722bbc9158f830ee6d5dedba4cb3bcb9e25e590808a32c", "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", + "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/source.json": "4b0f9407970b57adb203bd6c23d6361cbcc8ab3273456ad06ca75675b1648b41", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", + "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", - "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/source.json": "082ed5f9837901fada8c68c2f3ddc958bb22b6d654f71dd73f3df30d45d4b749", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", + "https://bcr.bazel.build/modules/buildifier_prebuilt/7.3.1/MODULE.bazel": "537faf0ad9f5892910074b8e43b4c91c96f1d5d86b6ed04bdbe40cf68aa48b68", + "https://bcr.bazel.build/modules/buildifier_prebuilt/7.3.1/source.json": "55153a5e6ca9c8a7e266c4b46b951e8a010d25ec6062bc35d5d4f89925796bad", "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", - "https://bcr.bazel.build/modules/googletest/1.11.0/source.json": "c73d9ef4268c91bd0c1cd88f1f9dfa08e814b1dbe89b5f594a9f08ba0244d206", + "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", + "https://bcr.bazel.build/modules/googletest/1.14.0/source.json": "2478949479000fdd7de9a3d0107ba2c85bb5f961c3ecb1aa448f52549ce310b5", + "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", + "https://bcr.bazel.build/modules/platforms/0.0.10/source.json": "f22828ff4cf021a6b577f1bf6341cb9dcd7965092a439f64fc1bb3b7a5ae4bd5", "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", - "https://bcr.bazel.build/modules/platforms/0.0.9/source.json": "cd74d854bf16a9e002fb2ca7b1a421f4403cda29f824a765acd3a8c56f8d43e6", "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", "https://bcr.bazel.build/modules/protobuf/21.7/source.json": "bbe500720421e582ff2d18b0802464205138c06056f443184de39fbb8187b09b", "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", + "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8", + "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e", "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/source.json": "90310b16e0e7df0cf40f8d1dccd7d373360f42419a6bfbbf5bb013182dd70e84", "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/source.json": "1f1ba6fea244b616de4a554a0f4983c91a9301640c8fe0dd1d410254115c8430", "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39", + "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6", + "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6", + "https://bcr.bazel.build/modules/rules_java/7.12.2/source.json": "b0890f9cda8ff1b8e691a3ac6037b5c14b7fd4134765a3946b89f31ea02e5884", + "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", + "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", "https://bcr.bazel.build/modules/rules_java/7.6.5/MODULE.bazel": "481164be5e02e4cab6e77a36927683263be56b7e36fef918b458d7a8a1ebadb1", - "https://bcr.bazel.build/modules/rules_java/7.6.5/source.json": "a805b889531d1690e3c72a7a7e47a870d00323186a9904b36af83aa3d053ee8d", "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", + "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", + "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d", + "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4", + "https://bcr.bazel.build/modules/rules_jvm_external/6.5/MODULE.bazel": "54f3e81ae9b57ede5916c9a48add664dc30a5ce3855376b51ae7d6f23405daf8", + "https://bcr.bazel.build/modules/rules_jvm_external/6.5/source.json": "5b8bed439771269d9c0af57cf4326cbfd2462e49ebb11230499aaa11fe70f3db", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5", "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", - "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a", "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/source.json": "17a2e195f56cb28d6bbf763e49973d13890487c6945311ed141e196fb660426d", "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", - "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", + "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", + "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58", + "https://bcr.bazel.build/modules/rules_python/0.31.0/source.json": "a41c836d4065888eef4377f2f27b6eea0fedb9b5adb1bab1970437373fe90dc7", "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", - "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", + "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", + "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef", + "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", + "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", + "https://bcr.bazel.build/modules/stardoc/0.7.1/source.json": "b6500ffcd7b48cd72c29bb67bcac781e12701cc0d6d55d266a652583cfcdab01", "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/source.json": "f1ef7d3f9e0e26d4b23d1c39b5f5de71f584dd7d1b4ef83d9bbba6ec7a6a6459", "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", @@ -89,10 +130,160 @@ ] } }, + "@@buildifier_prebuilt~//:defs.bzl%buildifier_prebuilt_deps_extension": { + "general": { + "bzlTransitiveDigest": "lqH5eQXGrxGyrPzoegk5Mn6zC3A1P0h+QsA1O/QlXHc=", + "usagesDigest": "yt+GfSH6jiwv+nPT5fzdhb/zB+8RgR4U+dna3WGxrzU=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "buildifier_darwin_amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildifier-darwin-amd64" + ], + "downloaded_file_path": "buildifier", + "executable": true, + "sha256": "375f823103d01620aaec20a0c29c6cbca99f4fd0725ae30b93655c6704f44d71" + } + }, + "buildifier_darwin_arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildifier-darwin-arm64" + ], + "downloaded_file_path": "buildifier", + "executable": true, + "sha256": "5a6afc6ac7a09f5455ba0b89bd99d5ae23b4174dc5dc9d6c0ed5ce8caac3f813" + } + }, + "buildifier_linux_amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildifier-linux-amd64" + ], + "downloaded_file_path": "buildifier", + "executable": true, + "sha256": "5474cc5128a74e806783d54081f581662c4be8ae65022f557e9281ed5dc88009" + } + }, + "buildifier_linux_arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildifier-linux-arm64" + ], + "downloaded_file_path": "buildifier", + "executable": true, + "sha256": "0bf86c4bfffaf4f08eed77bde5b2082e4ae5039a11e2e8b03984c173c34a561c" + } + }, + "buildifier_windows_amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildifier-windows-amd64.exe" + ], + "downloaded_file_path": "buildifier.exe", + "executable": true, + "sha256": "370cd576075ad29930a82f5de132f1a1de4084c784a82514bd4da80c85acf4a8" + } + }, + "buildozer_darwin_amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-darwin-amd64" + ], + "downloaded_file_path": "buildozer", + "executable": true, + "sha256": "854c9583efc166602276802658cef3f224d60898cfaa60630b33d328db3b0de2" + } + }, + "buildozer_darwin_arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-darwin-arm64" + ], + "downloaded_file_path": "buildozer", + "executable": true, + "sha256": "31b1bfe20d7d5444be217af78f94c5c43799cdf847c6ce69794b7bf3319c5364" + } + }, + "buildozer_linux_amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-linux-amd64" + ], + "downloaded_file_path": "buildozer", + "executable": true, + "sha256": "3305e287b3fcc68b9a35fd8515ee617452cd4e018f9e6886b6c7cdbcba8710d4" + } + }, + "buildozer_linux_arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-linux-arm64" + ], + "downloaded_file_path": "buildozer", + "executable": true, + "sha256": "0b5a2a717ac4fc911e1fec8d92af71dbb4fe95b10e5213da0cc3d56cea64a328" + } + }, + "buildozer_windows_amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-windows-amd64.exe" + ], + "downloaded_file_path": "buildozer.exe", + "executable": true, + "sha256": "58d41ce53257c5594c9bc86d769f580909269f68de114297f46284fbb9023dcf" + } + }, + "buildifier_prebuilt_toolchains": { + "bzlFile": "@@buildifier_prebuilt~//:defs.bzl", + "ruleClassName": "_buildifier_toolchain_setup", + "attributes": { + "assets_json": "[{\"arch\":\"amd64\",\"name\":\"buildifier\",\"platform\":\"darwin\",\"sha256\":\"375f823103d01620aaec20a0c29c6cbca99f4fd0725ae30b93655c6704f44d71\",\"version\":\"v7.3.1\"},{\"arch\":\"arm64\",\"name\":\"buildifier\",\"platform\":\"darwin\",\"sha256\":\"5a6afc6ac7a09f5455ba0b89bd99d5ae23b4174dc5dc9d6c0ed5ce8caac3f813\",\"version\":\"v7.3.1\"},{\"arch\":\"amd64\",\"name\":\"buildifier\",\"platform\":\"linux\",\"sha256\":\"5474cc5128a74e806783d54081f581662c4be8ae65022f557e9281ed5dc88009\",\"version\":\"v7.3.1\"},{\"arch\":\"arm64\",\"name\":\"buildifier\",\"platform\":\"linux\",\"sha256\":\"0bf86c4bfffaf4f08eed77bde5b2082e4ae5039a11e2e8b03984c173c34a561c\",\"version\":\"v7.3.1\"},{\"arch\":\"amd64\",\"name\":\"buildifier\",\"platform\":\"windows\",\"sha256\":\"370cd576075ad29930a82f5de132f1a1de4084c784a82514bd4da80c85acf4a8\",\"version\":\"v7.3.1\"},{\"arch\":\"amd64\",\"name\":\"buildozer\",\"platform\":\"darwin\",\"sha256\":\"854c9583efc166602276802658cef3f224d60898cfaa60630b33d328db3b0de2\",\"version\":\"v7.3.1\"},{\"arch\":\"arm64\",\"name\":\"buildozer\",\"platform\":\"darwin\",\"sha256\":\"31b1bfe20d7d5444be217af78f94c5c43799cdf847c6ce69794b7bf3319c5364\",\"version\":\"v7.3.1\"},{\"arch\":\"amd64\",\"name\":\"buildozer\",\"platform\":\"linux\",\"sha256\":\"3305e287b3fcc68b9a35fd8515ee617452cd4e018f9e6886b6c7cdbcba8710d4\",\"version\":\"v7.3.1\"},{\"arch\":\"arm64\",\"name\":\"buildozer\",\"platform\":\"linux\",\"sha256\":\"0b5a2a717ac4fc911e1fec8d92af71dbb4fe95b10e5213da0cc3d56cea64a328\",\"version\":\"v7.3.1\"},{\"arch\":\"amd64\",\"name\":\"buildozer\",\"platform\":\"windows\",\"sha256\":\"58d41ce53257c5594c9bc86d769f580909269f68de114297f46284fbb9023dcf\",\"version\":\"v7.3.1\"}]" + } + } + }, + "recordedRepoMappingEntries": [ + [ + "buildifier_prebuilt~", + "bazel_skylib", + "bazel_skylib~" + ], + [ + "buildifier_prebuilt~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, "@@platforms//host:extension.bzl%host_platform": { "general": { "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", - "usagesDigest": "pCYpDQmqMbmiiPI1p2Kd3VLm5T48rRAht5WdW0X2GlA=", + "usagesDigest": "hgylFkgWSg0ulUwWZzEM1aIftlUnbmw2ynWLdEfHnZc=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -105,6 +296,461 @@ }, "recordedRepoMappingEntries": [] } + }, + "@@rules_kotlin~//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { + "general": { + "bzlTransitiveDigest": "fus14IFJ/1LGWWGKPH/U18VnJCoMjfDt1ckahqCnM0A=", + "usagesDigest": "aJF6fLy82rR95Ff5CZPAqxNoFgOMLMN5ImfBS0nhnkg=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_jetbrains_kotlin_git": { + "bzlFile": "@@rules_kotlin~//src/main/starlark/core/repositories:compiler.bzl", + "ruleClassName": "kotlin_compiler_git_repository", + "attributes": { + "urls": [ + "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" + ], + "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" + } + }, + "com_github_jetbrains_kotlin": { + "bzlFile": "@@rules_kotlin~//src/main/starlark/core/repositories:compiler.bzl", + "ruleClassName": "kotlin_capabilities_repository", + "attributes": { + "git_repository_name": "com_github_jetbrains_kotlin_git", + "compiler_version": "1.9.23" + } + }, + "com_github_google_ksp": { + "bzlFile": "@@rules_kotlin~//src/main/starlark/core/repositories:ksp.bzl", + "ruleClassName": "ksp_compiler_plugin_repository", + "attributes": { + "urls": [ + "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" + ], + "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", + "strip_version": "1.9.23-1.0.20" + } + }, + "com_github_pinterest_ktlint": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", + "urls": [ + "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" + ], + "executable": true + } + }, + "rules_android": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + "strip_prefix": "rules_android-0.1.1", + "urls": [ + "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_kotlin~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_python~//python/extensions:python.bzl%python": { + "general": { + "bzlTransitiveDigest": "8vDKUdCc6qEk2/YsFiPsFO1Jqgl+XPFRklapOxMAbE8=", + "usagesDigest": "abUgYqI1bdv/jc3Xu7C2SbT7mmtxAziRT/kUCFERO+A=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": { + "RULES_PYTHON_BZLMOD_DEBUG": null + }, + "generatedRepoSpecs": { + "python_3_11_aarch64-apple-darwin": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "b042c966920cf8465385ca3522986b12d745151a72c060991088977ca36d3883", + "patches": [], + "platform": "aarch64-apple-darwin", + "python_version": "3.11.7", + "release_filename": "20240107/cpython-3.11.7+20240107-aarch64-apple-darwin-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.11.7+20240107-aarch64-apple-darwin-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_aarch64-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "b102eaf865eb715aa98a8a2ef19037b6cc3ae7dfd4a632802650f29de635aa13", + "patches": [], + "platform": "aarch64-unknown-linux-gnu", + "python_version": "3.11.7", + "release_filename": "20240107/cpython-3.11.7+20240107-aarch64-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.11.7+20240107-aarch64-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_ppc64le-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "b44e1b74afe75c7b19143413632c4386708ae229117f8f950c2094e9681d34c7", + "patches": [], + "platform": "ppc64le-unknown-linux-gnu", + "python_version": "3.11.7", + "release_filename": "20240107/cpython-3.11.7+20240107-ppc64le-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.11.7+20240107-ppc64le-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_s390x-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "49520e3ff494708020f306e30b0964f079170be83e956be4504f850557378a22", + "patches": [], + "platform": "s390x-unknown-linux-gnu", + "python_version": "3.11.7", + "release_filename": "20240107/cpython-3.11.7+20240107-s390x-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.11.7+20240107-s390x-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_x86_64-apple-darwin": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "a0e615eef1fafdc742da0008425a9030b7ea68a4ae4e73ac557ef27b112836d4", + "patches": [], + "platform": "x86_64-apple-darwin", + "python_version": "3.11.7", + "release_filename": "20240107/cpython-3.11.7+20240107-x86_64-apple-darwin-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.11.7+20240107-x86_64-apple-darwin-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_x86_64-pc-windows-msvc": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "67077e6fa918e4f4fd60ba169820b00be7c390c497bf9bc9cab2c255ea8e6f3e", + "patches": [], + "platform": "x86_64-pc-windows-msvc", + "python_version": "3.11.7", + "release_filename": "20240107/cpython-3.11.7+20240107-x86_64-pc-windows-msvc-shared-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.11.7+20240107-x86_64-pc-windows-msvc-shared-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_x86_64-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "4a51ce60007a6facf64e5495f4cf322e311ba9f39a8cd3f3e4c026eae488e140", + "patches": [], + "platform": "x86_64-unknown-linux-gnu", + "python_version": "3.11.7", + "release_filename": "20240107/cpython-3.11.7+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.11.7+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_host": { + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", + "ruleClassName": "host_toolchain", + "attributes": { + "python_version": "3.11.7", + "user_repository_name": "python_3_11", + "platforms": [ + "aarch64-apple-darwin", + "aarch64-unknown-linux-gnu", + "ppc64le-unknown-linux-gnu", + "s390x-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "x86_64-unknown-linux-gnu" + ] + } + }, + "python_3_11": { + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", + "ruleClassName": "toolchain_aliases", + "attributes": { + "python_version": "3.11.7", + "user_repository_name": "python_3_11", + "platforms": [ + "aarch64-apple-darwin", + "aarch64-unknown-linux-gnu", + "ppc64le-unknown-linux-gnu", + "s390x-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "x86_64-unknown-linux-gnu" + ] + } + }, + "pythons_hub": { + "bzlFile": "@@rules_python~//python/private/bzlmod:pythons_hub.bzl", + "ruleClassName": "hub_repo", + "attributes": { + "default_python_version": "3.11", + "toolchain_prefixes": [ + "_0000_python_3_11_" + ], + "toolchain_python_versions": [ + "3.11" + ], + "toolchain_set_python_version_constraints": [ + "False" + ], + "toolchain_user_repository_names": [ + "python_3_11" + ] + } + }, + "python_versions": { + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", + "ruleClassName": "multi_toolchain_aliases", + "attributes": { + "python_versions": { + "3.11": "python_3_11" + } + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~", + "bazel_skylib", + "bazel_skylib~" + ], + [ + "rules_python~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_python~//python/private/bzlmod:internal_deps.bzl%internal_deps": { + "general": { + "bzlTransitiveDigest": "7yogJIhmw7i9Wq/n9sQB8N0F84220dJbw64SjOwrmQk=", + "usagesDigest": "r7vtlnQfWxEwrL+QFXux06yzeWEkq/hrcwAssoCoSLY=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "rules_python_internal": { + "bzlFile": "@@rules_python~//python/private:internal_config_repo.bzl", + "ruleClassName": "internal_config_repo", + "attributes": {} + }, + "pypi__build": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/58/91/17b00d5fac63d3dca605f1b8269ba3c65e98059e1fd99d00283e42a454f0/build-0.10.0-py3-none-any.whl", + "sha256": "af266720050a66c893a6096a2f410989eeac74ff9a68ba194b3f6473e8e26171", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__click": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/00/2e/d53fa4befbf2cfa713304affc7ca780ce4fc1fd8710527771b58311a3229/click-8.1.7-py3-none-any.whl", + "sha256": "ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__colorama": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", + "sha256": "4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__importlib_metadata": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/cc/37/db7ba97e676af155f5fcb1a35466f446eadc9104e25b83366e8088c9c926/importlib_metadata-6.8.0-py3-none-any.whl", + "sha256": "3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__installer": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/e5/ca/1172b6638d52f2d6caa2dd262ec4c811ba59eee96d54a7701930726bce18/installer-0.7.0-py3-none-any.whl", + "sha256": "05d1933f0a5ba7d8d6296bb6d5018e7c94fa473ceb10cf198a92ccea19c27b53", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__more_itertools": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/5a/cb/6dce742ea14e47d6f565589e859ad225f2a5de576d7696e0623b784e226b/more_itertools-10.1.0-py3-none-any.whl", + "sha256": "64e0735fcfdc6f3464ea133afe8ea4483b1c5fe3a3d69852e6503b43a0b222e6", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__packaging": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/ab/c3/57f0601a2d4fe15de7a553c00adbc901425661bf048f2a22dfc500caf121/packaging-23.1-py3-none-any.whl", + "sha256": "994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__pep517": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/ee/2f/ef63e64e9429111e73d3d6cbee80591672d16f2725e648ebc52096f3d323/pep517-0.13.0-py3-none-any.whl", + "sha256": "4ba4446d80aed5b5eac6509ade100bff3e7943a8489de249654a5ae9b33ee35b", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__pip": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/50/c2/e06851e8cc28dcad7c155f4753da8833ac06a5c704c109313b8d5a62968a/pip-23.2.1-py3-none-any.whl", + "sha256": "7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__pip_tools": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/e8/df/47e6267c6b5cdae867adbdd84b437393e6202ce4322de0a5e0b92960e1d6/pip_tools-7.3.0-py3-none-any.whl", + "sha256": "8717693288720a8c6ebd07149c93ab0be1fced0b5191df9e9decd3263e20d85e", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__pyproject_hooks": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/d5/ea/9ae603de7fbb3df820b23a70f6aff92bf8c7770043254ad8d2dc9d6bcba4/pyproject_hooks-1.0.0-py3-none-any.whl", + "sha256": "283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__setuptools": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/4f/ab/0bcfebdfc3bfa8554b2b2c97a555569c4c1ebc74ea288741ea8326c51906/setuptools-68.1.2-py3-none-any.whl", + "sha256": "3d8083eed2d13afc9426f227b24fd1659489ec107c0e86cec2ffdde5c92e790b", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__tomli": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/97/75/10a9ebee3fd790d20926a90a2547f0bf78f371b2f13aa822c759680ca7b9/tomli-2.0.1-py3-none-any.whl", + "sha256": "939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__wheel": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl", + "sha256": "75909db2664838d015e3d9139004ee16711748a52c8f336b52882266540215d8", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + }, + "pypi__zipp": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://files.pythonhosted.org/packages/8c/08/d3006317aefe25ea79d3b76c9650afabaf6d63d1c8443b236e7405447503/zipp-3.16.2-py3-none-any.whl", + "sha256": "679e51dd4403591b2d6838a48de3d283f3d188412a9782faadf845f298736ba0", + "type": "zip", + "build_file_content": "package(default_visibility = [\"//visibility:public\"])\n\nload(\"@rules_python//python:defs.bzl\", \"py_library\")\n\npy_library(\n name = \"lib\",\n srcs = glob([\"**/*.py\"]),\n data = glob([\"**/*\"], exclude=[\n # These entries include those put into user-installed dependencies by\n # data_exclude in /python/pip_install/tools/bazel.py\n # to avoid non-determinism following pip install's behavior.\n \"**/*.py\",\n \"**/*.pyc\",\n \"**/*.pyc.*\", # During pyc creation, temp files named *.pyc.NNN are created\n \"**/* *\",\n \"**/*.dist-info/RECORD\",\n \"BUILD\",\n \"WORKSPACE\",\n ]),\n # This makes this directory a top-level in the python import\n # search path for anything that depends on this.\n imports = [\".\"],\n)\n" + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~", + "bazel_tools", + "bazel_tools" + ] + ] + } } } } diff --git a/README.md b/README.md index 03eb148c2..201624be5 100644 --- a/README.md +++ b/README.md @@ -54,81 +54,29 @@ straightforward. ## Usage -WORKSPACE +`lucidsoftware/rules_scala` isn't on the [Bazel Central Registry](https://registry.bazel.build/), so +you'll need to pull it in via `archive_override`. Be sure to replace `` with the +latest commit on `lucid-master` and `` with the hash suggested by Bazel after the +dependency is first loaded. -```python -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +MODULE.bazel -# 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", -) +```starlark +bazel_dep(name = "rules_scala_annex") -# Load rules_scala_annex -rules_scala_annex_version = "lucid_2024-11-18" +rules_scala_annex_version = "" -http_archive( - name = "rules_scala_annex", - integrity = "sha256-WjZvojiclkiyVxQ1NqkH1lDeGaDLyzQOGiDsCfhVAec=", +archive_override( + module_name = "rules_scala_annex", + integrity = "", strip_prefix = "rules_scala-{}".format(rules_scala_annex_version), - type = "zip", - url = "https://github.com/lucidsoftware/rules_scala/archive/{}.zip".format(rules_scala_annex_version), -) - -rules_jvm_external_version = "6.1" - -http_archive( - name = "rules_jvm_external", - 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", + urls = ["https://github.com/lucidsoftware/rules_scala/archive/refs/heads/{}.zip".format(rules_scala_annex_version)], ) - -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") -scalafmt_repositories() - -load("@annex_scalafmt//:defs.bzl", annex_scalafmt_pinned_maven_install = "pinned_maven_install") - -annex_scalafmt_pinned_maven_install() -scalafmt_default_config() -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() ``` BUILD -```python +```starlark load("@rules_scala_annex//rules:scala.bzl", "scala_library") scala_library( diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index beab4a0de..000000000 --- a/WORKSPACE +++ /dev/null @@ -1,251 +0,0 @@ -workspace(name = "rules_scala_annex") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# rules_license -rules_license_tag = "1.0.0" - -http_archive( - name = "rules_license", - sha256 = "26d4021f6898e23b82ef953078389dd49ac2b5618ac564ade4ef87cced147b38", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/{tag}/rules_license-{tag}.tar.gz".format(tag = rules_license_tag), - "https://github.com/bazelbuild/rules_license/releases/download/{tag}/rules_license-{tag}.tar.gz".format(tag = rules_license_tag), - ], -) - -# skylib - -bazel_skylib_tag = "1.7.1" - -bazel_skylib_sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f" - -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), - ], -) - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() - -# rules_java -http_archive( - name = "rules_java", - sha256 = "a9690bc00c538246880d5c83c233e4deb83fe885f54c21bb445eb8116a180b83", - urls = [ - "https://github.com/bazelbuild/rules_java/releases/download/7.12.2/rules_java-7.12.2.tar.gz", - ], -) - -load("@rules_java//java:repositories.bzl", "rules_java_dependencies") - -rules_java_dependencies() - -register_toolchains("//:repository_default_toolchain_21_definition") - -# com_github_bazelbuild_buildtools - -buildtools_tag = "7.3.1" - -buildtools_sha256 = "118602587d5804c720c1617db30f56c93ec7a2bdda5e915125fccf7421e78412" - -http_archive( - name = "com_github_bazelbuild_buildtools", - sha256 = buildtools_sha256, - strip_prefix = "buildtools-{}".format(buildtools_tag), - url = "https://github.com/bazelbuild/buildtools/archive/v{}.zip".format(buildtools_tag), -) - -load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies") - -buildifier_dependencies() - -# rules_cc - -http_archive( - name = "rules_cc", - sha256 = "bbf1ae2f83305b7053b11e4467d317a7ba3517a12cef608543c1b1c5bf48a4df", - strip_prefix = "rules_cc-0.0.16", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"], -) - -# rules_jvm_external -rules_jvm_external_tag = "6.5" - -http_archive( - name = "rules_jvm_external", - sha256 = "c5b27928eeb8f0761f0805540587660f0ecc6946e9c04bf0d4c89e2f7d332b2b", - 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), -) - -load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") - -rules_jvm_external_deps() - -load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") - -rules_jvm_external_setup() - -# Scala 2_13 and 3 -load("//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_2_13") - -# Scala 2.12 - -load("//rules/scala:workspace_2_12.bzl", "scala_2_12_repositories") - -scala_2_12_repositories() - -load("@annex_2_12//:defs.bzl", annex_2_12_pinned_maven_install = "pinned_maven_install") - -annex_2_12_pinned_maven_install() - -# Scala fmt - -load("//rules/scalafmt:workspace.bzl", "scalafmt_default_config", "scalafmt_repositories") - -scalafmt_repositories() - -load("@annex_scalafmt//:defs.bzl", annex_scalafmt_pinned_maven_install = "pinned_maven_install") - -annex_scalafmt_pinned_maven_install() - -scalafmt_default_config(".scalafmt.conf") - -# Scala proto - -load( - "//rules/scala_proto:workspace.bzl", - "scala_proto_register_toolchains", - "scala_proto_repositories", -) - -scala_proto_repositories() - -scala_proto_register_toolchains() - -load("@annex_proto//:defs.bzl", annex_proto_pinned_maven_install = "pinned_maven_install") - -annex_proto_pinned_maven_install() - -# protobuf - -protobuf_tag = "28.3" - -protobuf_sha256 = "5b2ff0f72e85dc1350b7bb1b4ea94d7e92e297f7a58b630e46fa6b430b5b253b" - -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() - -# rules_proto - -http_archive( - name = "rules_proto", - sha256 = "0e5c64a2599a6e26c6a03d6162242d231ecc0de219534c38cb4402171def21e8", - strip_prefix = "rules_proto-7.0.2", - url = "https://github.com/bazelbuild/rules_proto/releases/download/7.0.2/rules_proto-7.0.2.tar.gz", -) - -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") - -rules_proto_dependencies() - -load("@rules_proto//proto:setup.bzl", "rules_proto_setup") - -rules_proto_setup() - -# rules_go - -rules_go_tag = "v0.43.0" - -rules_go_sha256 = "d6ab6b57e48c09523e93050f13698f708428cfd5e619252e369d377af6597707" - -http_archive( - name = "io_bazel_rules_go", - sha256 = rules_go_sha256, - urls = [ - "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/{tag}/rules_go-{tag}.zip".format(tag = rules_go_tag), - "https://github.com/bazelbuild/rules_go/releases/download/{tag}/rules_go-{tag}.zip".format(tag = rules_go_tag), - ], -) - -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") - -go_rules_dependencies() - -go_register_toolchains(version = "1.17") - -# Stardoc - -http_archive( - name = "io_bazel_stardoc", - sha256 = "fabb280f6c92a3b55eed89a918ca91e39fb733373c81e87a18ae9e33e75023ec", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.7.1/stardoc-0.7.1.tar.gz", - "https://github.com/bazelbuild/stardoc/releases/download/0.7.1/stardoc-0.7.1.tar.gz", - ], -) - -load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") - -stardoc_repositories() - -load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps") - -stardoc_external_deps() - -load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install") - -stardoc_pinned_maven_install() - -# rules_pkg - -rules_pkg_version = "1.0.1" - -http_archive( - name = "rules_pkg", - sha256 = "d20c951960ed77cb7b341c2a59488534e494d5ad1d30c4818c736d57772a9fef", - urls = [ - "https://github.com/bazelbuild/rules_pkg/releases/download/{v}/rules_pkg-{v}.tar.gz".format(v = rules_pkg_version), - ], -) - -load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") - -rules_pkg_dependencies() - -# rules_python - this is needed by rules_jvm_external for some reason -rules_python_tag = "0.36.0" - -http_archive( - name = "rules_python", - sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913", - strip_prefix = "rules_python-{}".format(rules_python_tag), - url = "https://github.com/bazelbuild/rules_python/releases/download/{}/rules_python-{}.tar.gz".format(rules_python_tag, rules_python_tag), -) - -load("@rules_python//python:repositories.bzl", "py_repositories") - -py_repositories() diff --git a/dev/BUILD b/dev/BUILD new file mode 100644 index 000000000..380f014b3 --- /dev/null +++ b/dev/BUILD @@ -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 b/dev/stardoc/BUILD new file mode 100644 index 000000000..c476c3b9d --- /dev/null +++ b/dev/stardoc/BUILD @@ -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", +) diff --git a/rules/stardoc.bzl b/dev/stardoc/stardoc.bzl similarity index 58% rename from rules/stardoc.bzl rename to dev/stardoc/stardoc.bzl index a66109d31..6fb358bb7 100644 --- a/rules/stardoc.bzl +++ b/dev/stardoc/stardoc.bzl @@ -1,22 +1,18 @@ load("@bazel_skylib//lib:paths.bzl", "paths") _bzl_files_containing_rules = [ - "rules_scala.bzl", - "scala.bzl", - "scala_proto.bzl", - "scala_with_scalafmt.bzl", - "scalafmt.bzl", - "//rules/scala:workspace_2_12.bzl", - "//rules/scala:workspace.bzl", - "//rules/scala_proto:workspace.bzl", - "//rules/scalafmt:workspace.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( diff --git a/docs/newdocs/phases.md b/docs/newdocs/phases.md index 7e815253c..33f9e2069 100644 --- a/docs/newdocs/phases.md +++ b/docs/newdocs/phases.md @@ -3,7 +3,7 @@ Most rules in `lucidsoftware/rules_scala` are architected using phases. Phases break down the Bazel Analysis stage into logical chunks. For example, the implementation of `scala_binary` is: -```python +```starlark def _scala_binary_implementation(ctx): return _run_phases(ctx, [ ("resources", _phase_resources), diff --git a/docs/newdocs/scala_versions.md b/docs/newdocs/scala_versions.md index 90fafd637..0d61748fc 100644 --- a/docs/newdocs/scala_versions.md +++ b/docs/newdocs/scala_versions.md @@ -19,45 +19,40 @@ unused/undeclared dependency checking and test code coverage checking) via the repository is mapped to `rules_scala_annex`: */BUILD.bazel* -```python + +```starlark load( "@rules_scala_annex//rules/register_toolchain.bzl", "register_bootstrap_toolchain", "register_zinc_toolchain", ) + +# You'll need to pull these in via `rules_jvm_external`. Note that `@maven` should be replaced with +# the name of your dependency tree, as specified in the `name` attribute of `maven.install` or +# `maven.artifact`. compiler_classpath_2_13 = [ - "@scala_compiler_2_13//jar", - "@scala_library_2_13//jar", - "@scala_reflect_2_13//jar", + "@maven//:org_scala_lang_scala_compiler", + "@maven//:org_scala_lang_scala_library", + "@maven//:org_scala_lang_scala_reflect", ] -runtime_classpath_2_13 = ["@scala_library_2_13//jar"] +# You'll need to pull thus in via `rules_jvm_external` +runtime_classpath_2_13 = ["@maven//:org_scala_lang_scala_library",] register_bootstrap_toolchain( - name = "annex_bootstrap_2_13", + name = "bootstrap_2_13", compiler_classpath = compiler_classpath_2_13, runtime_classpath = runtime_classpath_2_13, version = "2.13.14", visibility = ["//visibility:public"], ) -# compiler bridge needed to configure zinc compiler -scala_library( - name = "compiler_bridge_2_13", - srcs = ["@compiler_bridge_2_13//:src"], - scala_toolchain_name = "annex_bootstrap_2_13", - visibility = ["//visibility:public"], - deps = compiler_classpath_2_13 + [ - "@scala_annex_org_scala_sbt_compiler_interface//jar", - "@scala_annex_org_scala_sbt_util_interface//jar", - ], -) - # This augments the configuration to configure the zinc compiler register_zinc_toolchain( - name = "annex_zinc_2_13", - compiler_bridge = ":compiler_bridge_2_13", + name = "zinc_2_13", + # You'll need to pull this in via `rules_jvm_external` + compiler_bridge = "@maven//:org_scala_sbt_compiler_bridge_2_13", compiler_classpath = compiler_classpath_2_13, runtime_classpath = runtime_classpath_2_13, version = "2.13.14", @@ -65,18 +60,19 @@ register_zinc_toolchain( ) ``` -*/WORKSPACE* -```python -load("@rules_scala_annex//rules/scala:workspace.bzl", "scala_register_toolchains") - -... +*/MODULE.bazel* -scala_register_toolchains( - toolchains = ["//:annex_bootstrap_2_13", "//:annex_zinc_2_13"], - default_scala_toolchain_name = "annex_zinc_2_13", +```starlark +register_toolchains( + "//:bootstrap_2_13", + "//:zinc_2_13", ) +``` -... +*/.bazelrc* + +``` +common --@rules_scala_annex//rules/scala:scala-toolchain=zinc_2_13 ``` Take note of the `scala_toolchain_name` attribute on `scala_library` and the other Scala rules. Each @@ -86,22 +82,22 @@ attribute. For example: -```python +```starlark scala_library( - name = "example_compiled_with_scalac", - srcs = glob(["**/*.scala"]) - scala_toolchain_name = "annex_bootstrap_2_13", + name = "example_compiled_with_scalac", + srcs = glob(["**/*.scala"]) + scala_toolchain_name = "bootstrap_2_13", ) scala_library( - name = "example_compiled_with_zinc", - srcs = glob(["**/*.scala"]) - scala_toolchain_name = "annex_zinc_2_13", + name = "example_compiled_with_zinc", + srcs = glob(["**/*.scala"]) + scala_toolchain_name = "zinc_2_13", ) # This would use the default toolchain, which we configured via `scala_register_toolchains` above scala_library( - name = "example_compiled_with_default_scala", - srcs = glob(["**/*.scala"]) + name = "example_compiled_with_default_scala", + srcs = glob(["**/*.scala"]) ) ``` diff --git a/docs/scalafmt.md b/docs/scalafmt.md index b41cc23cf..a3170729b 100644 --- a/docs/scalafmt.md +++ b/docs/scalafmt.md @@ -1,16 +1,60 @@ # Scalafmt -Create .scalafmt.conf at the repo root (may be empty). And add to the WORKSPACE +`lucidsoftware/rules_scala` contains copies of the default Scala rules with formatting capabilities, +powered by Scalafmt. See [the Stardoc on these rules](./stardoc/scala_with_scalafmt.md) for more +information. -```python -load("@rules_scala_annex//rules/scalafmt:workspace.bzl", "scalafmt_repositories", "scalafmt_default_config") -scalafmt_repositories() -scalafmt_default_config() +[Toolchains](https://bazel.build/extending/toolchains) are used to set the Scalafmt +configuration file that's used by those targets that have formatting enabled. The default toolchain +uses the [`.scalafmt.conf`](../.scalafmt.conf) file at the root of this repository—the same +configuration file that's used to format this repository's code. All you need to do to use the +formatting rules is register the default toolchain with Bazel in your `MODULE.bazel` file: + +```starlark +register_toolchains("@rules_scala_annex//:annex_scalafmt") +``` + +That should be sufficient to get you started, but if you'd like to use your own `.scalafmt.conf` +file, you'll need to declare your own toolchain and register it with Bazel: + +*/BUILD* + +```starlark +load("@rules_scala_annex//rules/scalafmt:register_toolchain.bzl", "register_scalafmt_toolchain") + +register_scalafmt_toolchain( + name = "custom_scalafmt", + config = ".scalafmt.conf", +) ``` -And in BUILD +*/MODULE.bazel* -```python +```starlark +register_toolchains(":custom_scalafmt") +``` + +Then, you can either: +- Use it for every target by default by adding the + `--@rules_scala_annex//rules/scalafmt:scalafmt-toolchain=custom_scalafmt` flag to your `.bazelrc` + file +- Use it for a specific target by setting the `scalafmt_toolchain_name` attribute: + ```starlark + load("@rules_scala_annex//rules:scala_with_scalafmt.bzl", "scala_binary") + + scala_binary( + ..., + scalafmt_toolchain_name = "custom_scalafmt", + ..., + ) + ``` + +If you'd like to format all of the Scala files in your repository via a single target, you can use +`scala_format_test`: + +*/BUILD* + +```starlark load("@rules_scala_annex//rules:scalafmt.bzl", "scala_format_test") scala_format_test( name = "format", @@ -18,7 +62,7 @@ scala_format_test( ) ``` -Then +Then: ``` # check format, with diffs and non-zero exit in case of differences @@ -27,3 +71,6 @@ $ bazel test :format # format files in-place $ bazel run :format ``` + +Note that like the Scala rules, `scala_format_test` too uses toolchains and accepts a +`scalafmt_toolchain_name` attribute. diff --git a/docs/stardoc/rules_scala.md b/docs/stardoc/rules_scala.md deleted file mode 100644 index 258c3778e..000000000 --- a/docs/stardoc/rules_scala.md +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - -## emulate_rules_scala - -
-load("@//rules:rules_scala.bzl", "emulate_rules_scala")
-
-emulate_rules_scala(scalatest, extra_deps)
-
- - - -**PARAMETERS** - - -| Name | Description | Default Value | -| :------------- | :------------- | :------------- | -| scalatest |

-

| none | -| extra_deps |

-

| `[]` | - - - - -## emulate_rules_scala_repository - -
-load("@//rules:rules_scala.bzl", "emulate_rules_scala_repository")
-
-emulate_rules_scala_repository(name, extra_deps, repo_mapping)
-
- -**ATTRIBUTES** - - -| Name | Description | Type | Mandatory | Default | -| :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| extra_deps | - | List of labels | optional | `[]` | -| repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`).

This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | Dictionary: String -> String | optional | | - - diff --git a/docs/stardoc/scala.md b/docs/stardoc/scala.md index 8882a5aaf..6952f5f98 100644 --- a/docs/stardoc/scala.md +++ b/docs/stardoc/scala.md @@ -7,7 +7,7 @@ ## scala_binary
-load("@//rules:scala.bzl", "scala_binary")
+load("@rules_scala_annex//rules:scala.bzl", "scala_binary")
 
 scala_binary(name, deps, srcs, data, resources, deps_unused_whitelist, deps_used_whitelist,
              javacopts, jvm_flags, main_class, plugins, resource_jars, resource_strip_prefix,
@@ -52,7 +52,7 @@ To run the program: `bazel run `
 ## scala_import
 
 
-load("@//rules:scala.bzl", "scala_import")
+load("@rules_scala_annex//rules:scala.bzl", "scala_import")
 
 scala_import(name, deps, exports, jars, neverlink, runtime_deps, srcjar)
 
@@ -80,7 +80,7 @@ Use this only for libraries with macros. Otherwise, use `java_import`. ## scala_library
-load("@//rules:scala.bzl", "scala_library")
+load("@rules_scala_annex//rules:scala.bzl", "scala_library")
 
 scala_library(name, deps, srcs, data, resources, deps_unused_whitelist, deps_used_whitelist,
               exports, javacopts, macro, neverlink, plugins, resource_jars, resource_strip_prefix,
@@ -118,7 +118,7 @@ Compiles a Scala JVM library.
 ## scala_repl
 
 
-load("@//rules:scala.bzl", "scala_repl")
+load("@rules_scala_annex//rules:scala.bzl", "scala_repl")
 
 scala_repl(name, deps, data, jvm_flags, scala_toolchain_name, scalacopts)
 
@@ -145,7 +145,7 @@ To run: `bazel run ` ## scala_test
-load("@//rules:scala.bzl", "scala_test")
+load("@rules_scala_annex//rules:scala.bzl", "scala_test")
 
 scala_test(name, deps, srcs, data, resources, deps_unused_whitelist, deps_used_whitelist,
            frameworks, isolation, javacopts, jvm_flags, plugins, resource_jars, resource_strip_prefix,
@@ -180,12 +180,12 @@ To build and run a specific test: `bazel test  --test_filter=plugins |  The Scalac plugins.   | List of labels | optional |  `[]`  |
 | resource_jars |  The JARs to merge into the output JAR.   | List of labels | optional |  `[]`  |
 | resource_strip_prefix |  The path prefix to strip from classpath resources.   | String | optional |  `""`  |
-| runner |  -   | Label | optional |  `"@//src/main/scala/higherkindness/rules_scala/workers/zinc/test"`  |
+| runner |  -   | Label | optional |  `"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/workers/zinc/test"`  |
 | runtime_deps |  The JVM runtime-only library dependencies.   | List of labels | optional |  `[]`  |
 | scala_toolchain_name |  The name of the Scala toolchain to use for this target (as provided to `register_*_toolchain`)   | String | optional |  `""`  |
 | scalacopts |  Options to pass to scalac.   | List of strings | optional |  `[]`  |
 | shared_deps |  If isolation is "classloader", the list of deps to keep loaded between tests   | List of labels | optional |  `[]`  |
-| subprocess_runner |  -   | Label | optional |  `"@//src/main/scala/higherkindness/rules_scala/common/sbt-testing:subprocess"`  |
+| subprocess_runner |  -   | Label | optional |  `"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/sbt-testing:subprocess"`  |
 
 
 
@@ -193,7 +193,7 @@ To build and run a specific test: `bazel test  --test_filter=
-load("@//rules:scala.bzl", "scaladoc")
+load("@rules_scala_annex//rules:scala.bzl", "scaladoc")
 
 scaladoc(name, deps, srcs, compiler_deps, scala_toolchain_name, scalacopts, title)
 
@@ -219,7 +219,7 @@ Generates Scaladoc. ## make_scala_binary
-load("@//rules:scala.bzl", "make_scala_binary")
+load("@rules_scala_annex//rules:scala.bzl", "make_scala_binary")
 
 make_scala_binary(extras)
 
@@ -239,7 +239,7 @@ make_scala_binary(extras) ## make_scala_library
-load("@//rules:scala.bzl", "make_scala_library")
+load("@rules_scala_annex//rules:scala.bzl", "make_scala_library")
 
 make_scala_library(extras)
 
@@ -259,7 +259,7 @@ make_scala_library(extras) ## make_scala_test
-load("@//rules:scala.bzl", "make_scala_test")
+load("@rules_scala_annex//rules:scala.bzl", "make_scala_test")
 
 make_scala_test(extras)
 
diff --git a/docs/stardoc/scala_proto.md b/docs/stardoc/scala_proto.md index 8ca36df90..0112a0053 100644 --- a/docs/stardoc/scala_proto.md +++ b/docs/stardoc/scala_proto.md @@ -7,7 +7,7 @@ ## scala_proto_library
-load("@//rules:scala_proto.bzl", "scala_proto_library")
+load("@rules_scala_annex//rules:scala_proto.bzl", "scala_proto_library")
 
 scala_proto_library(name, deps, grpc)
 
@@ -31,7 +31,7 @@ See example use in [/tests/proto/BUILD](/tests/proto/BUILD) ## scala_proto_toolchain
-load("@//rules:scala_proto.bzl", "scala_proto_toolchain")
+load("@rules_scala_annex//rules:scala_proto.bzl", "scala_proto_toolchain")
 
 scala_proto_toolchain(name, compiler, compiler_supports_workers)
 
@@ -43,7 +43,7 @@ This rule should be used with an accompanying `toolchain` that binds it and spec For example: -```python +```starlark scala_proto_toolchain( name = "scalapb_toolchain_example", compiler = ":worker", diff --git a/docs/stardoc/scala_proto_workspace.md b/docs/stardoc/scala_proto_workspace.md deleted file mode 100644 index 3e4977937..000000000 --- a/docs/stardoc/scala_proto_workspace.md +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - -## scala_proto_artifacts - -
-load("@//rules/scala_proto:workspace.bzl", "scala_proto_artifacts")
-
-scala_proto_artifacts()
-
- - - - - - - -## scala_proto_register_toolchains - -
-load("@//rules/scala_proto:workspace.bzl", "scala_proto_register_toolchains")
-
-scala_proto_register_toolchains()
-
- - - - - - - -## scala_proto_repositories - -
-load("@//rules/scala_proto:workspace.bzl", "scala_proto_repositories")
-
-scala_proto_repositories()
-
- - - - - diff --git a/docs/stardoc/scala_with_scalafmt.md b/docs/stardoc/scala_with_scalafmt.md index 36c1e6dd1..0033ed52c 100644 --- a/docs/stardoc/scala_with_scalafmt.md +++ b/docs/stardoc/scala_with_scalafmt.md @@ -19,11 +19,11 @@ formatted. ## scala_binary
-load("@//rules:scala_with_scalafmt.bzl", "scala_binary")
+load("@rules_scala_annex//rules:scala_with_scalafmt.bzl", "scala_binary")
 
-scala_binary(name, deps, srcs, data, resources, config, deps_unused_whitelist, deps_used_whitelist,
-             format, javacopts, jvm_flags, main_class, plugins, resource_jars, resource_strip_prefix,
-             runtime_deps, scala_toolchain_name, scalacopts)
+scala_binary(name, deps, srcs, data, resources, deps_unused_whitelist, deps_used_whitelist, format,
+             javacopts, jvm_flags, main_class, plugins, resource_jars, resource_strip_prefix,
+             runtime_deps, scala_toolchain_name, scalacopts, scalafmt_toolchain_name)
 
Compiles and links a Scala JVM executable. @@ -46,7 +46,6 @@ To run the program: `bazel run ` | srcs | The source Scala and Java files (and `-sources.jar` `.srcjar` `-src.jar` files of those). | List of labels | optional | `[]` | | data | The additional runtime files needed by this library. | List of labels | optional | `[]` | | resources | The files to include as classpath resources. | List of labels | optional | `[]` | -| config | The Scalafmt configuration file. | Label | optional | `"@scalafmt_default//:config"` | | deps_unused_whitelist | The JVM library dependencies to always consider unused for `scala_deps_direct` checks. | List of labels | optional | `[]` | | deps_used_whitelist | The JVM library dependencies to always consider used for `scala_deps_used` checks. | List of labels | optional | `[]` | | format | Whether to format the target. If this is False, the formatter and format tester will do nothing. | Boolean | optional | `True` | @@ -59,6 +58,7 @@ To run the program: `bazel run ` | runtime_deps | The JVM runtime-only library dependencies. | List of labels | optional | `[]` | | scala_toolchain_name | The name of the Scala toolchain to use for this target (as provided to `register_*_toolchain`) | String | optional | `""` | | scalacopts | The Scalac options. | List of strings | optional | `[]` | +| scalafmt_toolchain_name | The name of the Scalafmt configuration toolchain. | String | optional | `""` | @@ -66,11 +66,12 @@ To run the program: `bazel run ` ## scala_library
-load("@//rules:scala_with_scalafmt.bzl", "scala_library")
+load("@rules_scala_annex//rules:scala_with_scalafmt.bzl", "scala_library")
 
-scala_library(name, deps, srcs, data, resources, config, deps_unused_whitelist, deps_used_whitelist,
+scala_library(name, deps, srcs, data, resources, deps_unused_whitelist, deps_used_whitelist,
               exports, format, javacopts, macro, neverlink, plugins, resource_jars,
-              resource_strip_prefix, runtime_deps, scala_toolchain_name, scalacopts)
+              resource_strip_prefix, runtime_deps, scala_toolchain_name, scalacopts,
+              scalafmt_toolchain_name)
 
Compiles a Scala JVM library. @@ -85,7 +86,6 @@ Compiles a Scala JVM library. | srcs | The source Scala and Java files (and `-sources.jar` `.srcjar` `-src.jar` files of those). | List of labels | optional | `[]` | | data | The additional runtime files needed by this library. | List of labels | optional | `[]` | | resources | The files to include as classpath resources. | List of labels | optional | `[]` | -| config | The Scalafmt configuration file. | Label | optional | `"@scalafmt_default//:config"` | | deps_unused_whitelist | The JVM library dependencies to always consider unused for `scala_deps_direct` checks. | List of labels | optional | `[]` | | deps_used_whitelist | The JVM library dependencies to always consider used for `scala_deps_used` checks. | List of labels | optional | `[]` | | exports | The JVM libraries to add as dependencies to any libraries dependent on this one. | List of labels | optional | `[]` | @@ -99,6 +99,7 @@ Compiles a Scala JVM library. | runtime_deps | The JVM runtime-only library dependencies. | List of labels | optional | `[]` | | scala_toolchain_name | The name of the Scala toolchain to use for this target (as provided to `register_*_toolchain`) | String | optional | `""` | | scalacopts | The Scalac options. | List of strings | optional | `[]` | +| scalafmt_toolchain_name | The name of the Scalafmt configuration toolchain. | String | optional | `""` | @@ -106,12 +107,12 @@ Compiles a Scala JVM library. ## scala_test
-load("@//rules:scala_with_scalafmt.bzl", "scala_test")
+load("@rules_scala_annex//rules:scala_with_scalafmt.bzl", "scala_test")
 
-scala_test(name, deps, srcs, data, resources, config, deps_unused_whitelist, deps_used_whitelist,
-           format, frameworks, isolation, javacopts, jvm_flags, plugins, resource_jars,
-           resource_strip_prefix, runner, runtime_deps, scala_toolchain_name, scalacopts, shared_deps,
-           subprocess_runner)
+scala_test(name, deps, srcs, data, resources, deps_unused_whitelist, deps_used_whitelist, format,
+           frameworks, isolation, javacopts, jvm_flags, plugins, resource_jars, resource_strip_prefix,
+           runner, runtime_deps, scala_toolchain_name, scalacopts, scalafmt_toolchain_name,
+           shared_deps, subprocess_runner)
 
Compiles and links a collection of Scala tests. @@ -133,7 +134,6 @@ To build and run a specific test: `bazel test --test_filter=srcs | The source Scala and Java files (and `-sources.jar` `.srcjar` `-src.jar` files of those). | List of labels | optional | `[]` | | data | The additional runtime files needed by this library. | List of labels | optional | `[]` | | resources | The files to include as classpath resources. | List of labels | optional | `[]` | -| config | The Scalafmt configuration file. | Label | optional | `"@scalafmt_default//:config"` | | deps_unused_whitelist | The JVM library dependencies to always consider unused for `scala_deps_direct` checks. | List of labels | optional | `[]` | | deps_used_whitelist | The JVM library dependencies to always consider used for `scala_deps_used` checks. | List of labels | optional | `[]` | | format | Whether to format the target. If this is False, the formatter and format tester will do nothing. | Boolean | optional | `True` | @@ -144,11 +144,12 @@ To build and run a specific test: `bazel test --test_filter=plugins | The Scalac plugins. | List of labels | optional | `[]` | | resource_jars | The JARs to merge into the output JAR. | List of labels | optional | `[]` | | resource_strip_prefix | The path prefix to strip from classpath resources. | String | optional | `""` | -| runner | - | Label | optional | `"@//src/main/scala/higherkindness/rules_scala/workers/zinc/test"` | +| runner | - | Label | optional | `"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/workers/zinc/test"` | | runtime_deps | The JVM runtime-only library dependencies. | List of labels | optional | `[]` | | scala_toolchain_name | The name of the Scala toolchain to use for this target (as provided to `register_*_toolchain`) | String | optional | `""` | | scalacopts | Options to pass to scalac. | List of strings | optional | `[]` | +| scalafmt_toolchain_name | The name of the Scalafmt configuration toolchain. | String | optional | `""` | | shared_deps | If isolation is "classloader", the list of deps to keep loaded between tests | List of labels | optional | `[]` | -| subprocess_runner | - | Label | optional | `"@//src/main/scala/higherkindness/rules_scala/common/sbt-testing:subprocess"` | +| subprocess_runner | - | Label | optional | `"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/sbt-testing:subprocess"` | diff --git a/docs/stardoc/scala_workspace.md b/docs/stardoc/scala_workspace.md deleted file mode 100644 index 570b30976..000000000 --- a/docs/stardoc/scala_workspace.md +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - -## scala_artifacts - -
-load("@//rules/scala:workspace.bzl", "scala_artifacts")
-
-scala_artifacts()
-
- - - - - - - -## scala_register_toolchains - -
-load("@//rules/scala:workspace.bzl", "scala_register_toolchains")
-
-scala_register_toolchains(default_scala_toolchain_name, toolchains)
-
- -Registers the provided Scala toolchains with Bazel and sets a default one to use. - -**PARAMETERS** - - -| Name | Description | Default Value | -| :------------- | :------------- | :------------- | -| default_scala_toolchain_name | The name of the default Scala toolchain to use. | none | -| toolchains | The toolchains to register. | `[]` | - - - - -## scala_repositories - -
-load("@//rules/scala:workspace.bzl", "scala_repositories")
-
-scala_repositories(java_launcher_version, java_launcher_template_sha)
-
- - - -**PARAMETERS** - - -| Name | Description | Default Value | -| :------------- | :------------- | :------------- | -| java_launcher_version |

-

| `"7.4.1"` | -| java_launcher_template_sha |

-

| `"ee4aa47ae5e639632c67be5cc0ccbc4e941a67a1b884a1ce0c4329357a4b62b2"` | - - diff --git a/docs/stardoc/scala_workspace_2_12.md b/docs/stardoc/scala_workspace_2_12.md deleted file mode 100644 index a762f8fca..000000000 --- a/docs/stardoc/scala_workspace_2_12.md +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - -## scala_2_12_artifacts - -
-load("@//rules/scala:workspace_2_12.bzl", "scala_2_12_artifacts")
-
-scala_2_12_artifacts()
-
- - - - - - - -## scala_2_12_repositories - -
-load("@//rules/scala:workspace_2_12.bzl", "scala_2_12_repositories")
-
-scala_2_12_repositories()
-
- - - - - diff --git a/docs/stardoc/scalafmt.md b/docs/stardoc/scalafmt.md index 3bd5665d0..9656966d1 100644 --- a/docs/stardoc/scalafmt.md +++ b/docs/stardoc/scalafmt.md @@ -7,9 +7,9 @@ ## scala_format_test
-load("@//rules:scalafmt.bzl", "scala_format_test")
+load("@rules_scala_annex//rules:scalafmt.bzl", "scala_format_test")
 
-scala_format_test(name, srcs, config)
+scala_format_test(name, srcs, scalafmt_toolchain_name)
 
@@ -21,6 +21,6 @@ scala_format_test(name, name | A unique name for this target. | Name | required | | | srcs | The Scala files. | List of labels | optional | `[]` | -| config | The Scalafmt configuration file. | Label | optional | `"@scalafmt_default//:config"` | +| scalafmt_toolchain_name | The name of the Scalafmt configuration toolchain. | String | optional | `""` | diff --git a/docs/stardoc/scalafmt_register_toolchain.md b/docs/stardoc/scalafmt_register_toolchain.md new file mode 100644 index 000000000..c1a3684d3 --- /dev/null +++ b/docs/stardoc/scalafmt_register_toolchain.md @@ -0,0 +1,29 @@ + + + + + + +## register_scalafmt_toolchain + +
+load("@rules_scala_annex//rules/scalafmt:register_toolchain.bzl", "register_scalafmt_toolchain")
+
+register_scalafmt_toolchain(name, config, visibility)
+
+ +Declares a Scalafmt toolchain that can be used with the rules in `@rules_scala_annex//rules:scala_with_scalafmt.bzl` or `@rules_scala_annex//rules:scalafmt.bzl`. + +See [scalafmt.md](../scalafmt.md) for more information. + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| name | The name of the toolchain. | none | +| config | The Scalafmt configuration file. | none | +| visibility | The visibility of the toolchain. | `["//visibility:public"]` | + + diff --git a/docs/stardoc/scalafmt_workspace.md b/docs/stardoc/scalafmt_workspace.md deleted file mode 100644 index 811802b9e..000000000 --- a/docs/stardoc/scalafmt_workspace.md +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - -## scalafmt_artifacts - -
-load("@//rules/scalafmt:workspace.bzl", "scalafmt_artifacts")
-
-scalafmt_artifacts()
-
- - - - - - - -## scalafmt_default_config - -
-load("@//rules/scalafmt:workspace.bzl", "scalafmt_default_config")
-
-scalafmt_default_config(path)
-
- - - -**PARAMETERS** - - -| Name | Description | Default Value | -| :------------- | :------------- | :------------- | -| path |

-

| `".scalafmt.conf"` | - - - - -## scalafmt_repositories - -
-load("@//rules/scalafmt:workspace.bzl", "scalafmt_repositories")
-
-scalafmt_repositories()
-
- - - - - diff --git a/rules/BUILD b/rules/BUILD index bab5e0ebd..f780374b9 100644 --- a/rules/BUILD +++ b/rules/BUILD @@ -1,23 +1,11 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc") -load("@rules_pkg//pkg:pkg.bzl", "pkg_tar") -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", @@ -34,7 +22,6 @@ bzl_library( name = "scala-rules", srcs = glob(["**/*.bzl"]) + [ "//rules/common:bzl", - "//rules/external/third_party/bazel/tools/build_defs/repo:bzl", "//rules/jvm:bzl", "//rules/private:bzl", "//rules/scala:bzl", @@ -49,6 +36,5 @@ bzl_library( "@bazel_skylib//lib:shell", "@rules_java//toolchains:toolchain_utils", "@rules_jvm_external//:implementation", - "@rules_scala_annex_scala_toolchain//:default", ], ) diff --git a/rules/external.bzl b/rules/external.bzl deleted file mode 100644 index ed03fc59d..000000000 --- a/rules/external.bzl +++ /dev/null @@ -1,29 +0,0 @@ -load( - "//rules/external/third_party/bazel/tools/build_defs/repo:java.bzl", - _jvm_import_external = "jvm_import_external", - _jvm_maven_import_external = "jvm_maven_import_external", -) - -def scala_maven_import_external( - artifact, - server_urls, - rule_load = "load(\"@rules_scala_annex//rules:scala.bzl\", \"scala_import\")", - **kwargs): - _jvm_maven_import_external( - rule_name = "scala_import", - rule_load = rule_load, - artifact = artifact, - server_urls = server_urls, - #additional string attributes' values have to be escaped in order to accomodate non-string types - # additional_rule_attrs = {"foo": "'bar'"}, - **kwargs - ) - -def scala_import_external( - rule_load = "load(\"@rules_scala_annex//rules:scala.bzl\", \"scala_import\")", - **kwargs): - _jvm_import_external( - rule_name = "scala_import", - rule_load = rule_load, - **kwargs - ) diff --git a/rules/external/third_party/bazel/tools/build_defs/repo/BUILD b/rules/external/third_party/bazel/tools/build_defs/repo/BUILD deleted file mode 100644 index 70a038db4..000000000 --- a/rules/external/third_party/bazel/tools/build_defs/repo/BUILD +++ /dev/null @@ -1,5 +0,0 @@ -filegroup( - name = "bzl", - srcs = glob(["**/*.bzl"]), - visibility = ["//rules:__pkg__"], -) diff --git a/rules/external/third_party/bazel/tools/build_defs/repo/java.bzl b/rules/external/third_party/bazel/tools/build_defs/repo/java.bzl deleted file mode 100644 index a444e421f..000000000 --- a/rules/external/third_party/bazel/tools/build_defs/repo/java.bzl +++ /dev/null @@ -1,357 +0,0 @@ -# Copyright 2017 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -'jvm_import_external' offers additional functionality above what maven_jar has to offer. -In addition to downloading the jars, it allows to define this jar's dependencies. -thus it enables the explicit definition of the entire transitive dependency graph. - -The rule achieves this by writing 'import' build rules in BUILD files next to the downloaded jars. -The name of the underlying 'import' rule needs to be specified. -An optional 'load' statement can also be provided, along with any other relevant custom attribute. -These import rules must have the following attributes: -- "jars" -- "deps" -- "runtime_deps" -- "exports" - -the code here is solely based on `jave_import_external` from bazelbuild/bazel repository and is proposed to be upstreamed back. - -the following macros are defined below that utilize jvm_import_external: - -- scala_import_external - uses `scala_import` as the underlying build rule -- jvm_maven_import_external - offers a 'maven' like api for identifying jars using 'artifact' format -- scala_maven_import_external - combination of scala_import_external and jvm_maven_import_external -- java_import_external - to demonstrate that the original functionality of `java_import_external` stayed intact. -""" - -_HEADER = "# DO NOT EDIT: generated by jvm_import_external()" -_PASS_PROPS = ( - "neverlink", - "testonly_", - "visibility", - "exports", - "runtime_deps", - "deps", - "tags", -) - -def _jvm_import_external(repository_ctx): - """Implementation of `java_import_external` rule.""" - if (repository_ctx.attr.generated_linkable_rule_name and - not repository_ctx.attr.neverlink): - fail("Only use generated_linkable_rule_name if neverlink is set") - name = repository_ctx.attr.generated_rule_name or repository_ctx.name - urls = repository_ctx.attr.jar_urls - sha = repository_ctx.attr.jar_sha256 - path = repository_ctx.name + ".jar" - for url in urls: - if url.endswith(".jar"): - path = url[url.rindex("/") + 1:] - break - srcurls = repository_ctx.attr.srcjar_urls - srcsha = repository_ctx.attr.srcjar_sha256 - srcpath = repository_ctx.name + "-src.jar" if srcurls else "" - for url in srcurls: - if url.endswith(".jar"): - srcpath = url[url.rindex("/") + 1:].replace("-sources.jar", "-src.jar") - break - lines = [_HEADER, ""] - if repository_ctx.attr.rule_load: - lines.append(repository_ctx.attr.rule_load) - lines.append("") - if repository_ctx.attr.default_visibility: - lines.append("package(default_visibility = %s)" % ( - repository_ctx.attr.default_visibility - )) - lines.append("") - lines.append("licenses(%s)" % repr(repository_ctx.attr.licenses)) - lines.append("") - lines.extend(_serialize_given_rule_import( - repository_ctx.attr.rule_name, - name, - path, - srcpath, - repository_ctx.attr, - _PASS_PROPS, - repository_ctx.attr.additional_rule_attrs, - )) - if (repository_ctx.attr.neverlink and - repository_ctx.attr.generated_linkable_rule_name): - lines.extend(_serialize_given_rule_import( - repository_ctx.attr.generated_linkable_rule_name, - path, - srcpath, - repository_ctx.attr, - [p for p in _PASS_PROPS if p != "neverlink"], - )) - extra = repository_ctx.attr.extra_build_file_content - if extra: - lines.append(extra) - if not extra.endswith("\n"): - lines.append("") - repository_ctx.download(urls, path, sha) - if srcurls: - repository_ctx.download(srcurls, srcpath, srcsha) - repository_ctx.file("BUILD", "\n".join(lines)) - repository_ctx.file("jar/BUILD", "\n".join([ - _HEADER, - "", - "package(default_visibility = %r)" % ( - repository_ctx.attr.visibility or - repository_ctx.attr.default_visibility - ), - "", - "alias(", - " name = \"jar\",", - " actual = \"@%s\"," % repository_ctx.name, - ")", - "", - ])) - -def _convert_to_url(artifact, server_urls): - parts = artifact.split(":") - group_id_part = parts[0].replace(".", "/") - artifact_id = parts[1] - version = parts[2] - packaging = "jar" - classifier_part = "" - if len(parts) == 4: - packaging = parts[2] - version = parts[3] - elif len(parts) == 5: - packaging = parts[2] - classifier_part = "-" + parts[3] - version = parts[4] - - final_name = artifact_id + "-" + version + classifier_part + "." + packaging - url_suffix = group_id_part + "/" + artifact_id + "/" + version + "/" + final_name - urls = [] - for server_url in server_urls: - urls.append(_concat_with_needed_slash(server_url, url_suffix)) - return urls - -def _concat_with_needed_slash(server_url, url_suffix): - if server_url.endswith("/"): - return (server_url + url_suffix) - else: - return (server_url + "/" + url_suffix) - -def _serialize_given_rule_import(rule_name, name, path, srcpath, attrs, props, additional_rule_attrs): - lines = [ - "%s(" % rule_name, - " name = %s," % repr(name), - " jars = [%s]," % repr(path), - ] - if srcpath: - lines.append(" srcjar = %s," % repr(srcpath)) - for prop in props: - value = getattr(attrs, prop, None) - if value: - if prop.endswith("_"): - prop = prop[:-1] - lines.append(" %s = %s," % (prop, repr(value))) - for attr_key in additional_rule_attrs: - lines.append(" %s = %s," % (attr_key, additional_rule_attrs[attr_key])) - lines.append(")") - lines.append("") - return lines - -jvm_import_external = repository_rule( - implementation = _jvm_import_external, - attrs = { - "rule_name": attr.string(mandatory = True), - "licenses": attr.string_list(mandatory = True, allow_empty = False), - "jar_urls": attr.string_list(mandatory = True, allow_empty = False), - "jar_sha256": attr.string(), - "rule_load": attr.string(), - "additional_rule_attrs": attr.string_dict(), - "srcjar_urls": attr.string_list(), - "srcjar_sha256": attr.string(), - "deps": attr.string_list(), - "runtime_deps": attr.string_list(), - "testonly_": attr.bool(), - "exports": attr.string_list(), - "neverlink": attr.bool(), - "generated_rule_name": attr.string(), - "generated_linkable_rule_name": attr.string(), - "default_visibility": attr.string_list(default = ["//visibility:public"]), - "extra_build_file_content": attr.string(), - }, -) - -def jvm_maven_import_external(artifact, server_urls, **kwargs): - jvm_import_external( - jar_urls = _convert_to_url(artifact, server_urls), - **kwargs - ) - -"""Rules for defining external Java dependencies. - -java_import_external() replaces `maven_jar` and `http_jar`. It is the -recommended solution for defining third party Java dependencies that are -obtained from web servers. - -This solution offers high availability, low latency, and repository -scalability at the cost of simplicity. Tooling can be used to generate - -The default target in this BUILD file will always have the same name as -the repository itself. This means that other Bazel rules can depend on -it as `@repo//:repo` or `@repo` for short. - -### Setup - -Add the following to your `WORKSPACE` file: - -```python -load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external") -``` - -### Best Practices - -#### Downloading - -The recommended best practices for downloading Maven jars are as follows: - -1. Always follow release versions or pinned revisions. -2. Permanently mirror all dependencies to GCS or S3 as the first URL -3. Put the original URL in the GCS or S3 object name -4. Make the second URL the original repo1.maven.org URL -5. Make the third URL the maven.ibiblio.org mirror, if it isn't 404 -6. Always specify the sha256 checksum - -Bazel has one of the most sophisticated systems for downloading files of any -build system. Following these best practices will ensure that your codebase -takes full advantage of the level of reliability that Bazel able to offer. See -https://goo.gl/uQOE11 for more information. - -#### Selection - -Avoid using jars that bundle their dependencies. For example, a Maven jar for -the artifact com.initech:tps:1.0 should not contain a classes named -com.fakecorp.foo. Try to see if Initech distributes a tps jar that doesn't -bundle its dependencies. Then create a separate java_import_external() for each -one and have the first depend on the second. - -Sometimes jars are distributed with their dependencies shaded. What this means -is that com.initech.tps will contain classes like -com.initech.tps.shade.com.fakecorp.foo. This is less problematic, since it -won't lead to mysterious classpath conflicts. But it can lead to inefficient -use of space and make the license of the the end product more difficult to -determine. - -#### Licensing - -The following values for the licenses field are typically used. If a jar -contains multiple works with difference licenses, then only the most -restrictive one is listed, and the rest are noted in accompanying comments. - -The following are examples of how licenses could be categorized, ordered -by those with terms most permissive to least: - -- **unencumbered**: CC0, Unlicense -- **permissive**: Beerware -- **notice**: Apache, MIT, X11, BSD, ISC, ZPL, Unicode, JSON, Artistic -- **reciprocal**: MPL, CPL, EPL, Eclipse, APSL, IBMPL, CDDL -- **restricted**: GPL, LGPL, OSL, Sleepycat, QTPL, Java, QMail, NPL -- **by_exception_only**: AGPL, WTFPL - -### Naming - -Bazel repository names must match the following pattern: `[_0-9A-Za-z]+`. To -choose an appropriate name based on a Maven group and artifact ID, we recommend -an algorithm https://gist.github.com/jart/41bfd977b913c2301627162f1c038e55 which -can be best explained by the following examples: - -- com.google.guava:guava becomes com_google_guava -- commons-logging:commons-logging becomes commons_logging -- junit:junit becomes junit - -Adopting this naming convention will help maximize the chances that your -codebase will be able to successfully interoperate with other Bazel codebases -using Java. - -### Example - -Here is an example of a best practice definition of Google's Guava library: - -```python -java_import_external( - name = "com_google_guava", - licenses = ["notice"], # Apache 2.0 - jar_urls = [ - "http://bazel-mirror.storage.googleapis.com/repo1.maven.org/maven2/com/google/guava/guava/20.0/guava-20.0.jar", - "http://repo1.maven.org/maven2/com/google/guava/guava/20.0/guava-20.0.jar", - "http://maven.ibiblio.org/maven2/com/google/guava/guava/20.0/guava-20.0.jar", - ], - jar_sha256 = "36a666e3b71ae7f0f0dca23654b67e086e6c93d192f60ba5dfd5519db6c288c8", - deps = [ - "@com_google_code_findbugs_jsr305", - "@com_google_errorprone_error_prone_annotations", - ], -) - -java_import_external( - name = "com_google_code_findbugs_jsr305", - licenses = ["notice"], # BSD 3-clause - jar_urls = [ - "http://bazel-mirror.storage.googleapis.com/repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar", - "http://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar", - "http://maven.ibiblio.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar", - ], - jar_sha256 = "905721a0eea90a81534abb7ee6ef4ea2e5e645fa1def0a5cd88402df1b46c9ed", -) - -java_import_external( - name = "com_google_errorprone_error_prone_annotations", - licenses = ["notice"], # Apache 2.0 - jar_sha256 = "e7749ffdf03fb8ebe08a727ea205acb301c8791da837fee211b99b04f9d79c46", - jar_urls = [ - "http://bazel-mirror.storage.googleapis.com/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.0.15/error_prone_annotations-2.0.15.jar", - "http://maven.ibiblio.org/maven2/com/google/errorprone/error_prone_annotations/2.0.15/error_prone_annotations-2.0.15.jar", - "http://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.0.15/error_prone_annotations-2.0.15.jar", - ], -) -``` - -### Annotation Processors - -Defining jars that contain annotation processors requires a certain level of -trickery, which is best done by copying and pasting from codebases that have -already done it before. Please see the Google Nomulus and Bazel Closure Rules -codebases for examples in which java_import_external has been used to define -Dagger 2.0, AutoValue, and AutoFactory. - -Please note that certain care needs to be taken into consideration regarding -whether or not these annotation processors generate actual API, or simply -generate code that implements them. See the Bazel documentation for further -information. - -### Test Dependencies - -It is strongly recommended that the `testonly_` attribute be specified on -libraries that are intended for testing purposes. This is passed along to the -generated `java_library` rule in order to ensure that test code remains -disjoint from production code. - -### Provided Dependencies - -The feature in Bazel most analagous to Maven's provided scope is the neverlink -attribute. This should be used in rare circumstances when a distributed jar -will be loaded into a runtime environment where certain dependencies can be -reasonably expected to already be provided. -""" - -def java_import_external(jar_sha256, **kwargs): - jvm_import_external(rule_name = "java_import", jar_sha256 = jar_sha256, **kwargs) diff --git a/rules/register_toolchain.bzl b/rules/register_toolchain.bzl index 1b5d7d1a8..8b1106e98 100644 --- a/rules/register_toolchain.bzl +++ b/rules/register_toolchain.bzl @@ -1,4 +1,3 @@ -load("@rules_scala_annex_scala_toolchain//:default.bzl", "default_scala_toolchain_name") load( "//rules:providers.bzl", "CodeCoverageConfiguration", @@ -15,8 +14,10 @@ load( "phase_zinc_depscheck", ) -original_scala_toolchain_setting = "@rules_scala_annex_scala_toolchain//:original-scala-toolchain" -scala_toolchain_setting = "@rules_scala_annex_scala_toolchain//:scala-toolchain" +original_scala_toolchain_setting = "@rules_scala_annex//rules/scala:original-scala-toolchain" +original_scalafmt_toolchain_setting = "@rules_scala_annex//rules/scalafmt:original-scalafmt-toolchain" +scala_toolchain_setting = "@rules_scala_annex//rules/scala:scala-toolchain" +scalafmt_toolchain_setting = "@rules_scala_annex//rules/scalafmt:scalafmt-toolchain" def _bootstrap_configuration_impl(ctx): return [ @@ -210,38 +211,72 @@ def _make_register_toolchain(configuration_rule): register_bootstrap_toolchain = _make_register_toolchain(_bootstrap_configuration) register_zinc_toolchain = _make_register_toolchain(_zinc_configuration) -def _scala_toolchain_incoming_transition_impl(settings, attr): - # We set `original_scala_toolchain_setting` so we can reset the toolchain to its original value - # in `scala_toolchain_outgoing_transition`. That way, we can ensure every target is built under - # a single toolchain, thus preventing duplicate builds. - # - # This is inspired by what the rules_go folks are doing. - return {} if attr.scala_toolchain_name == "" else { - original_scala_toolchain_setting: settings[scala_toolchain_setting], - scala_toolchain_setting: attr.scala_toolchain_name, - } - -scala_toolchain_incoming_transition = transition( - implementation = _scala_toolchain_incoming_transition_impl, - inputs = [scala_toolchain_setting], - outputs = [original_scala_toolchain_setting, scala_toolchain_setting], +def _scala_incoming_transition_impl(settings, attr): + result = dict(settings) + + if attr.scala_toolchain_name != "": + # We set `original_scala_toolchain_setting` so we can reset the toolchain to its + # original value in `scala_outgoing_transition`. That way, we can ensure every target is + # built under a single toolchain, thus preventing duplicate builds. + # + # This is inspired by what the rules_go folks are doing. + result[original_scala_toolchain_setting] = settings[scala_toolchain_setting] + result[scala_toolchain_setting] = attr.scala_toolchain_name + + if hasattr(attr, "scalafmt_toolchain_name") and attr.scalafmt_toolchain_name != "": + result[original_scalafmt_toolchain_setting] = settings[scalafmt_toolchain_setting] + result[scalafmt_toolchain_setting] = attr.scalafmt_toolchain_name + + return result + +scala_incoming_transition = transition( + implementation = _scala_incoming_transition_impl, + inputs = [ + original_scala_toolchain_setting, + original_scalafmt_toolchain_setting, + scala_toolchain_setting, + scalafmt_toolchain_setting, + ], + outputs = [ + original_scala_toolchain_setting, + original_scalafmt_toolchain_setting, + scala_toolchain_setting, + scalafmt_toolchain_setting, + ], ) -def _scala_toolchain_outgoing_transition_impl(settings, _): +def _scala_outgoing_transition_impl(settings, _): + result = dict(settings) original_scala_toolchain = settings[original_scala_toolchain_setting] + original_scalafmt_toolchain = settings[original_scalafmt_toolchain_setting] + + # Although `original_scala_toolchain_setting` and `original_scalafmt_toolchain_setting` will be + # overridden in the incoming transition, we set them to "" so non-Scala targets aren't built + # under different values of these settings. That way, they aren't built multiple times. + if original_scala_toolchain != "": + result[original_scala_toolchain_setting] = "" + result[scala_toolchain_setting] = original_scala_toolchain + + if original_scalafmt_toolchain != "": + result[original_scalafmt_toolchain_setting] = "" + result[scalafmt_toolchain_setting] = original_scalafmt_toolchain + + return result - return {} if original_scala_toolchain == "" else { - # Although `original_scala_toolchain_setting` will be overridden in the incoming transition, - # we set it to "" so that non-Scala targets aren't built under different values of this - # setting. That way, they aren't built multiple times. - original_scala_toolchain_setting: "", - scala_toolchain_setting: original_scala_toolchain, - } - -scala_toolchain_outgoing_transition = transition( - implementation = _scala_toolchain_outgoing_transition_impl, - inputs = [original_scala_toolchain_setting], - outputs = [original_scala_toolchain_setting, scala_toolchain_setting], +scala_outgoing_transition = transition( + implementation = _scala_outgoing_transition_impl, + inputs = [ + original_scala_toolchain_setting, + original_scalafmt_toolchain_setting, + scala_toolchain_setting, + scalafmt_toolchain_setting, + ], + outputs = [ + original_scala_toolchain_setting, + original_scalafmt_toolchain_setting, + scala_toolchain_setting, + scalafmt_toolchain_setting, + ], ) scala_toolchain_attributes = { diff --git a/rules/rules_scala.bzl b/rules/rules_scala.bzl deleted file mode 100644 index fb15dc7d4..000000000 --- a/rules/rules_scala.bzl +++ /dev/null @@ -1,73 +0,0 @@ -load( - "//rules/common:private/utils.bzl", - _strip_margin = "strip_margin", -) - -def _emulate_rules_scala_repository_impl(repository_ctx): - repository_ctx.file("WORKSPACE", content = "workspace(name = \"io_bazel_rules_scala\")") - repository_ctx.file( - "scala/scala.bzl", - content = _strip_margin(""" - |load("@rules_scala_annex//rules/rules_scala:private/compat.bzl", - | _scala_library = "scala_library", - | _scala_macro_library = "scala_macro_library", - | _scala_binary = "scala_binary", - | _scala_test = "scala_test", - | _scala_test_suite = "scala_test_suite", - |) - | - |scala_library = _scala_library - |scala_macro_library = _scala_macro_library - |scala_binary = _scala_binary - |scala_test = _scala_test - |scala_test_suite = _scala_test_suite - |"""), - ) - repository_ctx.file( - "scala/scala_import.bzl", - content = _strip_margin(""" - |load("@rules_scala_annex//rules:scala.bzl", - | _scala_import = "scala_import", - |) - | - |scala_import = _scala_import - |"""), - ) - extra_deps = ", ".join(["\"{}\"".format(dep) for dep in repository_ctx.attr.extra_deps]) - repository_ctx.file( - "scala/BUILD", - content = _strip_margin(""" - |java_import( - | name = "extra_deps", - | exports = [ - | {extra_deps} - | ], - | jars = [], - | visibility = ["//visibility:public"], - |) - |""".format(extra_deps = extra_deps)), - ) - -emulate_rules_scala_repository = repository_rule( - attrs = { - "extra_deps": attr.label_list(default = []), - }, - local = True, - implementation = _emulate_rules_scala_repository_impl, -) - -def emulate_rules_scala(scalatest, extra_deps = []): - native.bind( - name = "scala_annex/compat/rules_scala/extra_deps", - actual = "@io_bazel_rules_scala//scala:extra_deps", - ) - - native.bind( - name = "scala_annex/compat/rules_scala/scalatest_dep", - actual = scalatest, - ) - - emulate_rules_scala_repository( - name = "io_bazel_rules_scala", - extra_deps = extra_deps, - ) diff --git a/rules/rules_scala/BUILD b/rules/rules_scala/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/rules/rules_scala/private/compat.bzl b/rules/rules_scala/private/compat.bzl deleted file mode 100644 index 718f21d40..000000000 --- a/rules/rules_scala/private/compat.bzl +++ /dev/null @@ -1,309 +0,0 @@ -""" -Provides compatibility with vanilla rules_scala rules - -The aim is to implement compatibility strictly with macros. `bazel query` -can be used to expand macro usage and provide a seamless transition to -newer rules. -""" - -load( - "//rules:providers.bzl", - "ScalaConfiguration", -) -load( - "//rules:scala.bzl", - _scala_binary = "scala_binary", - _scala_library = "scala_library", - _scala_test = "scala_test", -) -load( - "//rules/common:private/utils.bzl", - _safe_name = "safe_name", -) - -_extra_deps = ["//external:scala_annex/compat/rules_scala/extra_deps"] - -_scalatest_deps = ["//external:scala_annex/compat/rules_scala/scalatest_dep"] - -def scala_library( - # bazel rule attributes - name, - tags = [], - visibility = None, - # rules_scala common attributes - data = [], - deps = [], - javac_jvm_flags = [], - javacopts = [], - jvm_flags = [], - plugins = [], - print_compile_time = False, - resource_jars = [], - resource_strip_prefix = None, - resources = [], - runtime_deps = [], - scala_toolchain_name = None, - scalac_jvm_flags = [], - scalacopts = [], - srcs = [], - # library only attributes - main_class = None, - exports = [], - # compat layer internals - _use_ijar = True): - if plugins != []: - print("%s: plugins unsupported" % name) - if data != []: - print("%s: data unsupported" % name) - if resources != []: - print("%s: resources unsupported" % name) - if resource_strip_prefix != None: - print("%s: resource_strip_prefix unsupported" % name) - if resource_jars != []: - print("%s: resource_jars unsupported" % name) - if javacopts != []: - print("%s: javacopts unsupported" % name) - if jvm_flags != []: - print("%s: jvm_flags unsupported" % name) - if scalac_jvm_flags != []: - print("%s: scalac_jvm_flags unsupported" % name) - if javac_jvm_flags != []: - print("%s: javac_jvm_flags unsupported" % name) - if print_compile_time != False: - print("%s: print_compile_time unsupported" % name) - if main_class != None: - print("%s: main_class unsupported" % name) - - deps = deps if deps else [] - _scala_library( - name = name, - srcs = srcs, - deps_used_whitelist = _extra_deps, - exports = exports, - macro = not _use_ijar, - runtime_deps = runtime_deps, - scala_toolchain_name = scala_toolchain_name, - scalacopts = scalacopts, - tags = tags, - visibility = visibility, - deps = deps + _extra_deps, - ) - -def scala_macro_library( - # bazel rule attributes - name, - tags = [], - visibility = None, - # rules_scala common attributes - data = [], - deps = [], - javac_jvm_flags = [], - javacopts = [], - jvm_flags = [], - plugins = [], - print_compile_time = False, - resource_jars = [], - resource_strip_prefix = None, - resources = [], - runtime_deps = [], - scala_toolchain_name = None, - scalac_jvm_flags = [], - scalacopts = [], - srcs = [], - # library only attributes - main_class = None, - exports = []): - return scala_library( - name, - tags, - visibility, - data, - deps, - javac_jvm_flags, - javacopts, - jvm_flags, - plugins, - print_compile_time, - resource_jars, - resource_strip_prefix, - resources, - runtime_deps, - scala_toolchain_name, - scalac_jvm_flags, - scalacopts, - srcs, - main_class, - exports, - False, # _use_ijar - ) - -def scala_binary( - # bazel rule attributes - name, - tags = [], - visibility = None, - # rules_scala common attributes - data = [], - deps = [], - javac_jvm_flags = [], - javacopts = [], - jvm_flags = [], - plugins = [], - print_compile_time = False, - resource_jars = [], - resource_strip_prefix = None, - resources = [], - runtime_deps = [], - scala_toolchain_name = None, - scalac_jvm_flags = [], - scalacopts = [], - srcs = [], - # binary only attributes - main_class = None, - classpath_resources = [], - # compat layer internals - _use_ijar = True): - if plugins != []: - print("%s: plugins unsupported" % name) - if data != []: - print("%s: data unsupported" % name) - if resources != []: - print("%s: resources unsupported" % name) - if resource_strip_prefix != None: - print("%s: resource_strip_prefix unsupported" % name) - if resource_jars != []: - print("%s: resource_jars unsupported" % name) - if scalacopts != []: - print("%s: scalacopts unsupported" % name) - if javacopts != []: - print("%s: javacopts unsupported" % name) - if jvm_flags != []: - print("%s: jvm_flags unsupported" % name) - if scalac_jvm_flags != []: - print("%s: scalac_jvm_flags unsupported" % name) - if javac_jvm_flags != []: - print("%s: javac_jvm_flags unsupported" % name) - if print_compile_time != False: - print("%s: print_compile_time unsupported" % name) - if classpath_resources != []: - print("%s: classpath_resources unsupported" % name) - - deps = deps if deps else [] - _scala_binary( - name = name, - srcs = srcs, - deps_used_whitelist = _extra_deps, - main_class = main_class, - runtime_deps = runtime_deps, - scala_toolchain_name = scala_toolchain_name, - tags = tags, - deps = deps + _extra_deps, - ) - -def scala_test( - # bazel rule attributes - name, - tags = [], - visibility = None, - # rules_scala common attributes - data = [], - deps = [], - javac_jvm_flags = [], - javacopts = [], - jvm_flags = [], - plugins = [], - print_compile_time = False, - resource_jars = [], - resource_strip_prefix = None, - resources = [], - runtime_deps = [], - scala_toolchain_name = None, - scalac_jvm_flags = [], - scalacopts = [], - srcs = [], - # test only attributes - suites = [], - colors = None, - full_stacktraces = None, - # compat layer internals - _use_ijar = True, - **kwargs): - if plugins != []: - print("%s: plugins unsupported" % name) - if data != []: - print("%s: data unsupported" % name) - if resources != []: - print("%s: resources unsupported" % name) - if resource_strip_prefix != None: - print("%s: resource_strip_prefix unsupported" % name) - if resource_jars != []: - print("%s: resource_jars unsupported" % name) - if scalacopts != []: - print("%s: scalacopts unsupported" % name) - if javacopts != []: - print("%s: javacopts unsupported" % name) - if jvm_flags != []: - print("%s: jvm_flags unsupported" % name) - if scalac_jvm_flags != []: - print("%s: scalac_jvm_flags unsupported" % name) - if javac_jvm_flags != []: - print("%s: javac_jvm_flags unsupported" % name) - if print_compile_time != False: - print("%s: print_compile_time unsupported" % name) - if suites != []: - print("%s: suites unsupported" % name) - if colors != None: - print("%s: colors unsupported" % name) - if full_stacktraces != None: - print("%s: full_stacktraces unsupported" % name) - - deps = deps if deps else [] - _scala_test( - name = name, - srcs = srcs, - deps_used_whitelist = _extra_deps, - frameworks = ["org.scalatest.tools.Framework"], - runtime_deps = runtime_deps, - scala_toolchain_name = scala_toolchain_name, - tags = tags, - deps = deps + _scalatest_deps + _extra_deps, - ) - -def scala_test_suite( - name, - srcs = [], - colors = True, - data = [], - deps = [], - full_stacktraces = True, - jvm_flags = [], - resources = [], - runtime_deps = [], - scala_toolchain_name = None, - scalacopts = [], - size = None, - visibility = None): - tests = [] - for src in srcs: - test_name = "%s_test_suite_%s" % (name, _safe_name(src)) - scala_test( - name = test_name, - srcs = [src], - colors = colors, - full_stacktraces = full_stacktraces, - jvm_flags = jvm_flags, - resources = resources, - runtime_deps = runtime_deps, - scala_toolchain_name = scala_toolchain_name, - scalacopts = scalacopts, - size = size, - visibility = visibility, - deps = deps, - ) - tests.append(test_name) - - native.test_suite( - name = name, - tests = tests, - visibility = visibility, - ) diff --git a/rules/scala.bzl b/rules/scala.bzl index 6286d1ba8..32dd2cb9d 100644 --- a/rules/scala.bzl +++ b/rules/scala.bzl @@ -43,14 +43,14 @@ load(":jvm.bzl", _labeled_jars = "labeled_jars") load(":providers.bzl", _ScalaRulePhase = "ScalaRulePhase") load( ":register_toolchain.bzl", + _scala_incoming_transition = "scala_incoming_transition", + _scala_outgoing_transition = "scala_outgoing_transition", _scala_toolchain_attributes = "scala_toolchain_attributes", - _scala_toolchain_incoming_transition = "scala_toolchain_incoming_transition", - _scala_toolchain_outgoing_transition = "scala_toolchain_outgoing_transition", ) _compile_private_attributes = { "_java_toolchain": attr.label( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, default = Label("@bazel_tools//tools/jdk:current_java_toolchain"), ), "_singlejar": attr.label( @@ -75,7 +75,7 @@ _compile_private_attributes = { _compile_attributes = { "srcs": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The source Scala and Java files (and `-sources.jar` `.srcjar` `-src.jar` files of those).", allow_files = [ ".scala", @@ -87,12 +87,12 @@ _compile_attributes = { flags = ["DIRECT_COMPILE_TIME_INPUT"], ), "data": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The additional runtime files needed by this library.", allow_files = True, ), "deps": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, aspects = [ _labeled_jars, _coverage_replacements_provider.aspect, @@ -101,17 +101,17 @@ _compile_attributes = { providers = [JavaInfo], ), "deps_used_whitelist": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The JVM library dependencies to always consider used for `scala_deps_used` checks.", providers = [JavaInfo], ), "deps_unused_whitelist": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The JVM library dependencies to always consider unused for `scala_deps_direct` checks.", providers = [JavaInfo], ), "runtime_deps": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The JVM runtime-only library dependencies.", providers = [JavaInfo], ), @@ -119,7 +119,7 @@ _compile_attributes = { doc = "The Javac options.", ), "plugins": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The Scalac plugins.", providers = [JavaInfo], ), @@ -128,12 +128,12 @@ _compile_attributes = { ), "resources": attr.label_list( allow_files = True, - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The files to include as classpath resources.", ), "resource_jars": attr.label_list( allow_files = [".jar"], - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The JARs to merge into the output JAR.", ), "scalacopts": attr.string_list( @@ -146,7 +146,7 @@ _library_attributes = { aspects = [ _coverage_replacements_provider.aspect, ], - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The JVM libraries to add as dependencies to any libraries dependent on this one.", providers = [JavaInfo], ), @@ -165,7 +165,7 @@ _runtime_attributes = { doc = "The JVM runtime flags.", ), "runtime_deps": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "The JVM runtime-only library dependencies.", providers = [JavaInfo], ), @@ -173,12 +173,12 @@ _runtime_attributes = { _runtime_private_attributes = { "_target_jdk": attr.label( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, default = Label("@bazel_tools//tools/jdk:current_java_runtime"), providers = [java_common.JavaRuntimeInfo], ), "_java_stub_template": attr.label( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, default = Label("@anx_java_stub_template//file"), allow_single_file = True, ), @@ -258,7 +258,7 @@ def make_scala_library(*extras): _extras_attributes(extras), *[extra["attrs"] for extra in extras] ), - cfg = _scala_toolchain_incoming_transition, + cfg = _scala_incoming_transition, doc = "Compiles a Scala JVM library.", implementation = _scala_library_implementation, outputs = _dicts.add( @@ -269,6 +269,7 @@ def make_scala_library(*extras): ), toolchains = [ "//rules/scala:toolchain_type", + "//rules/scalafmt:toolchain_type", "@bazel_tools//tools/jdk:toolchain_type", ], ) @@ -291,7 +292,7 @@ def make_scala_binary(*extras): _extras_attributes(extras), *[extra["attrs"] for extra in extras] ), - cfg = _scala_toolchain_incoming_transition, + cfg = _scala_incoming_transition, doc = """ Compiles and links a Scala JVM executable. @@ -315,6 +316,7 @@ To run the program: `bazel run ` ), toolchains = [ "//rules/scala:toolchain_type", + "//rules/scalafmt:toolchain_type", "@bazel_tools//tools/jdk:toolchain_type", ], ) @@ -342,7 +344,7 @@ def make_scala_test(*extras): ), "scalacopts": attr.string_list(doc = "Options to pass to scalac."), "shared_deps": attr.label_list( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, doc = "If isolation is \"classloader\", the list of deps to keep loaded between tests", providers = [JavaInfo], ), @@ -358,18 +360,18 @@ def make_scala_test(*extras): doc = "The list of test frameworks to check for. These should conform to the sbt test interface (https://github.com/sbt/test-interface).", ), "runner": attr.label( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, default = "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/workers/zinc/test", ), "subprocess_runner": attr.label( - cfg = _scala_toolchain_outgoing_transition, + cfg = _scala_outgoing_transition, default = "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/sbt-testing:subprocess", ), }, _extras_attributes(extras), *[extra["attrs"] for extra in extras] ), - cfg = _scala_toolchain_incoming_transition, + cfg = _scala_incoming_transition, doc = """ Compiles and links a collection of Scala tests. @@ -392,6 +394,7 @@ To build and run a specific test: `bazel test --test_filter=