diff --git a/rules/scala.bzl b/rules/scala.bzl index f74bbc70..0fa4a5f6 100644 --- a/rules/scala.bzl +++ b/rules/scala.bzl @@ -33,11 +33,6 @@ load( _scala_import_implementation = "scala_import_implementation", _scala_import_private_attributes = "scala_import_private_attributes", ) -load( - "//rules/scala:private/provider.bzl", - _configure_bootstrap_scala_implementation = "configure_bootstrap_scala_implementation", - _configure_zinc_scala_implementation = "configure_zinc_scala_implementation", -) load( "//rules/scala:private/repl.bzl", _scala_repl_implementation = "scala_repl_implementation", @@ -473,112 +468,3 @@ Generates Scaladocs. "@bazel_tools//tools/jdk:toolchain_type", ], ) - -## -## core/underlying rules and configuration ## -## - -configure_bootstrap_scala = rule( - attrs = { - "compiler_classpath": attr.label_list( - mandatory = True, - providers = [JavaInfo], - ), - "global_plugins": attr.label_list( - doc = "Scalac plugins that will always be enabled.", - providers = [JavaInfo], - ), - "global_scalacopts": attr.string_list( - doc = "Scalac options that will always be enabled.", - ), - "runtime_classpath": attr.label_list( - mandatory = True, - providers = [JavaInfo], - ), - "semanticdb_bundle": attr.bool( - default = True, - doc = "Whether to bundle SemanticDB files in the resulting JAR. Note that in Scala 2, this requires the SemanticDB compiler plugin.", - ), - "use_ijar": attr.bool( - doc = "Whether to use ijars for this compiler.", - default = True, - ), - "version": attr.string(mandatory = True), - }, - implementation = _configure_bootstrap_scala_implementation, -) - -_configure_zinc_scala = rule( - attrs = { - "compiler_bridge": attr.label( - allow_single_file = True, - mandatory = True, - ), - "compiler_classpath": attr.label_list( - mandatory = True, - providers = [JavaInfo], - ), - "deps_direct": attr.string(default = "error"), - "deps_used": attr.string(default = "error"), - "global_plugins": attr.label_list( - doc = "Scalac plugins that will always be enabled.", - providers = [JavaInfo], - ), - "global_scalacopts": attr.string_list( - doc = "Scalac options that will always be enabled.", - ), - "incremental": attr.bool( - doc = "Whether Zinc's incremental compilation will be available for this Zinc compiler. If True, this requires additional configuration to use incremental compilation.", - default = False, - ), - "log_level": attr.string( - doc = "Compiler log level", - default = "warn", - ), - "runtime_classpath": attr.label_list( - mandatory = True, - providers = [JavaInfo], - ), - "semanticdb_bundle": attr.bool( - default = True, - doc = "Whether to bundle SemanticDB files in the resulting JAR. Note that in Scala 2, this requires the SemanticDB compiler plugin.", - ), - "use_ijar": attr.bool( - doc = "Whether to use ijars for this compiler.", - default = True, - ), - "version": attr.string(mandatory = True), - "_code_coverage_instrumentation_worker": attr.label( - default = "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/workers/jacoco/instrumenter", - allow_files = True, - executable = True, - cfg = "host", - ), - "_compile_worker": attr.label( - default = "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/workers/zinc/compile", - allow_files = True, - executable = True, - cfg = "host", - ), - "_deps_worker": attr.label( - default = "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/workers/deps", - allow_files = True, - executable = True, - cfg = "host", - ), - }, - implementation = _configure_zinc_scala_implementation, -) - -def configure_zinc_scala(**kwargs): - _configure_zinc_scala( - deps_direct = select({ - "@rules_scala_annex//src/main/scala:deps_direct_off": "off", - "//conditions:default": "error", - }), - deps_used = select({ - "@rules_scala_annex//src/main/scala:deps_used_off": "off", - "//conditions:default": "error", - }), - **kwargs - ) diff --git a/rules/scala/private/provider.bzl b/rules/scala/private/provider.bzl deleted file mode 100644 index f377e308..00000000 --- a/rules/scala/private/provider.bzl +++ /dev/null @@ -1,67 +0,0 @@ -load( - "@rules_scala_annex//rules:providers.bzl", - _CodeCoverageConfiguration = "CodeCoverageConfiguration", - _DepsConfiguration = "DepsConfiguration", - _ScalaConfiguration = "ScalaConfiguration", - _ScalaRulePhase = "ScalaRulePhase", - _ZincConfiguration = "ZincConfiguration", -) -load( - "//rules/private:phases.bzl", - _phase_bootstrap_compile = "phase_bootstrap_compile", - _phase_semanticdb = "phase_semanticdb", - _phase_zinc_compile = "phase_zinc_compile", - _phase_zinc_depscheck = "phase_zinc_depscheck", -) - -def configure_bootstrap_scala_implementation(ctx): - return [ - _ScalaConfiguration( - compiler_classpath = ctx.attr.compiler_classpath, - global_plugins = ctx.attr.global_plugins, - global_scalacopts = ctx.attr.global_scalacopts, - runtime_classpath = ctx.attr.runtime_classpath, - semanticdb_bundle = ctx.attr.semanticdb_bundle, - use_ijar = ctx.attr.use_ijar, - version = ctx.attr.version, - ), - _ScalaRulePhase( - phases = [ - ("=", "compile", "compile", _phase_bootstrap_compile), - ], - ), - ] - -def configure_zinc_scala_implementation(ctx): - return [ - _ScalaConfiguration( - compiler_classpath = ctx.attr.compiler_classpath, - global_plugins = ctx.attr.global_plugins, - global_scalacopts = ctx.attr.global_scalacopts, - runtime_classpath = ctx.attr.runtime_classpath, - semanticdb_bundle = ctx.attr.semanticdb_bundle, - use_ijar = ctx.attr.use_ijar, - version = ctx.attr.version, - ), - _CodeCoverageConfiguration( - instrumentation_worker = ctx.attr._code_coverage_instrumentation_worker, - ), - _ZincConfiguration( - compile_worker = ctx.attr._compile_worker, - compiler_bridge = ctx.file.compiler_bridge, - log_level = ctx.attr.log_level, - incremental = ctx.attr.incremental, - ), - _DepsConfiguration( - direct = ctx.attr.deps_direct, - used = ctx.attr.deps_used, - worker = ctx.attr._deps_worker, - ), - _ScalaRulePhase( - phases = [ - ("=", "compile", "compile", _phase_zinc_compile), - ("-", "compile", "semanticdb", _phase_semanticdb), - ("+", "compile", "depscheck", _phase_zinc_depscheck), - ], - ), - ]