-
Notifications
You must be signed in to change notification settings - Fork 45
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
Do not require access to dependencies that aren't being documented #93
Comments
This allows anyone who depends on `rules_jvm_external` and imports "something" from these rules into their own rules to be able to generate stardoc of their own functions. I've filed bazelbuild/stardoc#93 to track this issue. Once it's fixed, we can close this.
This allows anyone who depends on `rules_jvm_external` and imports "something" from these rules into their own rules to be able to generate stardoc of their own functions. I've filed bazelbuild/stardoc#93 to track this issue. Once it's fixed, we can close this.
I agree with that it would be very good to not have to depend on visibility of third party bzl files that you do not want to generated documentation for. def our_rule( |
See #69, this should be addressed when we rewrite the doc extraction to grab real objects from the loading phase instead of mocking it in a separate process. |
(P4ing this one as opposed to marking it a dup, but the underlying rewrite is actually a P1 FR that we're aiming to work on this quarter and next.) |
This allows anyone who depends on `rules_jvm_external` and imports "something" from these rules into their own rules to be able to generate stardoc of their own functions. I've filed bazelbuild/stardoc#93 to track this issue. Once it's fixed, we can close this.
This allows anyone who depends on `rules_jvm_external` and imports "something" from these rules into their own rules to be able to generate stardoc of their own functions. I've filed bazelbuild/stardoc#93 to track this issue. Once it's fixed, we can close this.
I also started to investigate Stardoc for us and quickly ran into this. Currently unable to build because |
Workaround for bazelbuild/stardoc#93. Fixes bazelbuild#565
## What is the goal of this PR? Fix the issues in tar.gz assembly that were caused by #6642. ## What are the changes implemented in this PR? PR #6642 has changed the upstream repository of `rules_docker` to be from `bazelbuild`. Previously, the upstream repository was the Vaticle's fork of `rules_docker`. That fork contained a patch that fixed a bug in `rules_pkg` that stopped `pkg_tar` rule from working with long paths (the bug caused targz assembly of TypeDB to be incorrect) . Incidentally, an identical patch was applied in Vaticle's `bazel-distribution`. By loading, `rules_docker` from `vaticle_dependencies` before `bazel-distribution`, we ended up using the unpatched `rules_pkg` in the assembly targets that were depending on `rules_pkg` (we can't have multiple versions of a workspace dependency at the same time). This caused the targz assembly of TypeDB to contain invalid paths. The solution in this PR simply swaps the order of loading, so that `typedb` ends up depending on the patched `rules_pkg` that is provided by `bazel-distribution`. The ideal solution for this problem would be to bump the `rules_pkg` dependency in `bazel-distribution`, however, the newer versions of `rules_pkg` changed their subpackage visibility modifiers. More precisely, in the newer versions, `pkg_tar` depends on private subpackages. Unfortunately, `stardoc`, the tool that we use to generate documentation, does not work with rules that depend on rules that are invisible to our project (bazelbuild/stardoc#93, bazelbuild/stardoc#128). Therefore, in order to continue using `stardoc`, we must continue using the older version of `rules_pkg`. Co-authored-by: Lukas Slezevicius <[email protected]> Co-authored-by: Alex Walker <[email protected]>
## What is the goal of this PR? Fix the issues in tar.gz assembly that were caused by #6642. ## What are the changes implemented in this PR? PR #6642 has changed the upstream repository of `rules_docker` to be from `bazelbuild`. Previously, the upstream repository was the Vaticle's fork of `rules_docker`. That fork contained a patch that fixed a bug in `rules_pkg` that stopped `pkg_tar` rule from working with long paths (the bug caused targz assembly of TypeDB to be incorrect) . Incidentally, an identical patch was applied in Vaticle's `bazel-distribution`. By loading, `rules_docker` from `vaticle_dependencies` before `bazel-distribution`, we ended up using the unpatched `rules_pkg` in the assembly targets that were depending on `rules_pkg` (we can't have multiple versions of a workspace dependency at the same time). This caused the targz assembly of TypeDB to contain invalid paths. The solution in this PR simply swaps the order of loading, so that `typedb` ends up depending on the patched `rules_pkg` that is provided by `bazel-distribution`. The ideal solution for this problem would be to bump the `rules_pkg` dependency in `bazel-distribution`, however, the newer versions of `rules_pkg` changed their subpackage visibility modifiers. More precisely, in the newer versions, `pkg_tar` depends on private subpackages. Unfortunately, `stardoc`, the tool that we use to generate documentation, does not work with rules that depend on rules that are invisible to our project (bazelbuild/stardoc#93, bazelbuild/stardoc#128). Therefore, in order to continue using `stardoc`, we must continue using the older version of `rules_pkg`. Co-authored-by: Lukas Slezevicius <[email protected]> Co-authored-by: Alex Walker <[email protected]>
has there been any progress on this at all? Currently unable to build because the rule to be documented uses 'documentation generation failed: File external/rules_java/java/defs.bzl imported '//java/private:native.bzl' |
I tried, but alas, it turned out to be too difficult given realistic time constraints. There are systems out there which rely on I'm not closing this issue yet: although we must require access to dependencies in the Stardoc rule, it might be possible to have a separate command (which gets invoked from the terminal, not from a rule) for generating the doc. But that certainly will not happen before next year. |
@tmhdgsn, please ensure that
Does that fix the problem? If not, please add detailed repro steps and we will try to help debug. |
somehow I had managed to miss that target "@rules_java//java:rules", thank you !! all good now. |
We also hit this problem as we include e.g. @tetromino you mentioned there can be some two staged approach possible, where we execute bazel first to gather all dependencies. How could it look like, how hard would it be to implement as a workaround? Other possible solution would be to change starlark parser to allow undefined deps, possibly by traversing just starlark AST in stardoc, which could work in some cases and be available as a special mode of stardoc rule, but not sure about this solution for now. |
@hauserx - one approach would be for Bazel to gain a new non-build command or command-line option - perhaps a new option to Open design questions:
|
Wonder whether it would be possible for bazel to create automatic targets for The For posterity, for srcs from
|
It's not always practical to add a dependency on the bzl files that come from third party dependencies.
stardoc
should allow documentation to be generated without introspecting deeply into dependencies.As an example, I use
MavenInfo
fromrules_jvm_external
in my own rules for building java modules. In order to generate docs using stardoc, I must somehow also include source files fromrules_jvm_external
The text was updated successfully, but these errors were encountered: