Skip to content

Commit

Permalink
Manually register the Play routes compiler toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaden Peterson committed Dec 6, 2024
1 parent 5357119 commit e2c526b
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 @@ -20,6 +20,8 @@ bazel_dep(name = "stardoc", version = "0.7.1")

register_toolchains(
"//:repository_default_toolchain_21_definition",
"//play-routes-toolchain:play-routes-3",
"//play-routes-toolchain:play-routes-2-13",
"//scala:zinc_2_13",
"//scala:zinc_3",
)
Expand Down
6 changes: 0 additions & 6 deletions WORKSPACE

This file was deleted.

13 changes: 13 additions & 0 deletions play-routes-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_play_routes_toolchain")

toolchain_type(name = "toolchain_type")

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

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

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

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

This file was deleted.

4 changes: 2 additions & 2 deletions play-routes-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_play_routes_toolchain//:play-routes-toolchain"
original_toolchain_setting_key = "@rules_play_routes_toolchain//:original-play-routes-toolchain"
toolchain_setting_key = "//play-routes-toolchain"
original_toolchain_setting_key = "//play-routes-toolchain:original-play-routes-toolchain"

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

0 comments on commit e2c526b

Please sign in to comment.