Skip to content

Commit

Permalink
Manually register the Twirl compiler toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaden Peterson committed Dec 6, 2024
1 parent 9e35929 commit 1379dc6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 49 deletions.
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ register_toolchains(
"//:repository_default_toolchain_21_definition",
"//scala:zinc_2_13",
"//scala:zinc_3",
"//twirl-toolchain:twirl-2-13",
"//twirl-toolchain:twirl-3",
)

# Please ensure these stay up-to-date with the versions in `versions.bzl`. Unfortunately,
Expand Down
6 changes: 0 additions & 6 deletions WORKSPACE

This file was deleted.

13 changes: 13 additions & 0 deletions twirl-toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag", "string_setting")
load(":create-toolchain.bzl", "create_twirl_toolchain")

toolchain_type(name = "toolchain_type")

string_setting(
name = "original-twirl-toolchain",
build_setting_default = "",
visibility = ["//visibility:public"],
)

string_flag(
name = "twirl-toolchain",
build_setting_default = "twirl-3",
visibility = ["//visibility:public"],
)

create_twirl_toolchain(
name = "twirl-3",
twirl_compiler = "//twirl-compiler-cli:twirl-compiler-cli-3",
Expand Down
2 changes: 1 addition & 1 deletion twirl-toolchain/create-toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create_twirl_toolchain(name, twirl_compiler):
native.config_setting(
name = config_setting_name,
flag_values = {
"@rules_twirl_toolchain//:twirl-toolchain": name,
"//twirl-toolchain": name,
},
)

Expand Down
40 changes: 0 additions & 40 deletions twirl-toolchain/register-toolchains.bzl

This file was deleted.

4 changes: 2 additions & 2 deletions twirl-toolchain/transitions.bzl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This approach of incoming transition, store original values, outgoing
# transition, reset to original values is inspired by what the rules_go
# folks are doing.
toolchain_setting_key = "@rules_twirl_toolchain//:twirl-toolchain"
original_toolchain_setting_key = "@rules_twirl_toolchain//:original-twirl-toolchain"
toolchain_setting_key = "//twirl-toolchain"
original_toolchain_setting_key = "//twirl-toolchain:original-twirl-toolchain"

def _twirl_toolchain_transition_impl(settings, attr):
"""Update the rules_twirl toolchain to the overridden value. Store
Expand Down

0 comments on commit 1379dc6

Please sign in to comment.