Steps to reproduce:
- create Java and Scala projects as per screenshot
- comment out "public int z = 42;" line in Zzz and and save the file
expected behaviour: Xxx has an error (value z is not a member of zzz.Zzz)
actual behaviour: no errors until you clean and rebuild project xxx explicitly.
Cause:
In SBT IncrementalCommon.externalBinaryModified can only return true if "analysis(dependsOn)" returns None.
In scala-ide this "analysis" parameter is actually an adaptation of SbtInputs.analysisMap which converts Maybe to Option and currently this function can not returns Maybe.nothing, meaning that "analysis(dependsOn)" never returns None, so IncrementalCommon.externalBinaryModified will always return false.
As far as I understand SbtInputs.analysisMap supposed to return dependency information for a given file.
Returning Maybe.nothing means that this file should be treated as an external dependency and no further analysis is possible.
Returning Maybe.just(Analysis.Empty) means that analysis completed but results are empty (no sources, no dependencies, no products, nothing).
Fix:
- create Java and Scala projects as per screenshot
- comment out "public int z = 42;" line in Zzz and and save the file
expected behaviour: Xxx has an error (value z is not a member of zzz.Zzz)
actual behaviour: no errors until you clean and rebuild project xxx explicitly.
Cause:
In SBT IncrementalCommon.externalBinaryModified can only return true if "analysis(dependsOn)" returns None.
In scala-ide this "analysis" parameter is actually an adaptation of SbtInputs.analysisMap which converts Maybe to Option and currently this function can not returns Maybe.nothing, meaning that "analysis(dependsOn)" never returns None, so IncrementalCommon.externalBinaryModified will always return false.
As far as I understand SbtInputs.analysisMap supposed to return dependency information for a given file.
Returning Maybe.nothing means that this file should be treated as an external dependency and no further analysis is possible.
Returning Maybe.just(Analysis.Empty) means that analysis completed but results are empty (no sources, no dependencies, no products, nothing).
Fix:
diff --git a/org.scala-ide.sdt.core/src/org/scalaide/core/internal/builder/zinc/SbtInputs.scala b/org.scala-ide.sdt.core/src/org/scalaide/core/internal/builder/zinc
index ec79c83..9223f83 100644
--- a/org.scala-ide.sdt.core/src/org/scalaide/core/internal/builder/zinc/SbtInputs.scala
+++ b/org.scala-ide.sdt.core/src/org/scalaide/core/internal/builder/zinc/SbtInputs.scala
@@ -52,7 +52,7 @@ class SbtInputs(installation: IScalaInstallation,
def analysisMap(f: File): Maybe[Analysis] =
if (f.isFile)
- Maybe.just(Analysis.Empty)
+ Maybe.nothing[Analysis]()
else
allProjects.find(_.sourceOutputFolders.map(_._2.getLocation().toFile()).toSeq contains f) map (_.buildManager) match {
case Some(sbtManager: EclipseSbtBuildManager) => Maybe.just(sbtManager.latestAnalysis(incOptions))
Leave a comment
on 2014-11-24 13:32 *
By Iulian Dragos
Would you mind opening a PR with your changes?
on 2014-11-24 23:19 *
By viktor.dragomiretskyy434936
on 2014-12-03 22:07 *
By viktor.dragomiretskyy434936
Can we reopen this, since PR was reverted?
No file chosen
You have an empty file field. Please select or remove it.
Name | Size | ||
---|---|---|---|
two-projects.png | 84.7 KB | Added by viktor.dragomiretskyy434936 on 2014-11-20 - Upload new version |