Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: typesafehub/sbteclipse
...
head fork: typesafehub/sbteclipse
Checking mergeability… Don't worry, you can still create the pull request.
  • 13 commits
  • 11 files changed
  • 0 commit comments
  • 2 contributors
View
18 README.rst
@@ -7,20 +7,22 @@ Plugin for `sbt`_ to create `Eclipse`_ project definitions. Please see the `Docu
For the impatient
-----------------
-- sbteclipse requires sbt 0.11.2!
+- sbteclipse requires sbt 0.11.3 or 0.12.0-Beta2!
-- Add sbteclipse to your plugin definition:
+- Add sbteclipse to your plugin definition::
-::
+ addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
- addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
+- For sbt 0.12.0-Beta2 you need::
-- In sbt use the command *eclipse* to create Eclipse project files:
+ addSbtPlugin(
+ "com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1",
+ sbtVersion = "0.12.0-Beta2"
+ )
-::
-
- > eclipse
+- In sbt use the command *eclipse* to create Eclipse project files::
+ > eclipse
- In Eclipse use the *Import Wizard* to import *Existing Projects into Workspace*
View
12 notes/2.1.0-M2.markdown
@@ -0,0 +1,12 @@
+This is the 2.0.0-M1 pre-release of [sbteclipse](https://github.com/typesafehub/sbteclipse/), an [sbt](https://github.com/harrah/xsbt/) plugin for creating [Eclipse](http://www.eclipse.org/) project definitions.
+
+These are the most important changes between sbteclipse 2.1.0 and 2.0.x:
+
+* [Issue #79](https://github.com/typesafehub/sbteclipse/issues/79): Add setting to always use absolute paths for library dependencies
+* [Issue #80](https://github.com/typesafehub/sbteclipse/issues/80): Add setting for different target directories
+* [Issue #52](https://github.com/typesafehub/sbteclipse/issues/52): Customization of generated files
+* [Issue #100](https://github.com/typesafehub/sbteclipse/issues/100): Remove special treatment for continuations plugin
+* [Issue #76](https://github.com/typesafehub/sbteclipse/issues/76): Add setting to skip individual projects
+* [Issue #102](https://github.com/typesafehub/sbteclipse/issues/102): Print successfully created projects on separate lines
+
+Please see the [Documentation](http://github.com/typesafehub/sbteclipse/wiki/) for information about installing and using sbteclipse.
View
56 project/Build.scala
@@ -1,28 +1,8 @@
-/*
- * Copyright 2011 Typesafe Inc.
- *
- * This work is based on the original contribution of WeigleWilczek.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
import com.typesafe.sbtscalariform.ScalariformPlugin._
-import name.heikoseeberger.sbtproperties.PropertiesPlugin._
-import posterous.Publish._
-import sbtrelease._
import sbt._
import sbt.Keys._
import sbt.ScriptedPlugin._
+import sbtrelease.ReleasePlugin._
object Build extends Build {
@@ -31,8 +11,7 @@ object Build extends Build {
file("."),
aggregate = Seq(sbteclipseCore, sbteclipsePlugin),
settings = commonSettings ++ Seq(
- publishArtifact := false,
- aggregate in Posterous := false
+ publishArtifact := false
)
)
@@ -56,38 +35,13 @@ object Build extends Build {
organization := "com.typesafe.sbteclipse",
// version is defined in version.sbt in order to support sbt-release
scalacOptions ++= Seq("-unchecked", "-deprecation"),
- publishTo <<= (version)(version =>
- Some(if (version endsWith "SNAPSHOT") Classpaths.typesafeSnapshots else Classpaths.typesafeResolver)
- ),
+ publishTo <<= isSnapshot(if (_) Some(Classpaths.typesafeSnapshots) else Some(Classpaths.typesafeResolver)),
sbtPlugin := true,
publishMavenStyle := false,
publishArtifact in (Compile, packageDoc) := false,
publishArtifact in (Compile, packageSrc) := false
) ++
- posterousSettings ++ Seq(
- (email in Posterous) <<= PropertiesKeys.properties(_ get "posterous.email"),
- (password in Posterous) <<= PropertiesKeys.properties(_ get "posterous.password")
- ) ++
- propertiesSettings ++
- Release.releaseSettings ++ Seq(
- ReleaseKeys.releaseProcess <<= thisProjectRef { ref =>
- import ReleaseStateTransformations._
- Seq[ReleasePart](
- initialGitChecks,
- checkSnapshotDependencies,
- releaseTask(check in Posterous in ref),
- inquireVersions,
- runTest,
- setReleaseVersion,
- commitReleaseVersion,
- tagRelease,
- releaseTask(publish in Global in ref),
- releaseTask(publish in Posterous in ref),
- setNextVersion,
- commitNextVersion
- )
- }
- ) ++
scalariformSettings ++
- scriptedSettings
+ scriptedSettings ++
+ releaseSettings
}
View
15 project/plugins.sbt
@@ -1,17 +1,8 @@
-resolvers ++= Seq(
- "gseitz@github" at "http://gseitz.github.com/maven/",
- Resolver.url("heikoseeberger", new URL("http://hseeberger.github.com/releases"))(Resolver.ivyStylePatterns)
-)
-
-addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.4")
-
-addSbtPlugin("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.1")
-
-addSbtPlugin("name.heikoseeberger.sbtproperties" % "sbtproperties" % "1.0.1")
+addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.5")
-addSbtPlugin("net.databinder" % "posterous-sbt" % "0.3.2")
+addSbtPlugin("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.4.0")
libraryDependencies <+= (sbtVersion)(sbtVersion =>
- "org.scala-tools.sbt" %% "scripted-plugin" % sbtVersion
+ "org.scala-sbt" %% "scripted-plugin" % sbtVersion
)
View
34 sbteclipse-core/src/main/scala/com/typesafe/sbteclipse/core/Eclipse.scala
@@ -24,6 +24,7 @@ import EclipsePlugin.{
EclipseClasspathEntryTransformerFactory,
EclipseRewriteRuleTransformerFactory,
EclipseCreateSrc,
+ EclipseProjectFlavor,
EclipseExecutionEnvironment,
EclipseKeys
}
@@ -69,6 +70,14 @@ private object Eclipse {
val StandardVmType = "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"
+ val ScalaBuilder = "org.scala-ide.sdt.core.scalabuilder"
+
+ val ScalaNature = "org.scala-ide.sdt.core.scalanature"
+
+ val JavaBuilder = "org.eclipse.jdt.core.javabuilder"
+
+ val JavaNature = "org.eclipse.jdt.core.javanature"
+
def eclipseCommand(commandName: String): Command =
Command(commandName)(_ => parser)((state, args) => action(args.toMap, state))
@@ -122,6 +131,7 @@ private object Eclipse {
jreContainer(executionEnvironmentArg orElse executionEnvironment(ref, state)),
preTasks(ref, state),
relativizeLibs(ref, state),
+ builderAndNatures(projectFlavor(ref, state)),
state
)
)
@@ -162,6 +172,7 @@ private object Eclipse {
jreContainer: String,
preTasks: Seq[(TaskKey[_], ProjectRef)],
relativizeLibs: Boolean,
+ builderAndNatures: (String, Seq[String]),
state: State)(
classpathEntryTransformer: Seq[EclipseClasspathEntry] => Seq[EclipseClasspathEntry],
classpathTransformers: Seq[RewriteRule],
@@ -176,7 +187,7 @@ private object Eclipse {
for {
_ <- executePreTasks(preTasks, state)
n <- io(name)
- _ <- saveXml(baseDirectory / ".project", new RuleTransformer(projectTransformers: _*)(projectXml(name)))
+ _ <- saveXml(baseDirectory / ".project", new RuleTransformer(projectTransformers: _*)(projectXml(name, builderAndNatures)))
cp <- classpath(
classpathEntryTransformer,
buildDirectory,
@@ -196,17 +207,16 @@ private object Eclipse {
def executePreTasks(preTasks: Seq[(TaskKey[_], ProjectRef)], state: State): IO[Unit] =
io(for ((preTask, ref) <- preTasks) evaluateTask(preTask, ref, state))
- def projectXml(name: String): Node =
+ def projectXml(name: String, builderAndNatures: (String, Seq[String])): Node =
<projectDescription>
<name>{ name }</name>
<buildSpec>
<buildCommand>
- <name>org.scala-ide.sdt.core.scalabuilder</name>
+ <name>{ builderAndNatures._1 }</name>
</buildCommand>
</buildSpec>
<natures>
- <nature>org.scala-ide.sdt.core.scalanature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
+ { builderAndNatures._2.map(n => <nature>{ n }</nature>) }
</natures>
</projectDescription>
@@ -273,10 +283,19 @@ private object Eclipse {
case None => JreContainer
}
+ def builderAndNatures(projectFlavor: EclipseProjectFlavor.Value) =
+ if (projectFlavor == EclipseProjectFlavor.Scala)
+ ScalaBuilder -> Seq(ScalaNature, JavaNature)
+ else
+ JavaBuilder -> Seq(JavaNature)
+
// Getting and transforming mandatory settings and task results
def name(ref: Reference, state: State): Validation[String] =
- setting(Keys.name in ref, state)
+ if (setting(EclipseKeys.useProjectId in ref, state).fold(_ => false, id))
+ setting(Keys.thisProject in ref, state) map (_.id)
+ else
+ setting(Keys.name in ref, state)
def buildDirectory(state: State): Validation[File] =
setting(Keys.baseDirectory in ThisBuild, state)
@@ -437,6 +456,9 @@ private object Eclipse {
def createSrc(ref: Reference, state: State): EclipseCreateSrc.ValueSet =
setting(EclipseKeys.createSrc in ref, state).fold(_ => EclipseCreateSrc.Default, id)
+ def projectFlavor(ref: Reference, state: State) =
+ setting(EclipseKeys.projectFlavor in ref, state).fold(_ => EclipseProjectFlavor.Scala, id)
+
def eclipseOutput(ref: ProjectRef, state: State): Option[String] =
setting(EclipseKeys.eclipseOutput in ref, state).fold(_ => None, id)
View
2  sbteclipse-core/src/main/scala/com/typesafe/sbteclipse/core/EclipseOpts.scala
@@ -25,4 +25,6 @@ private object EclipseOpts {
val SkipParents = "skip-parents"
val WithSource = "with-source"
+
+ val UseProjectId = "use-project-id"
}
View
17 sbteclipse-core/src/main/scala/com/typesafe/sbteclipse/core/EclipsePlugin.scala
@@ -65,6 +65,11 @@ trait EclipsePlugin {
"Download and link sources for library dependencies?"
)
+ val useProjectId: SettingKey[Boolean] = SettingKey(
+ prefix(UseProjectId),
+ "Use the sbt project id as the Eclipse project name?"
+ )
+
@deprecated("Use classpathTransformerFactories instead!", "2.1.0")
val classpathEntryTransformerFactory: SettingKey[EclipseTransformerFactory[Seq[EclipseClasspathEntry] => Seq[EclipseClasspathEntry]]] = SettingKey(
prefix("classpathEntryTransformerFactory"),
@@ -96,6 +101,11 @@ trait EclipsePlugin {
"The source kinds to be included."
)
+ val projectFlavor: SettingKey[EclipseProjectFlavor.Value] = SettingKey(
+ prefix("project-flavor"),
+ "The flavor of project (Scala or Java) to build."
+ )
+
val eclipseOutput: SettingKey[Option[String]] = SettingKey(
prefix("eclipse-output"),
"The optional output for Eclipse."
@@ -184,6 +194,13 @@ trait EclipsePlugin {
val All = ValueSet(Unmanaged, Managed, Source, Resource)
}
+ object EclipseProjectFlavor extends Enumeration {
+
+ val Scala = Value
+
+ val Java = Value
+ }
+
trait EclipseTransformerFactory[A] {
def createTransformer(ref: ProjectRef, state: State): Validation[A]
}
View
4 sbteclipse-plugin/src/sbt-test/sbteclipse/01-structure/test
@@ -1,7 +1,7 @@
# Default settings (skip-parents=true)
$ exec find . -path "*.classpath*" -delete
$ exec find . -path "*.project*" -delete
-$ exec find . -path "*/.settings" -delete
+$ exec find . -path "*/.settings*" -delete
$ exec find . -path "*/touch-pre-task" -delete
> eclipse
$ absent .classpath
@@ -27,7 +27,7 @@ $ absent sub/subc/touch-pre-task
# skip-parents=false
$ exec find . -path "*.classpath*" -delete
$ exec find . -path "*.project*" -delete
-$ exec find . -path "*/.settings" -delete
+$ exec find . -path "*/.settings*" -delete
> eclipse skip-parents=false
$ exists .classpath
$ exists .project
View
35 sbteclipse-plugin/src/sbt-test/sbteclipse/02-contents/build.sbt
@@ -11,9 +11,40 @@ version := "1.2.3"
TaskKey[Unit]("verify-project-xml") <<= baseDirectory map { dir =>
val projectDescription = XML.loadFile(dir / ".project")
+ // verifier method
+ def verify[A](name: String, expected: A, actual: A) =
+ if (actual != expected) error("Expected .project to contain %s '%s', but was '%s'!".format(name, expected, actual))
+ // project name
+ verify("name", "sbteclipse-test", (projectDescription \ "name").text)
+ // scala project nature
+ verify("buildCommand", "org.scala-ide.sdt.core.scalabuilder", (projectDescription \ "buildSpec" \ "buildCommand" \ "name").text)
+ verify("natures", Set("org.scala-ide.sdt.core.scalanature", "org.eclipse.jdt.core.javanature"), (projectDescription \ "natures" \ "nature").map(_.text).toSet)
+}
+
+TaskKey[Unit]("verify-project-xml-java") <<= baseDirectory map { dir =>
+ val projectDescription = XML.loadFile(dir / "java" / ".project")
+ // verifier method
+ def verify[A](name: String, expected: A, actual: A) =
+ if (actual != expected) error("Expected .project to contain %s '%s', but was '%s'!".format(name, expected, actual))
+ // project name
+ verify("name", "java", (projectDescription \ "name").text)
+ // java project nature
+ verify("buildCommand", "org.eclipse.jdt.core.javabuilder", (projectDescription \ "buildSpec" \ "buildCommand" \ "name").text)
+ verify("natures", "org.eclipse.jdt.core.javanature", (projectDescription \ "natures" \ "nature").text)
+}
+
+TaskKey[Unit]("verify-project-xml-subd") <<= baseDirectory map { dir =>
+ val projectDescription = XML.loadFile(dir / "sub" / "subd" / ".project")
+ val name = (projectDescription \ "name").text
+ if (name != "subd-id")
+ error("Expected .project to contain name '%s', but was '%s'!".format("subd-id", name))
+}
+
+TaskKey[Unit]("verify-project-xml-sube") <<= baseDirectory map { dir =>
+ val projectDescription = XML.loadFile(dir / "sub" / "sube" / ".project")
val name = (projectDescription \ "name").text
- if (name != "sbteclipse-test")
- error("Expected .project to contain name '%s', but was '%s'!".format("sbteclipse-test", name))
+ if (name != "sube")
+ error("Expected .project to contain name '%s', but was '%s'!".format("sube", name))
}
TaskKey[Unit]("verify-classpath-xml-root") <<= baseDirectory map { dir =>
View
29 sbteclipse-plugin/src/sbt-test/sbteclipse/02-contents/project/Build.scala
@@ -16,7 +16,7 @@ object Build extends Build {
),
retrieveManaged := true
),
- aggregate = Seq(sub)
+ aggregate = Seq(sub, javaProject)
)
lazy val sub: Project = Project(
@@ -32,7 +32,7 @@ object Build extends Build {
EclipseKeys.executionEnvironment := Some(EclipseExecutionEnvironment.JavaSE16),
EclipseKeys.withSource := true
),
- aggregate = Seq(suba, subb, subc)
+ aggregate = Seq(suba, subb, subc, subd, sube)
)
lazy val suba = Project(
@@ -111,4 +111,29 @@ object Build extends Build {
)
)
}
+
+ lazy val javaProject = Project(
+ "java",
+ new File("java"),
+ settings = Project.defaultSettings ++ Seq(
+ EclipseKeys.projectFlavor := EclipseProjectFlavor.Java
+ )
+ )
+
+ lazy val subd = Project(
+ id = "subd-id",
+ base = new File("sub/subd"),
+ settings = Project.defaultSettings ++ Seq(
+ name := "subd",
+ EclipseKeys.useProjectId := true
+ )
+ )
+
+ lazy val sube = Project(
+ id = "sube-id",
+ base = new File("sub/sube"),
+ settings = Project.defaultSettings ++ Seq(
+ name := "sube"
+ )
+ )
}
View
3  sbteclipse-plugin/src/sbt-test/sbteclipse/02-contents/test
@@ -3,6 +3,9 @@
$ mkdir target/scala-2.9.1/src_managed/main
> eclipse skip-parents=false
> verify-project-xml
+> verify-project-xml-java
+> verify-project-xml-subd
+> verify-project-xml-sube
> verify-classpath-xml-root
> verify-classpath-xml-sub
> verify-classpath-xml-suba

No commit comments for this range

Something went wrong with that request. Please try again.