| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4363/ |
|
Review request for pants-reviews, Benjy Weinberger, Nick Howard (Twitter), Peiyu Wang, Stu Hood, and Eric Ayers.
By Yi Cheng.
Updated Nov. 11, 2016, 8:18 a.m. Summary (updated)
Repository:
intellij-pants-plugin
Description (updated)
Testing (updated)
Diffs (updated)
|
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4363/ |
|
Review request for pants-reviews, Benjy Weinberger, Nick Howard (Twitter), Peiyu Wang, Stu Hood, and Eric Ayers.
By Yi Cheng.
|
Updated Nov. 11, 2016, 8:35 a.m. Changes
Repository:
intellij-pants-plugin
Description |
Testing |
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4363/ |
| src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) | |||
|---|---|---|---|
| 56 | /** |
||
| 57 | * Determine whether a project should be recompiled given targets to compile and PantsSettings |
||
| 58 | * by comparing with the last one. |
||
| 59 | * |
||
| 60 | * @param project: project under question. |
||
| 61 | * @param targetAddresses: target addresses for this compile. |
||
| 62 | * @return true if anything in the project has changed or the current `CompileSnapshot` does not match with |
||
| 63 | * the previous one. |
||
| 64 | */ |
||
| 65 | public static boolean shouldRecompileThenReset(@NotNull Project project, @NotNull Set<String> targetAddresses) { |
||
This will break if someone has compiled outside of intellij, such as on the CLI, right?
| src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) | |||
|---|---|---|---|
| 77 | projectStates.put(project, Pair.create(false, Optional.of(snapshot))); |
||
Updating the project state here means that this method isn't idempotent. IMO, should update the project state independently after a compile has actually succeeded. I can easily imagine a state where a cancelled/failed compile is considered to be clean.
But also, it's not at all obvious from the javadoc that this will mutate the state.
| src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) | |||
|---|---|---|---|
| 103 | if (projectStates.containsKey(project)) { |
||
| 104 | projectStates.remove(project); |
||
| 105 | } |
||
IIRC,
removeworks regardless of whether something is present... so no need to check first.
| src/com/twitter/intellij/pants/settings/PantsExecutionSettings.java (Diff revision 3) | |||
|---|---|---|---|
| 42 | * @param enableIncrementalImport: whether incrementally import the project. |
||
whether to
| src/com/twitter/intellij/pants/settings/PantsSettings.java (Diff revision 3) | |||
|---|---|---|---|
| 23 | 24 | ||
IMO, the project change detection should probably be optional for at least one release.
- Stu Hood
On November 11th, 2016, 8:35 a.m. UTC, Yi Cheng wrote:
|
Review request for pants-reviews, Benjy Weinberger, Nick Howard (Twitter), Peiyu Wang, Stu Hood, and Eric Ayers.
By Yi Cheng.
Updated Nov. 11, 2016, 8:35 a.m. |
Repository:
intellij-pants-plugin
|
Description
Testing
Diffs |
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4363/ |
On November 16th, 2016, 8:27 p.m. UTC, Stu Hood wrote:
src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) 56 /**57 * Determine whether a project should be recompiled given targets to compile and PantsSettings58 * by comparing with the last one.59 *60 * @param project: project under question.61 * @param targetAddresses: target addresses for this compile.62 * @return true if anything in the project has changed or the current `CompileSnapshot` does not match with63 * the previous one.64 */65 public static boolean shouldRecompileThenReset(@NotNull Project project, @NotNull Set<String> targetAddresses) {This will break if someone has compiled outside of intellij, such as on the CLI, right?
That is not the case. Out of band file IO will be caught as long as they are under any of the project content roots.
If a source file changes and a compile is issued on CLI, next time when user switches back to IntelliJ GUI, the system will detect changes on disk since user switched out of IntelliJ, hence the project will be marked as dirty.
If a compile was issued on CLI without any source change, then
manifest.jarwhich IJ consumes won't change either.However another caveat I just realize is
./pants clean-allisn't detected, but I think it can be resolved by havingclean-allto removedist/export-classpath/manifest.jarwhich would be likely be invalid anyway, and then have IntelliJ check for its existence.
On November 16th, 2016, 8:27 p.m. UTC, Stu Hood wrote:
src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) 77 projectStates.put(project, Pair.create(false, Optional.of(snapshot)));Updating the project state here means that this method isn't idempotent. IMO, should update the project state independently after a compile has actually succeeded. I can easily imagine a state where a cancelled/failed compile is considered to be clean.
But also, it's not at all obvious from the javadoc that this will mutate the state.
A failed/cancelled build will caught at the end of
PantsMakeBeforeRunhttps://rbcommons.com/s/twitter/r/4363/diff/3#2 so the project will be marked dirty.Will update the javadoc.
- Yi
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4363/ |
|
Review request for pants-reviews, Benjy Weinberger, Nick Howard (Twitter), Peiyu Wang, Stu Hood, and Eric Ayers.
By Yi Cheng.
|
Updated Nov. 19, 2016, 2:42 a.m.
Bugs:
217
Repository:
intellij-pants-plugin
Description (updated) |
|
|
|
|
Testing (updated)
Diffs (updated)
|
|
|
|
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4363/ |
On November 16th, 2016, 8:27 p.m. UTC, Stu Hood wrote:
src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) 56 /**57 * Determine whether a project should be recompiled given targets to compile and PantsSettings58 * by comparing with the last one.59 *60 * @param project: project under question.61 * @param targetAddresses: target addresses for this compile.62 * @return true if anything in the project has changed or the current `CompileSnapshot` does not match with63 * the previous one.64 */65 public static boolean shouldRecompileThenReset(@NotNull Project project, @NotNull Set<String> targetAddresses) {This will break if someone has compiled outside of intellij, such as on the CLI, right?
On November 17th, 2016, 1:11 a.m. UTC, Yi Cheng wrote:
That is not the case. Out of band file IO will be caught as long as they are under any of the project content roots.
If a source file changes and a compile is issued on CLI, next time when user switches back to IntelliJ GUI, the system will detect changes on disk since user switched out of IntelliJ, hence the project will be marked as dirty.
If a compile was issued on CLI without any source change, then
manifest.jarwhich IJ consumes won't change either.However another caveat I just realize is
./pants clean-allisn't detected, but I think it can be resolved by havingclean-allto removedist/export-classpath/manifest.jarwhich would be likely be invalid anyway, and then have IntelliJ check for its existence.
I added two additional checks.
- Have
CompileSnapshotinclude the SHA ofmanifest.jar, so any change onmanifest.jarwill trigger a rebuild- Inspect the validity of
manifest.jar, so after aclean-all,METAINF/MANIFEST.MFentries will become invalid, thus triggering a new build.
On November 16th, 2016, 8:27 p.m. UTC, Stu Hood wrote:
src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) 77 projectStates.put(project, Pair.create(false, Optional.of(snapshot)));Updating the project state here means that this method isn't idempotent. IMO, should update the project state independently after a compile has actually succeeded. I can easily imagine a state where a cancelled/failed compile is considered to be clean.
But also, it's not at all obvious from the javadoc that this will mutate the state.
On November 17th, 2016, 1:11 a.m. UTC, Yi Cheng wrote:
A failed/cancelled build will caught at the end of
PantsMakeBeforeRunhttps://rbcommons.com/s/twitter/r/4363/diff/3#2 so the project will be marked dirty.Will update the javadoc.
Doc updated to reflect the behavior.
On November 16th, 2016, 8:27 p.m. UTC, Stu Hood wrote:
src/com/twitter/intellij/pants/file/FileChangeTracker.java (Diff revision 3) 103 if (projectStates.containsKey(project)) {104 projectStates.remove(project);105 }IIRC,
removeworks regardless of whether something is present... so no need to check first.
Redundant check removed.
On November 16th, 2016, 8:27 p.m. UTC, Stu Hood wrote:
src/com/twitter/intellij/pants/settings/PantsExecutionSettings.java (Diff revision 3) 42 * @param enableIncrementalImport: whether incrementally import the project.whether to
Corrected.
On November 16th, 2016, 8:27 p.m. UTC, Stu Hood wrote:
src/com/twitter/intellij/pants/settings/PantsSettings.java (Diff revision 3) 23 24 IMO, the project change detection should probably be optional for at least one release.
With the two additional checks added, I think it should be safe to land. Plus there is testing channel to use.
- Yi
On November 19th, 2016, 2:42 a.m. UTC, Yi Cheng wrote:
|
Review request for pants-reviews, Benjy Weinberger, Nick Howard (Twitter), Peiyu Wang, Stu Hood, and Eric Ayers.
By Yi Cheng.
|
Updated Nov. 19, 2016, 2:42 a.m.
Bugs:
217
Repository:
intellij-pants-plugin
Description |
|
|
|
|
|
Testing
Diffs
|
|
|
|
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4363/ |
|
Review request for pants-reviews, Benjy Weinberger, Nick Howard (Twitter), Peiyu Wang, Stu Hood, and Eric Ayers.
By Yi Cheng.
|
Updated Nov. 20, 2016, 12:22 a.m. Changes
|
|
Bugs:
217
Repository:
intellij-pants-plugin
Description |
|
|