From 6a35fb514653dc8ae64e5633575643d37514e1e7 Mon Sep 17 00:00:00 2001 From: Long Cao Date: Fri, 16 Aug 2019 22:17:06 -0400 Subject: [PATCH 1/5] move scala_test rule to its own file --- scala/private/common_attributes.bzl | 14 +++ scala/private/rule_impls.bzl | 130 +------------------ scala/private/rules/scala_test.bzl | 189 ++++++++++++++++++++++++++++ scala/scala.bzl | 66 +--------- 4 files changed, 214 insertions(+), 185 deletions(-) create mode 100644 scala/private/rules/scala_test.bzl diff --git a/scala/private/common_attributes.bzl b/scala/private/common_attributes.bzl index 8a3e4b50b..123bbdf7f 100644 --- a/scala/private/common_attributes.bzl +++ b/scala/private/common_attributes.bzl @@ -135,3 +135,17 @@ resolve_deps = { allow_files = False, ), } + +test_resolve_deps = { + "_scala_toolchain": attr.label_list( + default = [ + Label( + "//external:io_bazel_rules_scala/dependency/scala/scala_library", + ), + Label( + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", + ), + ], + allow_files = False, + ), +} diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 139ff8029..79353118f 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -127,7 +127,7 @@ touch {statsfile} arguments = [], ) -def _expand_location(ctx, flags): +def expand_location(ctx, flags): if hasattr(ctx.attr, "data"): data = ctx.attr.data else: @@ -138,7 +138,7 @@ def _join_path(args, sep = ","): return sep.join([f.path for f in args]) # Return the first non-empty arg. If all are empty, return the last. -def _first_non_empty(*args): +def first_non_empty(*args): for arg in args: if arg: return arg @@ -307,7 +307,7 @@ StatsfileOutput: {statsfile_output} # scalac_jvm_flags passed in on the target override scalac_jvm_flags passed in on the # toolchain - final_scalac_jvm_flags = _first_non_empty( + final_scalac_jvm_flags = first_non_empty( scalac_jvm_flags, ctx.toolchains["@io_bazel_rules_scala//scala:toolchain_type"].scalac_jvm_flags ) @@ -330,7 +330,7 @@ StatsfileOutput: {statsfile_output} # consume the flags on startup. arguments = [ "--jvm_flag=%s" % f - for f in _expand_location(ctx, final_scalac_jvm_flags) + for f in expand_location(ctx, final_scalac_jvm_flags) ] + ["@" + argfile.path], ) @@ -372,7 +372,7 @@ def try_to_compile_java_jar( source_jars = all_srcjars.to_list(), source_files = java_srcs, output = full_java_jar, - javac_opts = _expand_location( + javac_opts = expand_location( ctx, ctx.attr.javacopts + ctx.attr.javac_jvm_flags + java_common.default_javac_opts( @@ -1079,126 +1079,6 @@ trap finish EXIT return out -def _scala_test_flags(ctx): - # output report test duration - flags = "-oD" - if ctx.attr.full_stacktraces: - flags += "F" - else: - flags += "S" - if not ctx.attr.colors: - flags += "W" - return flags - -def scala_test_impl(ctx): - if len(ctx.attr.suites) != 0: - print("suites attribute is deprecated. All scalatest test suites are run") - - scalac_provider = get_scalac_provider(ctx) - - unused_dependency_checker_mode = get_unused_dependency_checker_mode(ctx) - unused_dependency_checker_ignored_targets = [ - target.label - for target in scalac_provider.default_classpath + - ctx.attr.unused_dependency_checker_ignored_targets - ] - unused_dependency_checker_is_off = unused_dependency_checker_mode == "off" - - scalatest_base_classpath = scalac_provider.default_classpath + [ctx.attr._scalatest] - jars = collect_jars_from_common_ctx( - ctx, - scalatest_base_classpath, - extra_runtime_deps = [ - ctx.attr._scalatest_reporter, - ctx.attr._scalatest_runner, - ], - unused_dependency_checker_is_off = unused_dependency_checker_is_off, - ) - ( - cjars, - transitive_rjars, - transitive_compile_jars, - jars_to_labels, - ) = ( - jars.compile_jars, - jars.transitive_runtime_jars, - jars.transitive_compile_jars, - jars.jars2labels, - ) - - args = "\n".join([ - "-R", - ctx.outputs.jar.short_path, - _scala_test_flags(ctx), - "-C", - "io.bazel.rules.scala.JUnitXmlReporter", - ]) - - argsFile = ctx.actions.declare_file("%s.args" % ctx.label.name) - ctx.actions.write(argsFile, args) - - executable = declare_executable(ctx) - - wrapper = write_java_wrapper(ctx, "", "") - out = scala_binary_common( - ctx, - executable, - cjars, - transitive_rjars, - transitive_compile_jars, - jars_to_labels, - wrapper, - unused_dependency_checker_ignored_targets = - unused_dependency_checker_ignored_targets, - unused_dependency_checker_mode = unused_dependency_checker_mode, - runfiles_ext = [argsFile], - deps_providers = jars.deps_providers, - ) - - rjars = out.transitive_rjars - - coverage_runfiles = [] - if ctx.configuration.coverage_enabled and _coverage_replacements_provider.is_enabled(ctx): - coverage_replacements = _coverage_replacements_provider.from_ctx( - ctx, - base = out.coverage.replacements, - ).replacements - - rjars = depset([ - coverage_replacements[jar] if jar in coverage_replacements else jar - for jar in rjars.to_list() - ]) - coverage_runfiles = ctx.files._jacocorunner + ctx.files._lcov_merger + coverage_replacements.values() - - # jvm_flags passed in on the target override scala_test_jvm_flags passed in on the - # toolchain - final_jvm_flags = _first_non_empty( - ctx.attr.jvm_flags, - ctx.toolchains["@io_bazel_rules_scala//scala:toolchain_type"].scala_test_jvm_flags - ) - - coverage_runfiles.extend(write_executable( - ctx = ctx, - executable = executable, - jvm_flags = [ - "-DRULES_SCALA_MAIN_WS_NAME=%s" % ctx.workspace_name, - "-DRULES_SCALA_ARGS_FILE=%s" % argsFile.short_path, - ] + _expand_location(ctx, final_jvm_flags), - main_class = ctx.attr.main_class, - rjars = rjars, - use_jacoco = ctx.configuration.coverage_enabled, - wrapper = wrapper, - )) - - return struct( - executable = executable, - files = out.files, - instrumented_files = out.instrumented_files, - providers = out.providers, - runfiles = ctx.runfiles(coverage_runfiles, transitive_files = out.runfiles.files), - scala = out.scala, - ) - def _gen_test_suite_flags_based_on_prefixes_and_suffixes(ctx, archives): return struct( archiveFlag = "-Dbazel.discover.classes.archives.file.paths=%s" % diff --git a/scala/private/rules/scala_test.bzl b/scala/private/rules/scala_test.bzl new file mode 100644 index 000000000..ec3d8d3c3 --- /dev/null +++ b/scala/private/rules/scala_test.bzl @@ -0,0 +1,189 @@ +load( + "@io_bazel_rules_scala//scala/private:common_attributes.bzl", + "common_attrs", + "implicit_deps", + "launcher_template", + "test_resolve_deps", +) +load("@io_bazel_rules_scala//scala/private:common_outputs.bzl", "common_outputs") +load( + "@io_bazel_rules_scala//scala/private:coverage_replacements_provider.bzl", + _coverage_replacements_provider = "coverage_replacements_provider", +) +load( + "@io_bazel_rules_scala//scala/private:rule_impls.bzl", + "collect_jars_from_common_ctx", + "declare_executable", + "expand_location", + "first_non_empty", + "get_scalac_provider", + "get_unused_dependency_checker_mode", + "scala_binary_common", + "write_executable", + "write_java_wrapper", +) + +def _scala_test_flags(ctx): + # output report test duration + flags = "-oD" + if ctx.attr.full_stacktraces: + flags += "F" + else: + flags += "S" + if not ctx.attr.colors: + flags += "W" + return flags + +def _scala_test_impl(ctx): + if len(ctx.attr.suites) != 0: + print("suites attribute is deprecated. All scalatest test suites are run") + + scalac_provider = get_scalac_provider(ctx) + + unused_dependency_checker_mode = get_unused_dependency_checker_mode(ctx) + unused_dependency_checker_ignored_targets = [ + target.label + for target in scalac_provider.default_classpath + + ctx.attr.unused_dependency_checker_ignored_targets + ] + unused_dependency_checker_is_off = unused_dependency_checker_mode == "off" + + scalatest_base_classpath = scalac_provider.default_classpath + [ctx.attr._scalatest] + jars = collect_jars_from_common_ctx( + ctx, + scalatest_base_classpath, + extra_runtime_deps = [ + ctx.attr._scalatest_reporter, + ctx.attr._scalatest_runner, + ], + unused_dependency_checker_is_off = unused_dependency_checker_is_off, + ) + ( + cjars, + transitive_rjars, + transitive_compile_jars, + jars_to_labels, + ) = ( + jars.compile_jars, + jars.transitive_runtime_jars, + jars.transitive_compile_jars, + jars.jars2labels, + ) + + args = "\n".join([ + "-R", + ctx.outputs.jar.short_path, + _scala_test_flags(ctx), + "-C", + "io.bazel.rules.scala.JUnitXmlReporter", + ]) + + argsFile = ctx.actions.declare_file("%s.args" % ctx.label.name) + ctx.actions.write(argsFile, args) + + executable = declare_executable(ctx) + + wrapper = write_java_wrapper(ctx, "", "") + out = scala_binary_common( + ctx, + executable, + cjars, + transitive_rjars, + transitive_compile_jars, + jars_to_labels, + wrapper, + unused_dependency_checker_ignored_targets = + unused_dependency_checker_ignored_targets, + unused_dependency_checker_mode = unused_dependency_checker_mode, + runfiles_ext = [argsFile], + deps_providers = jars.deps_providers, + ) + + rjars = out.transitive_rjars + + coverage_runfiles = [] + if ctx.configuration.coverage_enabled and _coverage_replacements_provider.is_enabled(ctx): + coverage_replacements = _coverage_replacements_provider.from_ctx( + ctx, + base = out.coverage.replacements, + ).replacements + + rjars = depset([ + coverage_replacements[jar] if jar in coverage_replacements else jar + for jar in rjars.to_list() + ]) + coverage_runfiles = ctx.files._jacocorunner + ctx.files._lcov_merger + coverage_replacements.values() + + # jvm_flags passed in on the target override scala_test_jvm_flags passed in on the + # toolchain + final_jvm_flags = first_non_empty( + ctx.attr.jvm_flags, + ctx.toolchains["@io_bazel_rules_scala//scala:toolchain_type"].scala_test_jvm_flags, + ) + + coverage_runfiles.extend(write_executable( + ctx = ctx, + executable = executable, + jvm_flags = [ + "-DRULES_SCALA_MAIN_WS_NAME=%s" % ctx.workspace_name, + "-DRULES_SCALA_ARGS_FILE=%s" % argsFile.short_path, + ] + expand_location(ctx, final_jvm_flags), + main_class = ctx.attr.main_class, + rjars = rjars, + use_jacoco = ctx.configuration.coverage_enabled, + wrapper = wrapper, + )) + + return struct( + executable = executable, + files = out.files, + instrumented_files = out.instrumented_files, + providers = out.providers, + runfiles = ctx.runfiles(coverage_runfiles, transitive_files = out.runfiles.files), + scala = out.scala, + ) + +_scala_test_attrs = { + "main_class": attr.string( + default = "io.bazel.rulesscala.scala_test.Runner", + ), + "suites": attr.string_list(), + "colors": attr.bool(default = True), + "full_stacktraces": attr.bool(default = True), + "_scalatest": attr.label( + default = Label( + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", + ), + ), + "_scalatest_runner": attr.label( + cfg = "host", + default = Label("//src/java/io/bazel/rulesscala/scala_test:runner"), + ), + "_scalatest_reporter": attr.label( + default = Label("//scala/support:test_reporter"), + ), + "_jacocorunner": attr.label( + default = Label("@bazel_tools//tools/jdk:JacocoCoverage"), + ), + "_lcov_merger": attr.label( + default = Label("@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main"), + ), +} + +_scala_test_attrs.update(launcher_template) + +_scala_test_attrs.update(implicit_deps) + +_scala_test_attrs.update(common_attrs) + +_scala_test_attrs.update(test_resolve_deps) + +scala_test = rule( + attrs = _scala_test_attrs, + executable = True, + fragments = ["java"], + outputs = common_outputs, + test = True, + toolchains = ["@io_bazel_rules_scala//scala:toolchain_type"], + implementation = _scala_test_impl, +) diff --git a/scala/scala.bzl b/scala/scala.bzl index 41de07e2f..4adeb368f 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -5,7 +5,6 @@ load( _scala_library_impl = "scala_library_impl", _scala_macro_library_impl = "scala_macro_library_impl", _scala_repl_impl = "scala_repl_impl", - _scala_test_impl = "scala_test_impl", ) load( "@io_bazel_rules_scala//scala/private:common_attributes.bzl", @@ -40,20 +39,10 @@ load( "@io_bazel_rules_scala//scala/private:rules/scala_doc.bzl", _scala_doc = "scala_doc", ) - -_test_resolve_deps = { - "_scala_toolchain": attr.label_list( - default = [ - Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_library", - ), - Label( - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", - ), - ], - allow_files = False, - ), -} +load( + "@io_bazel_rules_scala//scala/private:rules/scala_test.bzl", + _scala_test = "scala_test", +) _junit_resolve_deps = { "_scala_toolchain": attr.label_list( @@ -152,51 +141,6 @@ scala_macro_library = rule( implementation = _scala_macro_library_impl, ) -_scala_test_attrs = { - "main_class": attr.string( - default = "io.bazel.rulesscala.scala_test.Runner", - ), - "suites": attr.string_list(), - "colors": attr.bool(default = True), - "full_stacktraces": attr.bool(default = True), - "_scalatest": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", - ), - ), - "_scalatest_runner": attr.label( - cfg = "host", - default = Label("//src/java/io/bazel/rulesscala/scala_test:runner"), - ), - "_scalatest_reporter": attr.label( - default = Label("//scala/support:test_reporter"), - ), - "_jacocorunner": attr.label( - default = Label("@bazel_tools//tools/jdk:JacocoCoverage"), - ), - "_lcov_merger": attr.label( - default = Label("@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main"), - ), -} - -_scala_test_attrs.update(launcher_template) - -_scala_test_attrs.update(implicit_deps) - -_scala_test_attrs.update(common_attrs) - -_scala_test_attrs.update(_test_resolve_deps) - -scala_test = rule( - attrs = _scala_test_attrs, - executable = True, - fragments = ["java"], - outputs = common_outputs, - test = True, - toolchains = ["@io_bazel_rules_scala//scala:toolchain_type"], - implementation = _scala_test_impl, -) - _scala_repl_attrs = {} _scala_repl_attrs.update(launcher_template) @@ -348,3 +292,5 @@ scala_binary = _scala_binary scala_doc = _scala_doc scala_repositories = _scala_repositories + +scala_test = _scala_test From b6fdea671c09e164bf44f47fab6adf6bda35cfd2 Mon Sep 17 00:00:00 2001 From: Long Cao Date: Fri, 16 Aug 2019 22:25:35 -0400 Subject: [PATCH 2/5] move scala_test_suite to scala_test.bzl, move sanitize_string_for_usage function to common.bzl for now --- scala/private/common.bzl | 10 +++++++ scala/private/rules/scala_test.bzl | 24 +++++++++++++++++ scala/scala.bzl | 42 ++++-------------------------- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/scala/private/common.bzl b/scala/private/common.bzl index e449178c6..ce5a4477c 100644 --- a/scala/private/common.bzl +++ b/scala/private/common.bzl @@ -162,3 +162,13 @@ def _provider_of_dependency_label_of(dependency, path): return dependency[JarsToLabelsInfo].jars_to_labels.get(path) else: return None + +def sanitize_string_for_usage(s): + res_array = [] + for idx in range(len(s)): + c = s[idx] + if c.isalnum() or c == ".": + res_array.append(c) + else: + res_array.append("_") + return "".join(res_array) diff --git a/scala/private/rules/scala_test.bzl b/scala/private/rules/scala_test.bzl index ec3d8d3c3..0255173d9 100644 --- a/scala/private/rules/scala_test.bzl +++ b/scala/private/rules/scala_test.bzl @@ -5,6 +5,7 @@ load( "launcher_template", "test_resolve_deps", ) +load("@io_bazel_rules_scala//scala/private:common.bzl", "sanitize_string_for_usage") load("@io_bazel_rules_scala//scala/private:common_outputs.bzl", "common_outputs") load( "@io_bazel_rules_scala//scala/private:coverage_replacements_provider.bzl", @@ -187,3 +188,26 @@ scala_test = rule( toolchains = ["@io_bazel_rules_scala//scala:toolchain_type"], implementation = _scala_test_impl, ) + +# This auto-generates a test suite based on the passed set of targets +# we will add a root test_suite with the name of the passed name +def scala_test_suite( + name, + srcs = [], + visibility = None, + use_short_names = False, + **kwargs): + ts = [] + i = 0 + for test_file in srcs: + i = i + 1 + n = ("%s_%s" % (name, i)) if use_short_names else ("%s_test_suite_%s" % (name, sanitize_string_for_usage(test_file))) + scala_test( + name = n, + srcs = [test_file], + visibility = visibility, + unused_dependency_checker_mode = "off", + **kwargs + ) + ts.append(n) + native.test_suite(name = name, tests = ts, visibility = visibility) diff --git a/scala/scala.bzl b/scala/scala.bzl index 4adeb368f..60ce05678 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -14,6 +14,7 @@ load( "launcher_template", "resolve_deps", ) +load("@io_bazel_rules_scala//scala/private:common.bzl", "sanitize_string_for_usage") load("@io_bazel_rules_scala//scala/private:common_outputs.bzl", "common_outputs") load( "@io_bazel_rules_scala//scala/private:coverage_replacements_provider.bzl", @@ -42,6 +43,7 @@ load( load( "@io_bazel_rules_scala//scala/private:rules/scala_test.bzl", _scala_test = "scala_test", + _scala_test_suite = "scala_test_suite", ) _junit_resolve_deps = { @@ -160,39 +162,6 @@ scala_repl = rule( implementation = _scala_repl_impl, ) -def _sanitize_string_for_usage(s): - res_array = [] - for idx in range(len(s)): - c = s[idx] - if c.isalnum() or c == ".": - res_array.append(c) - else: - res_array.append("_") - return "".join(res_array) - -# This auto-generates a test suite based on the passed set of targets -# we will add a root test_suite with the name of the passed name -def scala_test_suite( - name, - srcs = [], - visibility = None, - use_short_names = False, - **kwargs): - ts = [] - i = 0 - for test_file in srcs: - i = i + 1 - n = ("%s_%s" % (name, i)) if use_short_names else ("%s_test_suite_%s" % (name, _sanitize_string_for_usage(test_file))) - scala_test( - name = n, - srcs = [test_file], - visibility = visibility, - unused_dependency_checker_mode = "off", - **kwargs - ) - ts.append(n) - native.test_suite(name = name, tests = ts, visibility = visibility) - # Scala library suite generates a series of scala libraries # then it depends on them with a meta one which exports all the sub targets def scala_library_suite( @@ -203,7 +172,7 @@ def scala_library_suite( **kwargs): ts = [] for src_file in srcs: - n = "%s_lib_%s" % (name, _sanitize_string_for_usage(src_file)) + n = "%s_lib_%s" % (name, sanitize_string_for_usage(src_file)) scala_library( name = n, srcs = [src_file], @@ -287,10 +256,9 @@ def scala_specs2_junit_test(name, **kwargs): **kwargs ) +# Re-export private rules for public consumption scala_binary = _scala_binary - scala_doc = _scala_doc - scala_repositories = _scala_repositories - scala_test = _scala_test +scala_test_suite = _scala_test_suite From 609c42f109a4be724f1f18779d2489f97cc2b078 Mon Sep 17 00:00:00 2001 From: Long Cao Date: Sat, 17 Aug 2019 12:56:10 -0400 Subject: [PATCH 3/5] add a docstring about scala_test.bzl --- scala/private/rules/scala_test.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scala/private/rules/scala_test.bzl b/scala/private/rules/scala_test.bzl index 0255173d9..118df202e 100644 --- a/scala/private/rules/scala_test.bzl +++ b/scala/private/rules/scala_test.bzl @@ -1,3 +1,5 @@ +"""Rules for writing tests with ScalaTest""" + load( "@io_bazel_rules_scala//scala/private:common_attributes.bzl", "common_attrs", From 6a30189791986803d7335f622bb4c2c86d552ee3 Mon Sep 17 00:00:00 2001 From: Long Cao Date: Sat, 17 Aug 2019 15:10:39 -0400 Subject: [PATCH 4/5] move test_resolve_deps to private variable in scala_test.bzl --- scala/private/common_attributes.bzl | 14 -------------- scala/private/rules/scala_test.bzl | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/scala/private/common_attributes.bzl b/scala/private/common_attributes.bzl index 123bbdf7f..8a3e4b50b 100644 --- a/scala/private/common_attributes.bzl +++ b/scala/private/common_attributes.bzl @@ -135,17 +135,3 @@ resolve_deps = { allow_files = False, ), } - -test_resolve_deps = { - "_scala_toolchain": attr.label_list( - default = [ - Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_library", - ), - Label( - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", - ), - ], - allow_files = False, - ), -} diff --git a/scala/private/rules/scala_test.bzl b/scala/private/rules/scala_test.bzl index 118df202e..a1f0f352e 100644 --- a/scala/private/rules/scala_test.bzl +++ b/scala/private/rules/scala_test.bzl @@ -5,7 +5,6 @@ load( "common_attrs", "implicit_deps", "launcher_template", - "test_resolve_deps", ) load("@io_bazel_rules_scala//scala/private:common.bzl", "sanitize_string_for_usage") load("@io_bazel_rules_scala//scala/private:common_outputs.bzl", "common_outputs") @@ -173,13 +172,27 @@ _scala_test_attrs = { ), } +_test_resolve_deps = { + "_scala_toolchain": attr.label_list( + default = [ + Label( + "//external:io_bazel_rules_scala/dependency/scala/scala_library", + ), + Label( + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", + ), + ], + allow_files = False, + ), +} + _scala_test_attrs.update(launcher_template) _scala_test_attrs.update(implicit_deps) _scala_test_attrs.update(common_attrs) -_scala_test_attrs.update(test_resolve_deps) +_scala_test_attrs.update(_test_resolve_deps) scala_test = rule( attrs = _scala_test_attrs, From 9a69e3823376f74a01c52b2542c65476b79f3071 Mon Sep 17 00:00:00 2001 From: Long Cao Date: Sun, 18 Aug 2019 10:36:35 -0400 Subject: [PATCH 5/5] remove suites attribute debug print --- scala/private/rules/scala_test.bzl | 3 --- 1 file changed, 3 deletions(-) diff --git a/scala/private/rules/scala_test.bzl b/scala/private/rules/scala_test.bzl index a1f0f352e..0d10c355e 100644 --- a/scala/private/rules/scala_test.bzl +++ b/scala/private/rules/scala_test.bzl @@ -37,9 +37,6 @@ def _scala_test_flags(ctx): return flags def _scala_test_impl(ctx): - if len(ctx.attr.suites) != 0: - print("suites attribute is deprecated. All scalatest test suites are run") - scalac_provider = get_scalac_provider(ctx) unused_dependency_checker_mode = get_unused_dependency_checker_mode(ctx)