-
Notifications
You must be signed in to change notification settings - Fork 44
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
Crash when macro param default value is a select()
#40
Comments
We have been able to generate documentation for 27 own rules and macros by using Stardoc. But we have one macro that isn't possible to build with Stardo() due to this select() problem. |
I'm glad to hear you're having success with several of your rules/macros with Stardoc! Unfortunately, having Stardoc recognize |
Thanks @c-parsons for your answer it's much appreciated! It is really interesting to read about the plans. It sounds like a great idea to make the implementation cleaner and to re-use all functionality that actually already exist in Bazel. It would also be much easier to get a grip of how Stardoc works. I think that would be a great benefit and make it easier to contribute. We have other thoughts and wishes that haven't felt enough important to issue tickets on. I am really looking forward to the re-structuring of how Stardoc works and also the other parts I read about via your first link e.g. the Documentation inheritance. |
I don't think there are yet any plans to make this easier, and I was unaware of this issue. Does this not work to use markdown format for these purposes? (Can you provide an example and file that separately?) All-in-all, the overhaul plan I linked to will make it easier to retrieve implementation-related information (from macros & rules), but will not improve string formatting of your doc strings. (That will need to be done separately). |
Yes I can write about these things separately in own tickets. Will do that in short. We haven't thought that they were as important as this one and we haven't perceived it as stardoc() has been so prioritized so we didn't want to add more than necessary. That might have been wrong conclusions of mine. |
select()
Note that the plan is to have documentation information emitted by Bazel's loading phase, e.g. from This means that In any case, Stardoc should not crash regardless, so let's use this bug to track fixing that. |
Hi @brandjon, |
For this bug, we're also trying to study stardoc code to check if we could do some improvements by ourselves. 1st: But it seems that some files still use Skydocxxx.java in the directory. 2nd: Thanks a lot! |
One more question, where is stardoc code? 😅 |
@ecngtng, Stardoc consists of the documentation generator, templates which configure the exact markdown output, and associated Starlark rules that allow Stardoc to be used by Bazel. The documentation generator source code lives in the Bazel source tree at https://github.com/bazelbuild/bazel/tree/master/src/main/java/com/google/devtools/build/skydoc. The Stardoc repo bundles two jars (stardoc/stardoc_binary.jar and stardoc/renderer_binary.jar) which are built from Bazel source at a specific commit using the update-release-binary.sh script. The templates and the rules are in the Stardoc repo. The convoluted dependency between Bazel and Stardoc, and the bundling of pre-built jars, is not ideal. Our plan is to in the future have Bazel emit a low-level representation of the docstrings and other documentation sources of a .bzl file in protobuf format, and then have Stardoc (via a new small binary whose source will live in the Stardoc repo) turn the protos into Markdown. |
@tetromino Get it. Thanks for your detailed explanation! |
I just encountered this bug with my usage of stardoc. Are there any workarounds? I'd be fine if the docs generated don't represent the select correctly, what's not fine is to crash all of doc generation - the latter makes stardoc unusable for me, and I really don't want to tailor my usage of bazel to what stardoc can handle. IMO this bug is way worse than a p3 from my perspective - until there's a workaround I'm probably going to stop using stardoc entirely. |
... and of course right after I post this I realize I can just use |
As far as I can tell, this crash has been fixed - I cannot reproduce it with Stardoc 0.6.2 + Bazel 7.0.1 or with Stardoc 0.6.2 + Bazel 6.4.0 @dgoldstein0 - what versions of Stardoc and Bazel you were using when you saw the crash? If it's the latest ones, would you be able to provide a way to reproduce the problem? |
it's been a while, but we're still on bazel 6.1.0 (so I believe it was at most that) as well as stardoc 0.4.0. I looked into upgrading stardoc but we haven't used bazel modules for anything yet and the newer version had a bunch more deps that made the non-module setup rather hard to figure out so I gave up after ~30m of trying. I'd definitely like to be on newer versions of both. So yeah, older versions of stuff. Understandable if that means we have to suffer the old bugs 😢 |
Closing as obsolete (since the issue has been fixed in recent releases). |
Description of the problem:
I tried to use Stardoc to generate som documents and then I ran into a problem when select() was used. I got the following error:
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
To show some more simple example I just made a very small update into the Bazel C++ tutorial and I got the same error.
I added .bazelrc in stage2 directory and a new file hello-world.bzl in the main sub-directory and updated the BUILD file in the same sub-directory.
In the .bazelrc file I added the following:
And the hello-world.bzl have the following content:
I added the following into the BUILD file:
It works to generate document for target hello-world-docs-no-select but not for hello-world-docs-with-select:
OK: bazel build //main:hello-world-docs-no-select NOK: bazel build //main:hello-world-docs-with-select bazel build //main:hello-world-docs-with-select --define="fruit=apple"
What operating system are you running Bazel on?
Linux
What's the output of bazel info release?
0.28.1
Now we have 3.3.1 and it's still the same problem
Have you found anything relevant by searching the web?
No
The text was updated successfully, but these errors were encountered: