Skip to content
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

Reload project view, and make sure that BazelImportSettings respect p… #7088

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dkashyn-sfdc
Copy link
Contributor

…roject view choice before performing sync calls.

Checklist

  • I have filed an issue about this change and discussed potential changes with the maintainers.
  • I have received the approval from the maintainers to make this change.
  • This is not a stylistic, refactoring, or cleanup change.

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: 7087

Description of this change

@github-actions github-actions bot added product: CLion CLion plugin product: IntelliJ IntelliJ plugin product: GoLand GoLand plugin awaiting-review Awaiting review from Bazel team on PRs labels Nov 30, 2024
@dkashyn-sfdc
Copy link
Contributor Author

Last 2 runs after git pull and it is obvious that our project will benefit from QS.
image

However, there are some gaps so "toggle" mechanism is essential.

* so we cannot reload project view from for every of such call.
* This is why we have this special case to make sure that Sync respects project view selection if there is any.
*/
public static ProjectType getProjectTypeBeforeSync(@Nonnull Project project) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been also looking for a way to jump between qs/as on the fly, thanks for submitting this PR! Can we add some javadoc here to reflect somthing like returns the project type with project view file lookup? and maybe make the name more matching the action it does rather than a point it code where it should be called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 15 places where Blaze.getProjectType*(project) == ProjectType.QUERY_SYNC check is performed. So I wanted to have a special case for sync calls only. This is why name reflects this.

I don't really know how frequent the rest of places are hitting this method and saw it called from action apperance update, which cannot afford to reload file for sure.

So instead of having "get type with refresh" I'd rather keep "get type for sync and make sure the proper sync mode is used". Also we are updating BazelImportSettings here and it is ok to update those on sync but for the rest of ops I'd like to avoid this.

Copy link
Contributor Author

@dkashyn-sfdc dkashyn-sfdc Nov 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rename it to getSelectedProjectTypeBeforeSync or so. The fact that BazelImportSetings are updated is important, yet subtle here. Before, this change it was set once during project creation, and not touched afterwards, for whatever reason.

Overall, Blaze.getProjectType*(project) == ProjectType.QUERY_SYNC is someway out of control... It is peppered over the code quite randomly, and I'm a little bit worried about it causing trouble in the future even for cases beyond sync.

Copy link
Contributor Author

@dkashyn-sfdc dkashyn-sfdc Nov 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getRefreshedProjectType or getNotCachedProjectType is another option... But then it will be a dilemma where to call those :)

@@ -61,6 +54,27 @@ public BlazeProjectData loadProject(BlazeImportSettings importSettings) {

@Override
public void saveProject(BlazeImportSettings importSettings, BlazeProjectData projectData) {
if (projectType != Blaze.getProjectType(project)) {
initBlazeProjectDataDelegate(project);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we need to call save here for the old model... But this is a thing only for Aspect one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 50% of non-test impls not using saveProject this interface definitely needs some cleanup...

// TODO(mathewi) Tidy up the interface to remove this unnecessary stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review Awaiting review from Bazel team on PRs product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

4 participants