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

Cherry-pick the renderjar aspect for building preview dependencies #6392

Open
wants to merge 1 commit into
base: google
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions aspect/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ filegroup(
"WORKSPACE",
"artifacts.bzl",
"build_dependencies.bzl",
"build_render_dependencies.bzl",
"fast_build_info_bundled.bzl",
"intellij_info.bzl",
"intellij_info_bundled.bzl",
Expand Down
36 changes: 36 additions & 0 deletions aspect/build_render_dependencies.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Aspects to build and collect project's render dependencies."""

load("@rules_java//java:defs.bzl", "JavaInfo")

RenderDependenciesInfo = provider(
"The render dependencies",
fields = {
"jars": "a list of jars generated for project files and external dependencies",
},
)

def _package_render_dependencies_impl(target, ctx):
return [OutputGroupInfo(
jars = target[RenderDependenciesInfo].jars.to_list(),
)]

package_render_dependencies = aspect(
implementation = _package_render_dependencies_impl,
required_aspect_providers = [[RenderDependenciesInfo]],
)

def _collect_render_dependencies_impl(target, ctx):
if JavaInfo not in target:
return [RenderDependenciesInfo(
jars = depset(),
)]
return [
RenderDependenciesInfo(
jars = depset([], transitive = [target[JavaInfo].transitive_runtime_jars]),
),
]

collect_render_dependencies = aspect(
implementation = _collect_render_dependencies_impl,
provides = [RenderDependenciesInfo],
)