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

Add support for generated files #26

Closed
wants to merge 1 commit into from
Closed

Conversation

nitnelave
Copy link
Contributor

Fixes #21

With that patch, we can add rules that generate files in the content attribute of the hugo_site rule.

For instance, we can have a rule like:

genrule(
    name = "api",
    outs = ["api.md"],
    cmd = """echo "Some generated content" > $@""",
    visibility = ["//visibility:public"],
)

And depend on it like:

hugo_site(
   content = ... + ["//site/content/subsection:api"],
   ...
)

Comment on lines -50 to +62
content_files = copy_to_dir(ctx, ctx.files.content, "content")
static_files = copy_to_dir(ctx, ctx.files.static, "static")
image_files = copy_to_dir(ctx, ctx.files.images, "images")
layout_files = copy_to_dir(ctx, ctx.files.layouts, "layouts")
data_files = copy_to_dir(ctx, ctx.files.data, "data")
asset_files = copy_to_dir(ctx, ctx.files.assets, "assets")
i18n_files = copy_to_dir(ctx, ctx.files.assets, "i18n")
hugo_inputs += content_files + static_files + image_files + layout_files + asset_files + data_files + i18n_files
for name, srcs in {
"assets": ctx.files.assets,
"content": ctx.files.content,
"data": ctx.files.data,
"i18n": ctx.files.i18n,
"images": ctx.files.images,
"layouts": ctx.files.layouts,
"static": ctx.files.static,
}.items():
hugo_inputs += copy_to_dir(ctx, srcs, name)
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 that this is just a cleanup.

@nitnelave
Copy link
Contributor Author

Ping?

@pcj
Copy link
Member

pcj commented Oct 30, 2020

Apologies for delay @nitnelave, your patch was included in #29 by @platinummonkey, so closing this PR. Thank you!

@pcj pcj closed this Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Files copied in a temporary folder are conflicting with rules generating them
2 participants