Skip to content

Commit

Permalink
move plusone provider and aspect to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
ittaiz committed Feb 22, 2019
1 parent 66ac5aa commit b7979ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 12 additions & 0 deletions scala/plusone.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PlusOneDeps = provider(
fields = {
'direct_deps' : 'list of direct compile dependencies of a target',
}
)

def _collect_plus_one_deps_aspect_impl(target, ctx):
return [PlusOneDeps(direct_deps = getattr(ctx.rule.attr,'deps',[]))]

collect_plus_one_deps_aspect = aspect(implementation = _collect_plus_one_deps_aspect_impl,
attr_aspects = ['deps'],
)
14 changes: 1 addition & 13 deletions scala/private/common.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@io_bazel_rules_scala//scala:jars_to_labels.bzl", "JarsToLabelsInfo")
load("@io_bazel_rules_scala//scala:plusone.bzl", "PlusOneDeps")

def write_manifest(ctx):
main_class = getattr(ctx.attr, "main_class", None)
Expand Down Expand Up @@ -157,16 +158,3 @@ def create_java_provider(scalaattr, transitive_compile_time_jars):
),
transitive_runtime_jars = scalaattr.transitive_runtime_jars,
)

PlusOneDeps = provider(
fields = {
'direct_deps' : 'list of direct compile dependencies of a target',
}
)

def _collect_plus_one_deps_aspect_impl(target, ctx):
return [PlusOneDeps(direct_deps = getattr(ctx.rule.attr,'deps',[]))]

collect_plus_one_deps_aspect = aspect(implementation = _collect_plus_one_deps_aspect_impl,
attr_aspects = ['deps'],
)
2 changes: 1 addition & 1 deletion scala/scala.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ load(
_specs2_junit_dependencies = "specs2_junit_dependencies",
)
load(
"@io_bazel_rules_scala//scala/private:common.bzl",
"@io_bazel_rules_scala//scala:plusone.bzl",
_collect_plus_one_deps_aspect = "collect_plus_one_deps_aspect",
)

Expand Down

0 comments on commit b7979ba

Please sign in to comment.