Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename phases logically #953

Merged
merged 1 commit into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions scala/private/phases/phase_collect_jars.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ load(
"collect_jars",
)

def phase_scalatest_collect_jars(ctx, p):
def phase_collect_jars_scalatest(ctx, p):
args = struct(
base_classpath = p.scalac_provider.default_classpath + [ctx.attr._scalatest],
extra_runtime_deps = [
ctx.attr._scalatest_reporter,
ctx.attr._scalatest_runner,
],
)
return _phase_default_collect_jars(ctx, p, args)
return _phase_collect_jars_default(ctx, p, args)

def phase_repl_collect_jars(ctx, p):
def phase_collect_jars_repl(ctx, p):
args = struct(
base_classpath = p.scalac_provider.default_repl_classpath,
)
return _phase_default_collect_jars(ctx, p, args)
return _phase_collect_jars_default(ctx, p, args)

def phase_macro_library_collect_jars(ctx, p):
def phase_collect_jars_macro_library(ctx, p):
args = struct(
base_classpath = p.scalac_provider.default_macro_classpath,
)
return _phase_default_collect_jars(ctx, p, args)
return _phase_collect_jars_default(ctx, p, args)

def phase_junit_test_collect_jars(ctx, p):
def phase_collect_jars_junit_test(ctx, p):
args = struct(
extra_deps = [
ctx.attr._junit,
Expand All @@ -44,18 +44,18 @@ def phase_junit_test_collect_jars(ctx, p):
ctx.attr._bazel_test_runner,
],
)
return _phase_default_collect_jars(ctx, p, args)
return _phase_collect_jars_default(ctx, p, args)

def phase_library_for_plugin_bootstrapping_collect_jars(ctx, p):
def phase_collect_jars_library_for_plugin_bootstrapping(ctx, p):
args = struct(
unused_dependency_checker_mode = "off",
)
return _phase_default_collect_jars(ctx, p, args)
return _phase_collect_jars_default(ctx, p, args)

def phase_common_collect_jars(ctx, p):
return _phase_default_collect_jars(ctx, p)
def phase_collect_jars_common(ctx, p):
return _phase_collect_jars_default(ctx, p)

def _phase_default_collect_jars(ctx, p, _args = struct()):
def _phase_collect_jars_default(ctx, p, _args = struct()):
return _phase_collect_jars(
ctx,
_args.base_classpath if hasattr(_args, "base_classpath") else p.scalac_provider.default_classpath,
Expand Down
34 changes: 17 additions & 17 deletions scala/private/phases/phase_compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _empty_coverage_struct = struct(
replacements = {},
)

def phase_binary_compile(ctx, p):
def phase_compile_binary(ctx, p):
args = struct(
buildijar = False,
unused_dependency_checker_ignored_targets = [
Expand All @@ -37,9 +37,9 @@ def phase_binary_compile(ctx, p):
ctx.attr.unused_dependency_checker_ignored_targets
],
)
return _phase_default_compile(ctx, p, args)
return _phase_compile_default(ctx, p, args)

def phase_library_compile(ctx, p):
def phase_compile_library(ctx, p):
args = struct(
srcjars = p.collect_srcjars,
unused_dependency_checker_ignored_targets = [
Expand All @@ -48,19 +48,19 @@ def phase_library_compile(ctx, p):
ctx.attr.unused_dependency_checker_ignored_targets
],
)
return _phase_default_compile(ctx, p, args)
return _phase_compile_default(ctx, p, args)

def phase_library_for_plugin_bootstrapping_compile(ctx, p):
def phase_compile_library_for_plugin_bootstrapping(ctx, p):
args = struct(
unused_dependency_checker_ignored_targets = [
target.label
for target in p.scalac_provider.default_classpath + ctx.attr.exports
],
unused_dependency_checker_mode = "off",
)
return _phase_default_compile(ctx, p, args)
return _phase_compile_default(ctx, p, args)

def phase_macro_library_compile(ctx, p):
def phase_compile_macro_library(ctx, p):
args = struct(
buildijar = False,
unused_dependency_checker_ignored_targets = [
Expand All @@ -69,9 +69,9 @@ def phase_macro_library_compile(ctx, p):
ctx.attr.unused_dependency_checker_ignored_targets
],
)
return _phase_default_compile(ctx, p, args)
return _phase_compile_default(ctx, p, args)

def phase_junit_test_compile(ctx, p):
def phase_compile_junit_test(ctx, p):
args = struct(
buildijar = False,
implicit_junit_deps_needed_for_java_compilation = [
Expand All @@ -89,9 +89,9 @@ def phase_junit_test_compile(ctx, p):
ctx.attr._bazel_test_runner.label,
],
)
return _phase_default_compile(ctx, p, args)
return _phase_compile_default(ctx, p, args)

def phase_repl_compile(ctx, p):
def phase_compile_repl(ctx, p):
args = struct(
buildijar = False,
unused_dependency_checker_ignored_targets = [
Expand All @@ -100,9 +100,9 @@ def phase_repl_compile(ctx, p):
ctx.attr.unused_dependency_checker_ignored_targets
],
)
return _phase_default_compile(ctx, p, args)
return _phase_compile_default(ctx, p, args)

def phase_scalatest_compile(ctx, p):
def phase_compile_scalatest(ctx, p):
args = struct(
buildijar = False,
unused_dependency_checker_ignored_targets = [
Expand All @@ -111,12 +111,12 @@ def phase_scalatest_compile(ctx, p):
ctx.attr.unused_dependency_checker_ignored_targets
],
)
return _phase_default_compile(ctx, p, args)
return _phase_compile_default(ctx, p, args)

def phase_common_compile(ctx, p):
return _phase_default_compile(ctx, p)
def phase_compile_common(ctx, p):
return _phase_compile_default(ctx, p)

def _phase_default_compile(ctx, p, _args = struct()):
def _phase_compile_default(ctx, p, _args = struct()):
return _phase_compile(
ctx,
p,
Expand Down
6 changes: 3 additions & 3 deletions scala/private/phases/phase_default_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# DOCUMENT THIS
#
def phase_binary_default_info(ctx, p):
def phase_default_info_binary(ctx, p):
return struct(
external_providers = [
DefaultInfo(
Expand All @@ -14,7 +14,7 @@ def phase_binary_default_info(ctx, p):
],
)

def phase_library_default_info(ctx, p):
def phase_default_info_library(ctx, p):
return struct(
external_providers = [
DefaultInfo(
Expand All @@ -24,7 +24,7 @@ def phase_library_default_info(ctx, p):
],
)

def phase_scalatest_default_info(ctx, p):
def phase_default_info_scalatest(ctx, p):
return struct(
external_providers = [
DefaultInfo(
Expand Down
10 changes: 5 additions & 5 deletions scala/private/phases/phase_java_wrapper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ load(
_java_bin = "java_bin",
)

def phase_repl_java_wrapper(ctx, p):
def phase_java_wrapper_repl(ctx, p):
args = struct(
args = " ".join(ctx.attr.scalacopts),
wrapper_preamble = """
Expand All @@ -26,12 +26,12 @@ function finish() {
trap finish EXIT
""",
)
return _phase_default_java_wrapper(ctx, p, args)
return _phase_java_wrapper_default(ctx, p, args)

def phase_common_java_wrapper(ctx, p):
return _phase_default_java_wrapper(ctx, p)
def phase_java_wrapper_common(ctx, p):
return _phase_java_wrapper_default(ctx, p)

def _phase_default_java_wrapper(ctx, p, _args = struct()):
def _phase_java_wrapper_default(ctx, p, _args = struct()):
return _phase_java_wrapper(
ctx,
_args.args if hasattr(_args, "args") else "",
Expand Down
14 changes: 7 additions & 7 deletions scala/private/phases/phase_runfiles.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
#
# DOCUMENT THIS
#
def phase_library_runfiles(ctx, p):
def phase_runfiles_library(ctx, p):
args = struct(
# Using transitive_files since transitive_rjars a depset and avoiding linearization
transitive_files = p.compile.rjars,
)
return _phase_default_runfiles(ctx, p, args)
return _phase_runfiles_default(ctx, p, args)

def phase_scalatest_runfiles(ctx, p):
def phase_runfiles_scalatest(ctx, p):
args = "\n".join([
"-R",
ctx.outputs.jar.short_path,
Expand All @@ -29,12 +29,12 @@ def phase_scalatest_runfiles(ctx, p):
),
args_file = args_file,
)
return _phase_default_runfiles(ctx, p, args)
return _phase_runfiles_default(ctx, p, args)

def phase_common_runfiles(ctx, p):
return _phase_default_runfiles(ctx, p)
def phase_runfiles_common(ctx, p):
return _phase_runfiles_default(ctx, p)

def _phase_default_runfiles(ctx, p, _args = struct()):
def _phase_runfiles_default(ctx, p, _args = struct()):
return _phase_runfiles(
ctx,
_args.transitive_files if hasattr(_args, "transitive_files") else depset(
Expand Down
18 changes: 9 additions & 9 deletions scala/private/phases/phase_write_executable.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ load(
_coverage_replacements_provider = "coverage_replacements_provider",
)

def phase_scalatest_write_executable(ctx, p):
def phase_write_executable_scalatest(ctx, p):
# jvm_flags passed in on the target override scala_test_jvm_flags passed in on the
# toolchain
final_jvm_flags = first_non_empty(
Expand All @@ -31,26 +31,26 @@ def phase_scalatest_write_executable(ctx, p):
] + expand_location(ctx, final_jvm_flags),
use_jacoco = ctx.configuration.coverage_enabled,
)
return _phase_deafult_write_executable(ctx, p, args)
return _phase_write_executable_default(ctx, p, args)

def phase_repl_write_executable(ctx, p):
def phase_write_executable_repl(ctx, p):
args = struct(
jvm_flags = ["-Dscala.usejavacp=true"] + ctx.attr.jvm_flags,
main_class = "scala.tools.nsc.MainGenericRunner",
)
return _phase_deafult_write_executable(ctx, p, args)
return _phase_write_executable_default(ctx, p, args)

def phase_junit_test_write_executable(ctx, p):
def phase_write_executable_junit_test(ctx, p):
args = struct(
jvm_flags = p.jvm_flags + ctx.attr.jvm_flags,
main_class = "com.google.testing.junit.runner.BazelTestRunner",
)
return _phase_deafult_write_executable(ctx, p, args)
return _phase_write_executable_default(ctx, p, args)

def phase_common_write_executable(ctx, p):
return _phase_deafult_write_executable(ctx, p)
def phase_write_executable_common(ctx, p):
return _phase_write_executable_default(ctx, p)

def _phase_deafult_write_executable(ctx, p, _args = struct()):
def _phase_write_executable_default(ctx, p, _args = struct()):
return _phase_write_executable(
ctx,
p,
Expand Down
Loading