Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
borkaehw committed Oct 25, 2019
1 parent 1984a71 commit c6c62bd
Show file tree
Hide file tree
Showing 9 changed files with 743 additions and 612 deletions.
57 changes: 6 additions & 51 deletions scala/private/phases/phase_collect_jars.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@
#
# DOCUMENT THIS
#

# Extract very common code out from dependency analysis into single place
# automatically adds dependency on scala-library and scala-reflect
# collects jars from deps, runtime jars from runtime_deps, and
load(
"@io_bazel_rules_scala//scala/private:common.bzl",
"collect_jars",
)
load(
"@io_bazel_rules_scala//scala/private:rule_impls.bzl",
"is_dependency_analyzer_off",
"is_plus_one_deps_off",
"collect_jars_from_common_ctx",
)

def phase_test_collect_jars(ctx, p):
Expand Down Expand Up @@ -71,46 +62,10 @@ def _phase_collect_jars(
extra_deps,
extra_runtime_deps,
unused_dependency_checker_mode):
dependency_analyzer_is_off = is_dependency_analyzer_off(ctx)

deps_jars = collect_jars(
ctx.attr.deps + extra_deps + base_classpath,
dependency_analyzer_is_off,
return collect_jars_from_common_ctx(
ctx,
base_classpath,
extra_deps,
extra_runtime_deps,
unused_dependency_checker_mode == "off",
is_plus_one_deps_off(ctx),
)

(
cjars,
transitive_rjars,
jars2labels,
transitive_compile_jars,
deps_providers,
) = (
deps_jars.compile_jars,
deps_jars.transitive_runtime_jars,
deps_jars.jars2labels,
deps_jars.transitive_compile_jars,
deps_jars.deps_providers,
)

transitive_rjars = depset(
transitive = [transitive_rjars] +
_collect_runtime_jars(ctx.attr.runtime_deps + extra_runtime_deps),
)

return struct(
compile_jars = cjars,
jars2labels = jars2labels,
transitive_compile_jars = transitive_compile_jars,
transitive_runtime_jars = transitive_rjars,
deps_providers = deps_providers,
)

def _collect_runtime_jars(dep_targets):
runtime_jars = []

for dep_target in dep_targets:
runtime_jars.append(dep_target[JavaInfo].transitive_runtime_jars)

return runtime_jars
Loading

0 comments on commit c6c62bd

Please sign in to comment.