-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Make Stardoc repository mapping aware #16775
Conversation
7807e42
to
96d65bc
Compare
@comius Combined with bazelbuild/stardoc#141, which this PR is referencing, I got Stardoc to work with Bzlmod. Both PRs need some cleanup, but early feedback on the general approach would be appreciated. |
@comius This should be ready for review now. |
distdir_deps.bzl
Outdated
@@ -274,16 +274,15 @@ DIST_DEPS = { | |||
], | |||
}, | |||
"io_bazel_skydoc": { | |||
"archive": "1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz", | |||
"sha256": "5a725b777976b77aa122b707d1b6f0f39b6020f66cd427bb111a585599c857b1", | |||
"archive": "d09735f49f046fdebf2fc36312dc9f021f89ce27.tar.gz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This points out of main branch of stardoc and as such it should probably be reverted.
What is the right order? I'm guessing first merge this PR, then release the binary in stardoc repo with .bzl fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I only added this here to make more of the tests pass. I will revert this part and check whether that can be merged.
79648ee
to
5100f17
Compare
@comius Tests are failing here if I don't also update the pin to the stardoc rules. Since the same is true for bazelbuild/stardoc#141, I don't see a way to merge this that doesn't involve temporarily pointing one repo at a non-main branch of the other. |
@comius How about the following:
|
SQTM |
Friendly ping on this 🙏. |
|
||
package com.google.devtools.build.runfiles; | ||
|
||
public class RunfilesForStardoc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint suggests: Classes which are not intended to be instantiated should be made non-instantiable with a private constructor. This includes utility classes (classes with only static members), and the main class.
Make the class final and add a private no-op constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can fix that, but should I repair the merge first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to drop the merge commit and do a rebase (or anything else you might prefer)
package com.google.devtools.build.runfiles; | ||
|
||
public class RunfilesForStardoc { | ||
public static String getCanonicalRepository(Runfiles runfiles, String sourceRepository) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linter wants a javadoc on public methods :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and on the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. I also renamed the parameter.
@@ -23,18 +23,16 @@ java_test( | |||
deps = [ | |||
"//src/main/java/com/google/devtools/build/lib/cmdline", | |||
"//src/main/java/com/google/devtools/build/lib/packages/semantics", | |||
"//src/main/java/com/google/devtools/build/lib/vfs", | |||
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment", | |||
"//src/main/java/com/google/devtools/build/skydoc:skydoc_lib", | |||
"//src/main/java/com/google/devtools/build/skydoc/fakebuildapi", | |||
"//src/main/java/com/google/devtools/build/skydoc/rendering", | |||
"//src/main/java/com/google/devtools/build/skydoc/rendering/proto:stardoc_output_java_proto", | |||
"//src/main/java/net/starlark/java/eval", | |||
"//src/main/java/net/starlark/java/syntax", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax also seems unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used for Resolver
.
By taking in .bzl files as runfiles rather than inputs, Stardoc can use the existing Java runfiles library to resolve apparent repository names in load labels into canonical repository names.
@comius Friendly ping, is there anything else I should do to move this forward? |
In the last 2 weeks I did a reimport of stardoc, which didn't happen for 2 years and was tricky. Generally the changes are ok, but since now stardoc needs runfiles and when they are handled using absolute paths we'll need to account for this. I checked and this can't be done by external contributor. Good thing is, that accounting for differences most likely won't be visible in PRs. Also the plan looks ok. One option is that you go forward with the plan, and I account for the differences on each step. Second option is that I import everything, figure out how to account for the differences and then you go forward. This derisks it a bit. I'm out of office until 27th March, but I'll pick it up when I'm back Third option is that @Wyverald takes it over if there's more hurry than this. |
@comius Thank you very much for the transparency! There is no hurry, it's just difficult for a non-Googler like me to distinguish between something having been forgotten/deprioritized or something being stuck on some complicated google3 import. Thanks again for describing the options. |
Gently ping @comius |
Hey, the migration plan doesn't work, because we're building from sources. Because of that the changes to I think I have an alternative:
|
@comius Sounds good to me, although I don't understand all the implications well enough to assess whether this will work or not. Do you want me to perform/prepare any of these steps or is it easier if you do it directly via CLs? |
I've imported both PRs today, they are now in the internal review. |
Before Stardoc implementation was tested using stardoc.bzl from Stardoc repository. This makes it hard to change the implementation and bzl file at the same time. The change is preparation to import #16775 and bazelbuild/stardoc#141. Without it we'd need to do a half-release of Stardoc PR to make Bazel's CI pass. There's still a dependency on Stardoc repo/module from Bazel, which is used to generate the docs. PiperOrigin-RevId: 525736214 Change-Id: I291838a9dd9bbb9482a47011e6e36fc6dd67eff1
Before Stardoc implementation was tested using stardoc.bzl from Stardoc repository. This makes it hard to change the implementation and bzl file at the same time. The change is preparation to import bazelbuild#16775 and bazelbuild/stardoc#141. Without it we'd need to do a half-release of Stardoc PR to make Bazel's CI pass. There's still a dependency on Stardoc repo/module from Bazel, which is used to generate the docs. PiperOrigin-RevId: 525736214 Change-Id: I291838a9dd9bbb9482a47011e6e36fc6dd67eff1
By taking in .bzl files as runfiles rather than inputs, Stardoc can use the existing Java runfiles library to resolve apparent repository names in load labels into canonical repository names. Work towards bazelbuild#16124 Fixes bazelbuild#14140 Closes bazelbuild#16775. PiperOrigin-RevId: 526976752 Change-Id: I0848a5c7590348f778ad8c939fd37c89a53e55b2
By taking in .bzl files as runfiles rather than inputs, Stardoc can use the existing Java runfiles library to resolve apparent repository names in load labels into canonical repository names.
Work towards #16124
Fixes #14140