From c7afa374e9ff43ef8e4daaab1219af2ee507eb2d Mon Sep 17 00:00:00 2001 From: Phil Walker Date: Tue, 14 Nov 2017 21:17:20 -0700 Subject: [PATCH 1/3] extended scope of eclipseOutput setting to cover eclipse classes bin directory --- .gitignore | 3 +++ .../com/typesafe/sbteclipse/core/Eclipse.scala | 13 ++++++++++++- .../com/typesafe/sbteclipse/core/Eclipse.scala | 13 ++++++++++++- src/sbt-test/sbteclipse/02-contents/tasks.sbt | 2 ++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2b5ad6a1..7656807b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ out/ # Mac .DS_Store + +# Vim +*.swp diff --git a/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala b/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala index 429a140c..525cf656 100644 --- a/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala +++ b/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala @@ -305,11 +305,22 @@ private object Eclipse extends EclipseSDTConfig { srcEntries <- srcEntriesIoSeq.toList.sequence; linkEntries <- srcLinkEntriesIoSeq.toList.sequence ) yield { + val eodirs: Seq[String] = for { + (fa: File, ta: Option[File]) <- srcDirectories + eopath = ta match { + case Some(dd) => relativize(baseDirectory, dd).toString + case None => "" + } + } yield eopath + val classDirectory = eodirs.filter { _.nonEmpty }.distinct match { + case dir :: _ => dir + case _ => "bin" // this is the eclipse default + } val entries = srcEntries ++ linkEntries ++ (projectDependencies map EclipseClasspathEntry.Project) ++ (externalDependencies map libEntry(buildDirectory, baseDirectory, relativizeLibs, state)) ++ (Seq(jreContainer) map EclipseClasspathEntry.Con) ++ - (Seq("bin") map EclipseClasspathEntry.Output) + (Seq(classDirectory) map EclipseClasspathEntry.Output) { entries map (_.toXml) } } } diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala b/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala index fe34f9f6..580982de 100644 --- a/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala +++ b/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala @@ -305,11 +305,22 @@ private object Eclipse extends EclipseSDTConfig { srcEntries <- srcEntriesIoSeq.toList.sequence; linkEntries <- srcLinkEntriesIoSeq.toList.sequence ) yield { + val eodirs: Seq[String] = for { + (fa: File, ta: Option[File]) <- srcDirectories + eopath = ta match { + case Some(dd) => relativize(baseDirectory, dd).toString + case None => "" + } + } yield eopath + val classDirectory = eodirs.filter { _.nonEmpty }.distinct match { + case dir :: _ => dir + case _ => "bin" // this is the eclipse default + } val entries = srcEntries ++ linkEntries ++ (projectDependencies map EclipseClasspathEntry.Project) ++ (externalDependencies map libEntry(buildDirectory, baseDirectory, relativizeLibs, state)) ++ (Seq(jreContainer) map EclipseClasspathEntry.Con) ++ - (Seq("bin") map EclipseClasspathEntry.Output) + (Seq(classDirectory) map EclipseClasspathEntry.Output) { entries map (_.toXml) } } } diff --git a/src/sbt-test/sbteclipse/02-contents/tasks.sbt b/src/sbt-test/sbteclipse/02-contents/tasks.sbt index 79997097..9aab3b89 100644 --- a/src/sbt-test/sbteclipse/02-contents/tasks.sbt +++ b/src/sbt-test/sbteclipse/02-contents/tasks.sbt @@ -208,6 +208,8 @@ TaskKey[Unit]("verify-classpath-xml-subc") := { error("""Expected .classpath of subc project to contain """) if (!(classpath.child contains )) error("""Expected .classpath of subc project to contain !""") + if (!(classpath.child contains )) + error("""Expected .classpath of subc project to contain """) if (!(project.child contains )) error("""Expected .project of subc project to contain !""") } From 03fb0e9ebd9a7220d857fafabb72447743a48a25 Mon Sep 17 00:00:00 2001 From: Phil Walker Date: Wed, 15 Nov 2017 12:43:15 -0700 Subject: [PATCH 2/3] renamed eodirs / eopaths to eclipseOutputDirs and eclipseOutputPaths --- .../com/typesafe/sbteclipse/core/Eclipse.scala | 8 ++++---- .../com/typesafe/sbteclipse/core/Eclipse.scala | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala b/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala index 525cf656..d46b5d77 100644 --- a/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala +++ b/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala @@ -305,14 +305,14 @@ private object Eclipse extends EclipseSDTConfig { srcEntries <- srcEntriesIoSeq.toList.sequence; linkEntries <- srcLinkEntriesIoSeq.toList.sequence ) yield { - val eodirs: Seq[String] = for { + val eclipseOutputDirs: Seq[String] = for { (fa: File, ta: Option[File]) <- srcDirectories - eopath = ta match { + eclipseOutputPath = ta match { case Some(dd) => relativize(baseDirectory, dd).toString case None => "" } - } yield eopath - val classDirectory = eodirs.filter { _.nonEmpty }.distinct match { + } yield eclipseOutputPath + val classDirectory = eclipseOutputDirs.filter { _.nonEmpty }.distinct match { case dir :: _ => dir case _ => "bin" // this is the eclipse default } diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala b/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala index 580982de..d4ec003d 100644 --- a/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala +++ b/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala @@ -305,14 +305,14 @@ private object Eclipse extends EclipseSDTConfig { srcEntries <- srcEntriesIoSeq.toList.sequence; linkEntries <- srcLinkEntriesIoSeq.toList.sequence ) yield { - val eodirs: Seq[String] = for { + val eclipseOutputDirs: Seq[String] = for { (fa: File, ta: Option[File]) <- srcDirectories - eopath = ta match { + eclipseOutputPath = ta match { case Some(dd) => relativize(baseDirectory, dd).toString case None => "" } - } yield eopath - val classDirectory = eodirs.filter { _.nonEmpty }.distinct match { + } yield eclipseOutputPath + val classDirectory = eclipseOutputDirs.filter { _.nonEmpty }.distinct match { case dir :: _ => dir case _ => "bin" // this is the eclipse default } From b4d909ced6311b9e81fe3fb2dea745b423b65e10 Mon Sep 17 00:00:00 2001 From: Phil Walker Date: Thu, 16 Nov 2017 12:41:01 -0700 Subject: [PATCH 3/3] simplify: get output dir from srcEntries rather than srcDirectories --- .../com/typesafe/sbteclipse/core/Eclipse.scala | 15 +++++---------- .../com/typesafe/sbteclipse/core/Eclipse.scala | 15 +++++---------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala b/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala index d46b5d77..308e045e 100644 --- a/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala +++ b/src/main/scala-sbt-0.13/com/typesafe/sbteclipse/core/Eclipse.scala @@ -305,16 +305,11 @@ private object Eclipse extends EclipseSDTConfig { srcEntries <- srcEntriesIoSeq.toList.sequence; linkEntries <- srcLinkEntriesIoSeq.toList.sequence ) yield { - val eclipseOutputDirs: Seq[String] = for { - (fa: File, ta: Option[File]) <- srcDirectories - eclipseOutputPath = ta match { - case Some(dd) => relativize(baseDirectory, dd).toString - case None => "" - } - } yield eclipseOutputPath - val classDirectory = eclipseOutputDirs.filter { _.nonEmpty }.distinct match { - case dir :: _ => dir - case _ => "bin" // this is the eclipse default + def classDirectory = srcEntries.flatMap { _.output }.distinct match { + case Nil => + "bin" + case dir :: _ => + dir } val entries = srcEntries ++ linkEntries ++ (projectDependencies map EclipseClasspathEntry.Project) ++ diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala b/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala index d4ec003d..bc206c14 100644 --- a/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala +++ b/src/main/scala-sbt-1.0/com/typesafe/sbteclipse/core/Eclipse.scala @@ -305,16 +305,11 @@ private object Eclipse extends EclipseSDTConfig { srcEntries <- srcEntriesIoSeq.toList.sequence; linkEntries <- srcLinkEntriesIoSeq.toList.sequence ) yield { - val eclipseOutputDirs: Seq[String] = for { - (fa: File, ta: Option[File]) <- srcDirectories - eclipseOutputPath = ta match { - case Some(dd) => relativize(baseDirectory, dd).toString - case None => "" - } - } yield eclipseOutputPath - val classDirectory = eclipseOutputDirs.filter { _.nonEmpty }.distinct match { - case dir :: _ => dir - case _ => "bin" // this is the eclipse default + def classDirectory = srcEntries.flatMap { _.output }.distinct match { + case Nil => + "bin" + case dir :: _ => + dir } val entries = srcEntries ++ linkEntries ++ (projectDependencies map EclipseClasspathEntry.Project) ++