Closed ivyspirit closed 2 months ago
Fixing the test
The
ExternalWorkspaceReferenceTest
test failed, bc i checkfile.exist()
here and here before i return the workspaceRoot. However in the testTestFileSystem
creates thePsiFile
does not seem to create file in the test dir? Any suggestion? Once I removed the file exist check the tests all passes.
@sgowroji do you have any suggestion on this? in the test it create a VirtualFile
by TempFileSystem
. Which the file does not exist. But in my code I need to check the file exist before return. I checked the code base didn't see an example in the test to handle this case. Any suggestion would be appreciated
@mai93 i have fixed the tests. All of them are due to the mock set up. Please take a look. Thanks!
LGTM from me, @tpasternak if you have time can you review this?
yep, I'll try it later today
Also I found this bug:
- Import https://github.com/bazelbuild/bazel
- Open the top-level BUILD file
Ok, this probably happens, because when you run sync, the
blazeProjectData
entry might be null so the null is written to the cache
The local map cache should help on this. although before the blazeProjectData
finish init the workspace root will not work. But when it query again once it is done initialization it should work. Wonder how did the old implementation work with this case? seems there would be NPEs. And once the map is cached to the SyncCache it will not be modified, so it might not recover.
Checklist
Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See the Contributions section in the README for more details.
Discussion thread for this change
Issue number: 5719
Description of this change
We have pretty big bazel project, and we are using the
rule_jvm_external
pinned feature, which download all the external dependencies to the{baze-base}/external
dir. Theexternal
folder could grow very big. One example the smallest cache folder for us:The original logic when resolving the dependency label, it loops through the entire
{baze-base}/external
dir, and check if the file is dir, then create a map for with the workspaceName as key and its dir path as value. Which when the external is really big the IO operation could hang there for a long time cause the IDE freeze.This change use the {baze-base}/external/{workspaceName} to construct the workspace root dir. And if it existed then construct the
WorkspaceRoot
and return.