-
Notifications
You must be signed in to change notification settings - Fork 308
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
Bazel: various fixes #9243
Bazel: various fixes #9243
Conversation
plugins/package-managers/bazel/src/main/kotlin/MultiBazelModuleRegistryService.kt
Show resolved
Hide resolved
@@ -50,6 +52,11 @@ internal class MultiBazelModuleRegistryService( | |||
// Add the default Bazel registry as a fallback. | |||
val registryUrls = (urls + DEFAULT_URL).distinctBy { it.removeSuffix("/") } | |||
|
|||
logger.info { "Creating a multi Bazel module registry:" } |
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.
IMO this should be debug
instead of info
.
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.
Since the logging occurs only one, I think there is no harm in letting it to info
, especially considering how noisy debug
is.
plugins/package-managers/bazel/src/main/kotlin/MultiBazelModuleRegistryService.kt
Outdated
Show resolved
Hide resolved
@@ -110,9 +110,9 @@ class Bazel( | |||
super.run( | |||
args = args, | |||
workingDir = workingDir, | |||
// Disable the optional wrapper script under `tools/bazel`, to ensure the --version option works. | |||
// Disable the optional wrapper script under `tools/bazel` only for the "--version" call. |
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.
can be relevant by defining
I don't understand this. Do you mean "can be relevant e.g. in case a specific '.bazelrc'
depending on the value of an environment variable is defined"?
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 tried to explain the setup of our customer project and the phrasing is quite difficult...
They have in their project a wrapper script in tools/bazel
. This script reads an environment variable and, depending on its value, change the .bazelrc of the project.
Therefore when you call bazel mod graph
, this script "setups" your build environment depending on this environment variable.
However, bazel uses this script for all commands even if you call bazel version
. In that case, the script fails because it does not support the --version
parameter. While the correct fix would be to change the wrapper script to support this parameter, this is not possible to force all the projects to do so.
And, in all cases, ORT must make sure that the wrapper script is enabled when mod graph
is called, as it may contain some build changing logic as described above.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9243 +/- ##
=========================================
Coverage 67.65% 67.65%
Complexity 1185 1185
=========================================
Files 239 239
Lines 7795 7795
Branches 899 899
=========================================
Hits 5274 5274
Misses 2153 2153
Partials 368 368
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3631770
to
1c2628d
Compare
278302b
to
dffeaae
Compare
clients/bazel-module-registry/src/main/kotlin/BazelModuleRegistryService.kt
Outdated
Show resolved
Hide resolved
plugins/package-managers/bazel/src/main/kotlin/CompositeBazelModuleRegistryService.kt
Outdated
Show resolved
Hide resolved
plugins/package-managers/bazel/src/main/kotlin/MultiBazelModuleRegistryService.kt
Outdated
Show resolved
Hide resolved
plugins/package-managers/bazel/src/funTest/kotlin/BazelFunTest.kt
Outdated
Show resolved
Hide resolved
dffeaae
to
12f2b37
Compare
clients/bazel-module-registry/src/main/kotlin/RemoteBazelModuleRegistryService.kt
Fixed
Show resolved
Hide resolved
plugins/package-managers/bazel/src/main/kotlin/CompositeBazelModuleRegistryService.kt
Outdated
Show resolved
Hide resolved
plugins/package-managers/bazel/src/main/kotlin/MultiBazelModuleRegistryService.kt
Outdated
Show resolved
Hide resolved
clients/bazel-module-registry/src/main/kotlin/RemoteBazelModuleRegistryService.kt
Fixed
Show resolved
Hide resolved
12f2b37
to
dfbd4a7
Compare
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.
Sorry for some follow-up requests for changes.
@@ -35,7 +35,7 @@ const val SOURCE_JSON = "source.json" | |||
/** | |||
* A Bazel registry which is located on the local file system. | |||
*/ | |||
class LocalBazelModuleRegistryService(directory: File) : BazelModuleRegistryService { | |||
class LocalBazelModuleRegistryService(val url: String, directory: File) : BazelModuleRegistryService { |
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.
Sorry, same thing here: Drop val
. The inspection did not trigger here as the properly is public currently.
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.
Also, please document the url
and directory
constructor parameters to explain their relation (e.g., I was wondering whether the directory
can't be deduced from the file://-type url
).
* A remote Bazel Module Registry, based on the directory structure of https://bcr.bazel.build/ and the Git repository | ||
* it is based on (https://github.com/bazelbuild/bazel-central-registry/). |
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.
Also here, while rewording the docs anyway, please incorporate the client
and baseUrl
parameters to explain their meaning.
dfbd4a7
to
0fe3e93
Compare
clients/bazel-module-registry/src/main/kotlin/LocalBazelModuleRegistryService.kt
Dismissed
Show dismissed
Hide dismissed
clients/bazel-module-registry/src/main/kotlin/LocalBazelModuleRegistryService.kt
Dismissed
Show dismissed
Hide dismissed
clients/bazel-module-registry/src/main/kotlin/RemoteBazelModuleRegistryService.kt
Dismissed
Show dismissed
Hide dismissed
Please have a look at the |
The `MultiBazelModuleRegistryService` tries several Bazel registries one after each other in order to query the `metadata.json` and the `source.json` of a module. If this information cannot be resolved, the server collates all the error messages and outputs them. To facilitate the analysis of the logs, each error message is now prefixed with the URL of the registry that created it. The URL property is now provided by each Bazel registry service. This required making `RemoteBazelModuleRegistryService.kt` a proper class that delegates the module lookups to a Retrofit client. Signed-off-by: Nicolas Nobelis <[email protected]>
0fe3e93
to
6b39da3
Compare
Sorry again for finding more (optional) stuff:
Shouldn't this be "feat" instead of "chore?
Shouldn't this say "fix" instead of "chore"? Otherwise there wouldn't be a single "fix" commit in this "Bazel: various fixes" PR 😉 |
This is currently unused (as the whole `Maintainer` class) but it contains information that could be relevant in the future. See [1]. [1]: https://github.com/bazelbuild/bazel-central-registry/blob/main/metadata.schema.json Signed-off-by: Nicolas Nobelis <[email protected]>
The wrapper script can be relevant by defining e.g. a specific '.bazelrc' depending on the value of an environment variable. This is a fixup for 310470d. Signed-off-by: Nicolas Nobelis <[email protected]>
This is a test for 1045f89. Signed-off-by: Nicolas Nobelis <[email protected]>
6b39da3
to
e4046fe
Compare
Please have a look at the individual commit messages for the details.