Skip to content

Move code from rule impls/common to phases #930

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

Merged
merged 17 commits into from
Jan 17, 2020
Merged
Changes from 1 commit
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
12 changes: 8 additions & 4 deletions scala/private/phases/phase_compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ load(
_adjust_resources_path_by_default_prefixes = "adjust_resources_path_by_default_prefixes",
_compile_scala = "compile_scala",
_expand_location = "expand_location",
_get_scalac_provider = "get_scalac_provider",
)

_java_extension = ".java"
Expand Down Expand Up @@ -142,6 +141,7 @@ def _phase_compile(
transitive_compile_jars = p.collect_jars.transitive_compile_jars
jars2labels = p.collect_jars.jars2labels.jars_to_labels
deps_providers = p.collect_jars.deps_providers
default_classpath = p.scalac_provider.default_classpath

out = _compile_or_empty(
ctx,
Expand All @@ -155,6 +155,7 @@ def _phase_compile(
unused_dependency_checker_mode,
unused_dependency_checker_ignored_targets,
deps_providers,
default_classpath,
)

# TODO: simplify the return values and use provider
Expand All @@ -181,7 +182,8 @@ def _compile_or_empty(
implicit_junit_deps_needed_for_java_compilation,
unused_dependency_checker_mode,
unused_dependency_checker_ignored_targets,
deps_providers):
deps_providers,
default_classpath):
# We assume that if a srcjar is present, it is not empty
if len(ctx.files.srcs) + len(srcjars.to_list()) == 0:
_build_nosrc_jar(ctx)
Expand Down Expand Up @@ -271,6 +273,7 @@ def _compile_or_empty(
all_srcjars,
java_srcs,
implicit_junit_deps_needed_for_java_compilation,
default_classpath,
)

full_jars = [ctx.outputs.jar]
Expand Down Expand Up @@ -429,7 +432,8 @@ def _try_to_compile_java_jar(
scala_output,
all_srcjars,
java_srcs,
implicit_junit_deps_needed_for_java_compilation):
implicit_junit_deps_needed_for_java_compilation,
default_classpath):
if not java_srcs and (not (all_srcjars and ctx.attr.expect_java_output)):
return False

Expand All @@ -438,7 +442,7 @@ def _try_to_compile_java_jar(
implicit_junit_deps_needed_for_java_compilation,
)
providers_of_dependencies += _collect_java_providers_of(
_get_scalac_provider(ctx).default_classpath,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note this is possibly the only interesting change in this PR since it moves something from a method call to taking it from a previous phase and still I'm confident

default_classpath,
)
scala_sources_java_provider = _interim_java_provider_for_java_compilation(
scala_output,
Expand Down