Skip to content

Commit

Permalink
Revert "Declare most dependencies in MODULE.bazel"
Browse files Browse the repository at this point in the history
This reverts commit 9e35929.
  • Loading branch information
Jaden Peterson committed Dec 6, 2024
1 parent 9fcd964 commit 5621aa4
Show file tree
Hide file tree
Showing 12 changed files with 315 additions and 808 deletions.
1 change: 0 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
startup --expand_configs_in_place

common --@rules_scala_annex//rules/scala:scala-toolchain=zinc_3
common:ci --color=yes

build --strategy=worker,sandboxed,local
Expand Down
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier", "buildifier_test")
load(
"@rules_java//toolchains:default_java_toolchain.bzl",
"DEFAULT_TOOLCHAIN_CONFIGURATION",
Expand Down
141 changes: 6 additions & 135 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,135 +1,6 @@
module(name = "rules_twirl")

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
bazel_dep(name = "rules_java", version = "7.11.1")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_jvm_external", version = "6.4")
bazel_dep(name = "rules_scala_annex")

rules_scala_annex_version = "bzlmod-migration"

archive_override(
module_name = "rules_scala_annex",
integrity = "sha256-Gt+S2R53KPhfsK66bhOSXowjb35Ouf24zcT3xFZcyAs=",
strip_prefix = "rules_scala-{}".format(rules_scala_annex_version),
urls = ["https://github.com/lucidsoftware/rules_scala/archive/refs/heads/{}.zip".format(rules_scala_annex_version)],
)

bazel_dep(name = "stardoc", version = "0.7.1")

register_toolchains(
"//:repository_default_toolchain_21_definition",
"//scala:zinc_2_13",
"//scala:zinc_3",
)

# Please ensure these stay up-to-date with the versions in `versions.bzl`. Unfortunately,
# `MODULE.bazel` files can't call `load`, so we have to copy them here.
scala_2_13_version = "2.13.14"

scala_3_version = "3.5.1"

twirl_version = "2.0.7"

protobuf_version = "4.28.3"

scopt_version = "4.1.0"

specs2_version = "4.20.8"

zinc_version = "1.10.1"

twirl_compiler_cli_2_13 = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
twirl_compiler_cli_2_13.install(
name = "twirl_compiler_cli_2_13",
artifacts = [
"com.github.scopt:scopt_2.13:{}".format(scopt_version),
"com.google.protobuf:protobuf-java:{}".format(protobuf_version),
"org.playframework.twirl:twirl-compiler_2.13:{}".format(twirl_version),
"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-sbt:compiler-interface:{}".format(zinc_version),
"org.scala-sbt:util-interface:{}".format(zinc_version),
"org.scala-sbt:zinc_2.13:{}".format(zinc_version),
],
fail_if_repin_required = True,
fetch_sources = True,
lock_file = "@rules_twirl//:twirl_compiler_cli_2_13_install.json",
repositories = ["https://repo.maven.apache.org/maven2"],
)

# Set neverlink = True to avoid Scala 2 library being pulled on to the wrong compiler classpath
twirl_compiler_cli_2_13.artifact(
name = "twirl_compiler_cli_2_13",
artifact = "compiler-bridge_2.13",
group = "org.scala-sbt",
neverlink = True,
version = zinc_version,
)
use_repo(twirl_compiler_cli_2_13, "twirl_compiler_cli_2_13")

twirl_compiler_cli_3 = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
twirl_compiler_cli_3.install(
name = "twirl_compiler_cli_3",
artifacts = [
"com.github.scopt:scopt_3:{}".format(scopt_version),
"com.google.protobuf:protobuf-java:{}".format(protobuf_version),
"org.playframework.twirl:twirl-compiler_3:{}".format(twirl_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:util-interface:{}".format(zinc_version),
"org.scala-sbt:zinc_2.13:{}".format(zinc_version),
],
fail_if_repin_required = True,
fetch_sources = True,
lock_file = "@rules_twirl//:twirl_compiler_cli_3_install.json",
repositories = ["https://repo.maven.apache.org/maven2"],
)

# Set neverlink = True to avoid Scala 2 library being pulled on to the compiler classpath
twirl_compiler_cli_3.artifact(
name = "twirl_compiler_cli_3",
artifact = "scala3-sbt-bridge",
group = "org.scala-lang",
neverlink = True,
version = scala_3_version,
)
use_repo(twirl_compiler_cli_3, "twirl_compiler_cli_3")

twirl_test_2_13_artifacts, twirl_test_3_artifacts = [
[
"org.playframework.twirl:twirl-api_{}:{}".format(scala_version, twirl_version),
"org.specs2:specs2-common_{}:{}".format(scala_version, specs2_version),
"org.specs2:specs2-core_{}:{}".format(scala_version, specs2_version),
"org.specs2:specs2-matcher_{}:{}".format(scala_version, specs2_version),
]
for scala_version in [
"2.13",
"3",
]
]

twirl_test_2_13 = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
twirl_test_2_13.install(
name = "twirl_test_2_13",
artifacts = twirl_test_2_13_artifacts,
fail_if_repin_required = True,
fetch_sources = True,
lock_file = "@rules_twirl//:twirl_test_2_13_install.json",
repositories = ["https://repo.maven.apache.org/maven2"],
)
use_repo(twirl_test_2_13, "twirl_test_2_13")

twirl_test_3 = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
twirl_test_3.install(
name = "twirl_test_3",
artifacts = twirl_test_3_artifacts,
fail_if_repin_required = True,
fetch_sources = True,
lock_file = "@rules_twirl//:twirl_test_3_install.json",
repositories = ["https://repo.maven.apache.org/maven2"],
)
use_repo(twirl_test_3, "twirl_test_3")
###############################################################################
# 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
###############################################################################
Loading

0 comments on commit 5621aa4

Please sign in to comment.