Permalink
Browse files

Corrected dependency file location, added output directory to classpa…

…th for correct building on startup, clean now also removes dependency file as it should from the beginning. One outstanding issue - writing to dependency file doesn't really update it, needs investigation
  • Loading branch information...
1 parent 7256fe8 commit f4e1c2d7f976928d24533bb6e8b7ad32df954aff @hubertp hubertp committed Feb 10, 2011
@@ -19,9 +19,9 @@ import scala.tools.eclipse.util.{ EclipseResource, FileUtils }
import scala.tools.eclipse.buildmanager.{BuildReporter}
trait EclipseBuildManager extends BuildManager {
- def build(addedOrUpdated: Set[IFile], removed: Set[IFile], monitor: IProgressMonitor): Unit
+ def build(addedOrUpdated: Set[IFile], removed: Set[IFile])(implicit monitor: IProgressMonitor = null): Unit
var depFile: IFile
var hasErrors = false
def invalidateAfterLoad: Boolean
- def clean(monitor: IProgressMonitor): Unit
+ def clean(implicit monitor: IProgressMonitor): Unit
}
@@ -76,7 +76,7 @@ class ScalaBuilder extends IncrementalProjectBuilder {
if (monitor != null)
monitor.beginTask("build all", 100)
- project.build(addedOrUpdated, removed, monitor)
+ project.build(addedOrUpdated, removed)(monitor)
val depends = project.externalDepends.toList.toArray
if (allSourceFiles.exists(FileUtils.hasBuildErrors(_)))
@@ -100,7 +100,7 @@ class ScalaProject(val underlying: IProject) {
}
}, monitor)
- def clearBuildErrors(monitor: IProgressMonitor) =
+ def clearBuildErrors(implicit monitor: IProgressMonitor) =
underlying.getWorkspace.run(new IWorkspaceRunnable {
def run(monitor: IProgressMonitor) = {
underlying.deleteMarkers(plugin.problemMarkerId, true, IResource.DEPTH_ZERO)
@@ -135,6 +135,17 @@ class ScalaProject(val underlying: IProject) {
def classpath: Seq[IPath] = {
val path = new LinkedHashSet[IPath]
+
+ def ouputInClasspath(outputLocation0: IPath, jProject: IJavaProject) {
+ val outputLocation = if (outputLocation0 != null) outputLocation0 else javaProject.getOutputLocation
+
+ if (outputLocation != null) {
+ val absPath = plugin.workspaceRoot.findMember(outputLocation)
+ if (absPath != null) path += absPath.getLocation
+ }
+
+ }
+
def classpath(javaProject: IJavaProject, exportedOnly: Boolean): Unit = {
val cpes = javaProject.getResolvedClasspath(true)
@@ -144,12 +155,7 @@ class ScalaProject(val underlying: IProject) {
if (JavaProject.hasJavaNature(depProject)) {
val depJava = JavaCore.create(depProject)
for (cpe <- depJava.getResolvedClasspath(true) if cpe.getEntryKind == IClasspathEntry.CPE_SOURCE) {
- val specificOutputLocation = cpe.getOutputLocation
- val outputLocation = if (specificOutputLocation != null) specificOutputLocation else depJava.getOutputLocation
- if (outputLocation != null) {
- val absPath = plugin.workspaceRoot.findMember(outputLocation)
- if (absPath != null) path += absPath.getLocation
- }
+ ouputInClasspath(cpe.getOutputLocation, depJava)
}
classpath(depJava, true)
}
@@ -161,6 +167,8 @@ class ScalaProject(val underlying: IProject) {
else
path += cpe.getPath
}
+ case IClasspathEntry.CPE_SOURCE =>
+ ouputInClasspath(cpe.getOutputLocation, javaProject)
case _ =>
}
}
@@ -265,7 +273,7 @@ class ScalaProject(val underlying: IProject) {
}
}
- def cleanOutputFolders(monitor: IProgressMonitor) = {
+ def cleanOutputFolders(implicit monitor: IProgressMonitor) = {
def delete(container: IContainer, deleteDirs: Boolean)(f: String => Boolean): Unit =
if (container.exists()) {
container.members.foreach {
@@ -466,31 +474,33 @@ class ScalaProject(val underlying: IProject) {
/* If true, then it means that all source files have to be reloaded */
def prepareBuild(): Boolean = if (!hasBeenBuilt) buildManager.invalidateAfterLoad else false
- def build(addedOrUpdated: Set[IFile], removed: Set[IFile], monitor: IProgressMonitor) {
+ def build(addedOrUpdated: Set[IFile], removed: Set[IFile])(implicit monitor: IProgressMonitor) {
if (addedOrUpdated.isEmpty && removed.isEmpty)
return
hasBeenBuilt = true
- clearBuildErrors(monitor)
- buildManager.build(addedOrUpdated, removed, monitor)
+ clearBuildErrors
+ buildManager.build(addedOrUpdated, removed)
refreshOutput
// Already performs saving the dependencies
}
- def clean(monitor: IProgressMonitor) = {
+ def clean(implicit monitor: IProgressMonitor) = {
underlying.deleteMarkers(plugin.problemMarkerId, true, IResource.DEPTH_INFINITE)
resetCompilers
- cleanOutputFolders(monitor)
+ cleanOutputFolders
}
- def resetBuildCompiler {
+ def resetBuildCompiler(implicit monitor: IProgressMonitor) {
+ if (buildManager0 != null)
+ buildManager0.clean(monitor)
buildManager0 = null
hasBeenBuilt = false
}
- def resetCompilers = {
+ def resetCompilers(implicit monitor: IProgressMonitor = null) = {
resetBuildCompiler
resetPresentationCompiler
}
@@ -16,7 +16,7 @@ import scala.tools.eclipse.util.{ EclipseResource, FileUtils }
class EclipseRefinedBuildManager(project : ScalaProject, settings0: Settings)
extends RefinedBuildManager(settings0) with EclipseBuildManager {
- var depFile:IFile = project.underlying.getFile(project.underlying.getName() + ".scala_dependencies")
+ var depFile:IFile = project.underlying.getFile(".scala_dependencies")
var monitor : IProgressMonitor = _
val pendingSources = new HashSet[IFile]
@@ -54,7 +54,7 @@ class EclipseRefinedBuildManager(project : ScalaProject, settings0: Settings)
}
- def build(addedOrUpdated : Set[IFile], removed : Set[IFile], pm : IProgressMonitor) {
+ def build(addedOrUpdated : Set[IFile], removed : Set[IFile])(implicit pm : IProgressMonitor) {
monitor = pm
pendingSources ++= addedOrUpdated
@@ -103,7 +103,7 @@ class EclipseRefinedBuildManager(project : ScalaProject, settings0: Settings)
}
}
- def clean(monitor: IProgressMonitor) {
+ def clean(implicit monitor: IProgressMonitor) {
depFile.delete(true, false, monitor)
}
@@ -20,7 +20,7 @@ class EclipseSbtBuildManager(project: ScalaProject, settings0: Settings)
def removeFiles(files: scala.collection.Set[AbstractFile]) {}
def addSourceFiles(files: scala.collection.Set[AbstractFile]) {}
def update(added: scala.collection.Set[AbstractFile], removed: scala.collection.Set[AbstractFile]) {}
- def build(addedOrUpdated: Set[IFile], removed: Set[IFile], monitor: IProgressMonitor): Unit = {}
- def clean(monitor: IProgressMonitor) {}
+ def build(addedOrUpdated: Set[IFile], removed: Set[IFile])(implicit monitor: IProgressMonitor): Unit = {}
+ def clean(implicit monitor: IProgressMonitor) {}
def invalidateAfterLoad: Boolean = false
}

0 comments on commit f4e1c2d

Please sign in to comment.