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 jmh deps toolchain (bazelbuild#1106)
* Add jmh deps toolchain * Add JMH library deps to toolchain * Add jmh core to deps toolchain
- Loading branch information
Vaidas Pilkauskas
authored and
Borja Lorente
committed
Nov 26, 2020
1 parent
997c59f
commit bd63009
Showing
5 changed files
with
124 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
load("//scala:providers.bzl", "declare_deps_provider") | ||
load("//jmh/toolchain:toolchain.bzl", "export_toolchain_deps", "jmh_toolchain") | ||
|
||
jmh_toolchain( | ||
name = "jmh_toolchain_impl", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
toolchain( | ||
name = "jmh_toolchain", | ||
toolchain = ":jmh_toolchain_impl", | ||
toolchain_type = "@io_bazel_rules_scala//jmh/toolchain:jmh_toolchain_type", | ||
) | ||
|
||
declare_deps_provider( | ||
name = "jmh_core_provider", | ||
deps_id = "jmh_core", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//external:io_bazel_rules_scala/dependency/jmh/jmh_core", | ||
], | ||
) | ||
|
||
declare_deps_provider( | ||
name = "jmh_classpath_provider", | ||
deps_id = "jmh_classpath", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//external:io_bazel_rules_scala/dependency/jmh/net_sf_jopt_simple_jopt_simple", | ||
"//external:io_bazel_rules_scala/dependency/jmh/org_apache_commons_commons_math3", | ||
], | ||
) | ||
|
||
declare_deps_provider( | ||
name = "benchmark_generator_provider", | ||
deps_id = "benchmark_generator", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//external:io_bazel_rules_scala/dependency/jmh/jmh_core", | ||
"//external:io_bazel_rules_scala/dependency/jmh/jmh_generator_asm", | ||
"//external:io_bazel_rules_scala/dependency/jmh/jmh_generator_reflection", | ||
"//src/java/io/bazel/rulesscala/jar", | ||
], | ||
) | ||
|
||
declare_deps_provider( | ||
name = "benchmark_generator_runtime_provider", | ||
deps_id = "benchmark_generator_runtime", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//external:io_bazel_rules_scala/dependency/jmh/org_ows2_asm_asm", | ||
], | ||
) | ||
|
||
export_toolchain_deps( | ||
name = "jmh_classpath", | ||
deps_id = "jmh_classpath", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
export_toolchain_deps( | ||
name = "jmh_core", | ||
deps_id = "jmh_core", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
export_toolchain_deps( | ||
name = "benchmark_generator", | ||
deps_id = "benchmark_generator", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
export_toolchain_deps( | ||
name = "benchmark_generator_runtime", | ||
deps_id = "benchmark_generator_runtime", | ||
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
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 = "jmh_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,36 @@ | ||
load("//scala/private/toolchain_deps:toolchain_deps.bzl", "expose_toolchain_deps") | ||
load("@io_bazel_rules_scala//scala:providers.bzl", _DepsInfo = "DepsInfo") | ||
|
||
def _jmh_toolchain_impl(ctx): | ||
toolchain = platform_common.ToolchainInfo( | ||
dep_providers = ctx.attr.dep_providers, | ||
) | ||
return [toolchain] | ||
|
||
jmh_toolchain = rule( | ||
_jmh_toolchain_impl, | ||
attrs = { | ||
"dep_providers": attr.label_list( | ||
default = [ | ||
"@io_bazel_rules_scala//jmh:jmh_classpath_provider", | ||
"@io_bazel_rules_scala//jmh:jmh_core_provider", | ||
"@io_bazel_rules_scala//jmh:benchmark_generator_provider", | ||
"@io_bazel_rules_scala//jmh:benchmark_generator_runtime_provider", | ||
], | ||
providers = [_DepsInfo], | ||
), | ||
}, | ||
) | ||
|
||
def _export_toolchain_deps_impl(ctx): | ||
return expose_toolchain_deps(ctx, "@io_bazel_rules_scala//jmh/toolchain:jmh_toolchain_type") | ||
|
||
export_toolchain_deps = rule( | ||
_export_toolchain_deps_impl, | ||
attrs = { | ||
"deps_id": attr.string( | ||
mandatory = True, | ||
), | ||
}, | ||
toolchains = ["@io_bazel_rules_scala//jmh/toolchain:jmh_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