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

Cannot reimport project after settings change #457

Closed
tpasternak opened this issue Dec 10, 2019 · 0 comments · Fixed by #458 or #474
Closed

Cannot reimport project after settings change #457

tpasternak opened this issue Dec 10, 2019 · 0 comments · Fixed by #458 or #474

Comments

@tpasternak
Copy link
Contributor

tpasternak commented Dec 10, 2019

Intellij 2019.3
Pants plugin commit c44af98
Repro steps:

  1. Import project with "Enable incremental import" option checked
  2. Wait for the import process to finish
  3. Open "File" -> "Settings" -> "Build, Execution, Deployment" -> "Pants"
  4. Uncheck "Enable incremental Project Import ..." checkbox
  5. Click "Apply"
  6. Check "Enable incremental Project Import ..." checkbox again
  7. Clock "OK"
  8. "Pants" -> "Refresh Pants Project"

Expected result:
Succsessful reimport of the project

Actual result:
Message: "No target roots found in build graph. Please make sure Pants export version >= 1.0.9"

reimport_failure

wisechengyi pushed a commit that referenced this issue Dec 19, 2019
Before this commit, the list of the targets were stored in
`PantsProjectSettings::myTargetSpecs` field. Unfortunately, this list was based on the
contents of `myTargetSpecsBox` widget, which was cleared each time
when the "Pants->Settings" window was opened. As a result, the list
of targets was cleared each time during settings save.

The fix to this is just not to clean the list of targets in the
window.

But this led to a new issue. When the list of targets is presented
to the user, it's also possible for him to deselect target. During
save, the `myTargetSpecs` variable was based on the list of selected
targets, so after deselection and save, it was not possible to select
it again.

In order to overcome this, I put two lists to `PantsProjectSettings`
instead of `myTargetSpecs`:

 1. `allAvailableTargetSpecs` - used to build `myTargetSpecsBox` widget
 2. `selectedTargetSpecs` - to inform `pants` which targets it should
operate on

fixes #457
wisechengyi pushed a commit that referenced this issue Jan 14, 2020
CHERRY-PICK
This commit is a slightly modified cherry-pick of 58d0b40.
58d0b40 has been already merged, but #471 has been submitted
and 58d0b40

Compared to 58d0b40, in this commit, the "cleanPantsProjects" method
is not called in PantsUtil.refreshAllProjects, but in
PantsSystemProjectResolver.resolveProjectInfo, and it's renamed to
"cleanPantsModules".

The problem is that, the "refreshAllProjects method was not called
each time the reimport occured, it was executed only when the user
clicked Pants->Refresh Pants Projects in menubar

ORIGINAL MESSAGE

Before this commit, the list of the targets were stored in
`PantsProjectSettings::myTargetSpecs` field. Unfortunately, this list was based on the
contents of `myTargetSpecsBox` widget, which was cleared each time
when the "Pants->Settings" window was opened. As a result, the list
of targets was cleared each time during settings save.

The fix to this is just not to clean the list of targets in the
window.

But this led to a new issue. When the list of targets is presented
to the user, it's also possible for him to deselect target. During
save, the `myTargetSpecs` variable was based on the list of selected
targets, so after deselection and save, it was not possible to select
it again.

In order to overcome this, I put two lists to `PantsProjectSettings`
instead of `myTargetSpecs`:

 1. `allAvailableTargetSpecs` - used to build `myTargetSpecsBox` widget
 2. `selectedTargetSpecs` - to inform `pants` which targets it should
operate on

fixes #457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant