Skip to content
Browse files

Fixed compile errors after merge

  • Loading branch information...
1 parent fa81ea1 commit 4f202c9863b4ec751fce7d2ecd1c0332f0308f8f @musk committed Apr 30, 2011
Showing with 72 additions and 73 deletions.
  1. +72 −73 src/main/scala/de/element34/sbteclipsify/ClasspathFile.scala
View
145 src/main/scala/de/element34/sbteclipsify/ClasspathFile.scala
@@ -64,7 +64,7 @@ class ClasspathFile(project: Project, log: Logger) {
* @return <code>Some(error)</code>, where error designates the error message to display, when an error occures else returns <code>None</code>
*/
def writeFile: Option[String] = {
- val entries = buildEntries()
+ val entries = buildEntries()
lazy val classpathContent = """<?xml version="1.0" encoding="UTF-8" ?>""" +
"\n<classpath>" +
@@ -73,28 +73,25 @@ class ClasspathFile(project: Project, log: Logger) {
createOrReplaceWith(classpathContent)
}
- def classpaths() : List[ClasspathEntry] = {
+ def classpaths(): List[ClasspathEntry] = {
project match {
- case p : BasicScalaProject => {
- val pf = (
- p.unmanagedClasspath
+ case p: BasicScalaProject => {
+ val pf = (p.unmanagedClasspath
+++ p.managedClasspath(p.config("compile"))
+++ p.managedClasspath(p.config("test"))
+++ p.managedClasspath(p.config("runtime")) // to be able to do "Run As ..."
- +++ p.jarsOfProjectDependencies
- )
- pf.getPaths.toList.map{ x =>
+ +++ p.jarsOfProjectDependencies)
+ pf.getPaths.toList.map { x =>
ClasspathEntry(Library, x)
}
}
- case p : UnmanagedClasspathProject => {
- p.unmanagedClasspath.getPaths.toList.map{ x =>
+ case p: UnmanagedClasspathProject => {
+ p.unmanagedClasspath.getPaths.toList.map { x =>
ClasspathEntry(Library, x)
}
}
- case p : BasicScalaPaths => {
- val dependencies = p.dependencyPath
- getDependencyEntries(dependencies)
+ case p: BasicScalaPaths => {
+ getDependencyEntries(p.dependencyPath)
}
case _ => Nil
}
@@ -103,34 +100,36 @@ class ClasspathFile(project: Project, log: Logger) {
def buildEntries() = {
val referencedProjects = project.info.dependencies.toList
- val l = get(_.eclipseProjectNature) match {
- case ProjectNature.Scala =>
+ val l = project.eclipseProjectNature match {
+ case ProjectNature.Scala =>
getJavaPaths ++ getScalaPaths ++ getProjectPath ++ getSbtJarForSbtProject ++
- getResourcesPaths ++
- getReferencedProjects(referencedProjects) ++ getReferencedProjectsDependencies(referencedProjects) ++
- classpaths() ++
- getPluginEntries ++
- List(ClasspathEntry(Container, scalaContainer),
- ClasspathEntry(Container, javaContainer),
- ClasspathEntry(Output, project.asInstanceOf[MavenStyleScalaPaths].mainCompilePath.projectRelativePath))
- case ProjectNature.Java =>
+ getResourcesPaths ++
+ getReferencedProjects(referencedProjects) ++ getReferencedProjectsDependencies(referencedProjects) ++
+ classpaths() ++
+ getPluginEntries ++
+ List(ClasspathEntry(Container, scalaContainer),
+ ClasspathEntry(Container, javaContainer),
+ ClasspathEntry(Output, project.asInstanceOf[MavenStyleScalaPaths].mainCompilePath.projectRelativePath))
+ case ProjectNature.Java =>
getJavaPaths ++ getProjectPath ++
- getResourcesPaths ++
- getReferencedProjects(referencedProjects) ++ getReferencedProjectsDependencies(referencedProjects) ++
- classpaths() ++
- getPluginEntries ++
- List(ClasspathEntry(Container, javaContainer),
- ClasspathEntry(Output, project.asInstanceOf[MavenStyleScalaPaths].mainCompilePath.projectRelativePath))
- case ProjectNature.Android =>
- getJavaPaths ++ getProjectPath ++
- getDependencyEntries(dependencies) ++ getDependencyEntries(managedDependencies) ++
- getPluginEntries ++
- List(ClasspathEntry(Container, javaContainer),
- ClasspathEntry(Output, project.asInstanceOf[MavenStyleScalaPaths].mainCompilePath.projectRelativePath))
+ getResourcesPaths ++
+ getReferencedProjects(referencedProjects) ++ getReferencedProjectsDependencies(referencedProjects) ++
+ classpaths() ++
+ getPluginEntries ++
+ List(ClasspathEntry(Container, javaContainer),
+ ClasspathEntry(Output, project.asInstanceOf[MavenStyleScalaPaths].mainCompilePath.projectRelativePath))
+ case ProjectNature.Android =>
+ getJavaPaths ++ getProjectPath ++
+ getResourcesPaths ++
+ getReferencedProjects(referencedProjects) ++ getReferencedProjectsDependencies(referencedProjects) ++
+ classpaths() ++
+ getPluginEntries ++
+ List(ClasspathEntry(Container, javaContainer),
+ ClasspathEntry(Output, project.asInstanceOf[MavenStyleScalaPaths].mainCompilePath.projectRelativePath))
}
l.removeDuplicates
}
-
+
/**
* replaces the current content of the .classpath file
* @return <code>Some(error)</code> when error occurs else returns <code>None</code>
@@ -143,36 +142,36 @@ class ClasspathFile(project: Project, log: Logger) {
FileUtilities.write(classpathFile, content, forName("UTF-8"), log)
}
}
-
- def getReferencedProjects(projects: List[Project]) : List[ClasspathEntry] = {
- projects.map { proj =>
- ClasspathEntry(Source, "/" + proj.name, List(("combineaccessrules", "false")))
- }
- }
-
- def getReferencedProjectsDependencies(projects: List[Project]) : List[ClasspathEntry] = {
- projects.foldLeft(List[ClasspathEntry]()) { (list, proj) =>
- val basicScalaPaths = proj.asInstanceOf[BasicScalaPaths]
- val dependencies = basicScalaPaths.dependencyPath
- val managedDependencies = basicScalaPaths.managedDependencyPath
-
- list ++
- getReferencedProjectDependencyEntries(proj.name, proj.info.projectPath, dependencies) ++
- getReferencedProjectDependencyEntries(proj.name, proj.info.projectPath, managedDependencies)
- }
- }
- def getReferencedProjectDependencyEntries(extProjName: String, extProjPath: Path, basePath: Path): List[ClasspathEntry] = {
- import Path._
- val exclude: List[PathFinder] = constructPathFinder(basePath, srcPatterns, str => GlobFilter("*" + str))
- val baseFinder: PathFinder = basePath ** GlobFilter("*.jar")
- val finder: PathFinder = exclude.foldLeft(baseFinder)(_ --- _)
-
- val jarPaths = finder.get.flatMap(Path.relativize(extProjPath, _)).toList
- jarPaths.map { path =>
- val eclipsePath = "/" + extProjName + "/" + path.relativePath
- ClasspathEntry(Library, eclipsePath, Some(eclipsePath))
- }
- }
+
+ def getReferencedProjects(projects: List[Project]): List[ClasspathEntry] = {
+ projects.map { proj =>
+ ClasspathEntry(Source, "/" + proj.name, List(("combineaccessrules", "false")))
+ }
+ }
+
+ def getReferencedProjectsDependencies(projects: List[Project]): List[ClasspathEntry] = {
+ projects.foldLeft(List[ClasspathEntry]()) { (list, proj) =>
+ val basicScalaPaths = proj.asInstanceOf[BasicScalaPaths]
+ val dependencies = basicScalaPaths.dependencyPath
+ val managedDependencies = basicScalaPaths.managedDependencyPath
+
+ list ++
+ getReferencedProjectDependencyEntries(proj.name, proj.info.projectPath, dependencies) ++
+ getReferencedProjectDependencyEntries(proj.name, proj.info.projectPath, managedDependencies)
+ }
+ }
+ def getReferencedProjectDependencyEntries(extProjName: String, extProjPath: Path, basePath: Path): List[ClasspathEntry] = {
+ import Path._
+ val exclude: List[PathFinder] = constructPathFinder(basePath, srcPatterns, str => GlobFilter("*" + str))
+ val baseFinder: PathFinder = basePath ** GlobFilter("*.jar")
+ val finder: PathFinder = exclude.foldLeft(baseFinder)(_ --- _)
+
+ val jarPaths = finder.get.flatMap(Path.relativize(extProjPath, _)).toList
+ jarPaths.map { path =>
+ val eclipsePath = "/" + extProjName + "/" + path.relativePath
+ ClasspathEntry(Library, eclipsePath, Some(eclipsePath))
+ }
+ }
/**
* @return <code>List[ClasspathEntry]</code> containing entries for each jar contained in path.
@@ -183,7 +182,7 @@ class ClasspathFile(project: Project, log: Logger) {
val exclude: List[PathFinder] = constructPathFinder(basePath, srcPatterns, str => GlobFilter("*" + str))
val baseFinder: PathFinder = basePath ** GlobFilter("*.jar")
val finder: PathFinder = exclude.foldLeft(baseFinder)(_ --- _)
-
+
val jarPaths: List[Path] = finder.get.flatMap(Path.relativize(project.info.projectPath, _)).toList
jarPaths.map(path => ClasspathEntry(Library, path.relativePath, findSource(basePath, path)))
}
@@ -225,19 +224,19 @@ class ClasspathFile(project: Project, log: Logger) {
import ClasspathConversions._
val paths = project.asInstanceOf[MavenStyleScalaPaths]
val entries: List[ClasspathEntry] = if (paths.mainScalaSourcePath.exists) {
- ClasspathEntry(Source, paths.mainScalaSourcePath.relativePath, FilterChain(IncludeFilter("**/*.scala"), ExcludeFilter("**/.svn/|**/CVS/"))) :: Nil
+ ClasspathEntry(Source, paths.mainScalaSourcePath.relativePath, FilterChain(IncludeFilter("**/*.scala"), ExcludeFilter("**/.svn/|**/CVS/"))) :: Nil
} else Nil
if (paths.testScalaSourcePath.exists) {
- ClasspathEntry(Source, paths.testScalaSourcePath.relativePath, paths.testCompilePath.relativePath, FilterChain(IncludeFilter("**/*.scala"), ExcludeFilter("**/.svn/|**/CVS/"))) :: entries
+ ClasspathEntry(Source, paths.testScalaSourcePath.relativePath, paths.testCompilePath.relativePath, FilterChain(IncludeFilter("**/*.scala"), ExcludeFilter("**/.svn/|**/CVS/"))) :: entries
} else entries
}
/**
* @return <code>List[ClasspathEntry]</code> for main java source and main java test source path
*/
def getJavaPaths: List[ClasspathEntry] = {
- import ClasspathConversions._
+ import ClasspathConversions._
val paths = project.asInstanceOf[MavenStyleScalaPaths]
val entries = new ListBuffer[ClasspathEntry]()
if (paths.mainJavaSourcePath.exists) {
@@ -258,9 +257,9 @@ class ClasspathFile(project: Project, log: Logger) {
/**
* @return <code>List[ClasspathEntry]</code> for main java source and main java test source path
*/
- def getResourcesPaths: List[ClasspathEntry] = {
- val paths = project.asInstanceOf[MavenStyleScalaPaths]
- var entries : List[ClasspathEntry] = Nil
+ def getResourcesPaths: List[ClasspathEntry] = {
+ val paths = project.asInstanceOf[MavenStyleScalaPaths]
+ var entries: List[ClasspathEntry] = Nil
if (paths.mainResourcesPath.exists) {
entries = ClasspathEntry(Source, paths.mainResourcesPath.projectRelativePath) :: entries
}

0 comments on commit 4f202c9

Please sign in to comment.
Something went wrong with that request. Please try again.