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

Allow native repo rule usage in module extension impl functions #15412

Closed
Wyverald opened this issue May 6, 2022 · 4 comments
Closed

Allow native repo rule usage in module extension impl functions #15412

Wyverald opened this issue May 6, 2022 · 4 comments
Assignees
Labels
area-Bzlmod Bzlmod-specific PRs, issues, and feature requests P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@Wyverald
Copy link
Member

Wyverald commented May 6, 2022

Right now we can't use native repo rules in module extension impl functions. We should fix that.

Example:

def _impl(ctx):
  native.local_repository(name="foo", path="bar")
my_extension=module_extension(implementation=_impl)
@Wyverald Wyverald added type: bug P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. area-Bzlmod Bzlmod-specific PRs, issues, and feature requests labels May 6, 2022
@Wyverald Wyverald self-assigned this May 6, 2022
@fmeum
Copy link
Collaborator

fmeum commented Jul 4, 2022

@Wyverald If it helps, I could starlarkify local_repository and new_local_repository. Now that repository_ctx.workspace_root is available, making fully-featured replacements should be possible.

Assuming that using bind in module extensions is a bad idea, this would cover all native rules. Maybe making native repo rules work in module extension wouldn't even be necessary anymore?

@fmeum
Copy link
Collaborator

fmeum commented Jul 4, 2022

Sorry, I have to take back what I said above: At least new_local_repository can't easily be starlarkified since it relies on creating Skyframe dependencies on local files and directories, while Starlark repository rules can only Skyframe-depend on labels.

@wondfor
Copy link

wondfor commented Feb 2, 2023

new_local_repository

when i use bazel test, i want deps some *.so, in /opt/buildtools/, special ,i run remotely with buildfarm, is there a example in bzlmod

@Wyverald
Copy link
Member Author

Wyverald commented May 2, 2023

Closing in favor of #18285

@Wyverald Wyverald closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Bzlmod Bzlmod-specific PRs, issues, and feature requests P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug
Projects
None yet
Development

No branches or pull requests

3 participants