forked from bazelbuild/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tut deps toolchain (bazelbuild#1105)
- Loading branch information
Vaidas Pilkauskas
authored and
Borja Lorente
committed
Nov 26, 2020
1 parent
d352214
commit 41ade82
Showing
5 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
load("@io_bazel_rules_scala//scala:providers.bzl", "declare_deps_provider") | ||
load("@io_bazel_rules_scala//tut_rule/toolchain:toolchain.bzl", "export_tut_deps", "tut_toolchain") | ||
|
||
tut_toolchain( | ||
name = "tut_toolchain_impl", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
toolchain( | ||
name = "tut_toolchain", | ||
toolchain = ":tut_toolchain_impl", | ||
toolchain_type = "//tut_rule/toolchain:tut_toolchain_type", | ||
) | ||
|
||
declare_deps_provider( | ||
name = "tut_core_provider", | ||
deps_id = "tut_core", | ||
deps = ["//external:io_bazel_rules_scala/dependency/tut/tut_core"], | ||
) | ||
|
||
export_tut_deps( | ||
name = "tut_core", | ||
deps_id = "tut_core", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
toolchain_type( | ||
name = "tut_toolchain_type", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
load("@io_bazel_rules_scala//scala:providers.bzl", _DepsInfo = "DepsInfo") | ||
load("//scala/private/toolchain_deps:toolchain_deps.bzl", "expose_toolchain_deps") | ||
|
||
def _tut_toolchain_impl(ctx): | ||
toolchain = platform_common.ToolchainInfo( | ||
dep_providers = ctx.attr.dep_providers, | ||
) | ||
|
||
return [toolchain] | ||
|
||
tut_toolchain = rule( | ||
_tut_toolchain_impl, | ||
attrs = { | ||
"dep_providers": attr.label_list( | ||
default = [ | ||
"@io_bazel_rules_scala//tut_rule:tut_core_provider", | ||
], | ||
providers = [_DepsInfo], | ||
), | ||
}, | ||
) | ||
|
||
def _export_tut_deps(ctx): | ||
return expose_toolchain_deps( | ||
ctx, | ||
"@io_bazel_rules_scala//tut_rule/toolchain:tut_toolchain_type", | ||
) | ||
|
||
export_tut_deps = rule( | ||
_export_tut_deps, | ||
attrs = { | ||
"deps_id": attr.string( | ||
mandatory = True, | ||
), | ||
}, | ||
toolchains = ["@io_bazel_rules_scala//tut_rule/toolchain:tut_toolchain_type"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters