Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Misc build stuff

  • Loading branch information...
commit 8615089965c8b1e4100ae40f5109820eb16836ce 1 parent 4cb9d3c
@mdr authored
View
34 project/Build.scala
@@ -10,45 +10,44 @@ import scalariform.formatter.preferences._
object ScalariformBuild extends Build {
- lazy val buildSettings = Defaults.defaultSettings ++ ScalariformPlugin.defaultScalariformSettings ++ Seq(
+ lazy val commonSettings = Defaults.defaultSettings ++ ScalariformPlugin.defaultScalariformSettings ++ Seq(
organization := "scalariform",
version := "0.1.2-SNAPSHOT",
scalaVersion := "2.9.2",
- crossScalaVersions := Seq("2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.0-1", "2.9.1", "2.9.2", "2.10.0-SNAPSHOT"),
+ crossScalaVersions := Seq("2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.1", "2.9.2"),
resolvers += ScalaToolsSnapshots,
retrieveManaged := true,
scalacOptions += "-deprecation",
pomExtra := pomExtraXml,
parallelExecution in Test := false,
publishMavenStyle := true,
- credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
+ publishArtifact in Test := false,
+ pomIncludeRepository := { _ => false },
EclipseKeys.withSource := true,
EclipseKeys.eclipseOutput := Some("bin"))
- lazy val subprojectSettings = buildSettings ++ Seq(
+ lazy val subprojectSettings = commonSettings ++ Seq(
ScalariformKeys.preferences <<= baseDirectory.apply(dir PreferencesImporterExporter.loadPreferences((dir / ".." / "formatterPreferences.properties").getPath)))
- lazy val root: Project = Project("root", file("."), settings = buildSettings) aggregate (scalariform, cli, misc)
+ lazy val root: Project = Project("root", file("."), settings = commonSettings) aggregate (scalariform, cli, misc)
lazy val scalariform: Project = Project("scalariform", file("scalariform"), settings = subprojectSettings ++
Seq(
libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps)
val scalatestVersion = sv match {
case "2.8.0" "org.scalatest" %% "scalatest" % "1.3.1.RC2" % "test"
-
- // case "2.8.1" => "org.scalatest" %% "scalatest" % "1.5.1" % "test"
- // case "2.8.2" => "org.scalatest" %% "scalatest" % "1.5.1" % "test"
- case "2.10.0-SNAPSHOT" "org.scalatest" % "scalatest_2.10.0-M2" % "1.8-SNAPSHOT" % "test"
+ case "2.10.0-M3" "org.scalatest" % "scalatest_2.10.0-M3" % "1.8-SNAPSHOT" % "test"
case _ "org.scalatest" %% "scalatest" % "1.7.2" % "test"
}
deps :+ scalatestVersion
},
exportJars := true, // Needed for cli oneJar
publishTo <<= version { (v: String)
- if (v endsWith "-SNAPSHOT")
- Some(ScalaToolsSnapshots)
+ val nexus = "https://oss.sonatype.org/"
+ if (v.trim.endsWith("SNAPSHOT"))
+ Some("snapshots" at nexus + "content/repositories/snapshots")
else
- Some(ScalaToolsReleases)
+ Some("releases" at nexus + "service/local/staging/deploy/maven2")
}))
lazy val cli = Project("cli", file("cli"), settings = subprojectSettings ++ SbtOneJar.oneJarSettings ++
@@ -73,5 +72,16 @@ object ScalariformBuild extends Build {
<distribution>repo</distribution>
</license>
</licenses>
+ <scm>
+ <url>git@github.com:mdr/scalariform.git</url>
+ <connection>scm:git:git@github.com:mdr/scalariform</connection>
+ </scm>
+ <developers>
+ <developer>
+ <id>mdr</id>
+ <name>Matt Russell</name>
+ <url>https://github.com/mdr/</url>
+ </developer>
+ </developers>
}
View
4 project/plugins.sbt
@@ -12,3 +12,7 @@ resolvers += Classpaths.typesafeSnapshots
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-SNAPSHOT")
addSbtPlugin("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.0")
+
+resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
+
+addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")
View
2  scalariform/src/main/scala/scalariform/astselect/AstSelector.scala
@@ -183,7 +183,7 @@ class AstSelector(source: String, scalaVersion: String = ScalaVersions.DEFAULT_V
nodeStack match {
case List(_: BlockExpr, _: MatchExpr, _*) false
case List(_: BlockExpr, _: ProcFunBody, _*) false
- case List(node, _*) !(nonSelectableAstNodes contains node.getClass)
+ case List(node, _*) !(nonSelectableAstNodes contains node.getClass.asInstanceOf[Class[_ <: AstNode]])
case Nil false
}
View
19 scalariform/src/main/scala/scalariform/lexer/RedundantSemicolonDetector.scala
@@ -6,7 +6,7 @@ import scalariform.utils.TextEdit
import scalariform.utils.TextEditProcessor
import scalariform.ScalaVersions
-object RedundantSemicolonDetector extends App {
+object RedundantSemicolonDetector {
/**
* @return all semicolons in the source that could safely be removed without changing the meaning
@@ -33,21 +33,4 @@ object RedundantSemicolonDetector extends App {
def getEditsToRemoveRedundantSemis(s: String): List[TextEdit] =
findRedundantSemis(s).map(_.range).map(TextEdit.delete)
-}
-
-object Demo extends App {
-
- val source = """
- class A {
- def foo = 42;
- def bar = 123; def baz = 1234
- };"""
- val redundantSemis = RedundantSemicolonDetector.findRedundantSemis(source)
- val annotated = redundantSemis.reverse.foldLeft(source) { (s, semi) replaceRange(s, semi.range, "<;>") }
- val purged = RedundantSemicolonDetector.removeRedundantSemis(source)
- println(source)
- println("-------------------------------------------------")
- println(annotated)
- println("-------------------------------------------------")
- println(purged)
}
View
12 scalariform/src/test/scala/scalariform/lexer/RedundantSemicolonDetectorTest.scala
@@ -11,20 +11,20 @@ import scalariform.utils.Utils._
class RedundantSemicolonDetectorTest extends FlatSpec with ShouldMatchers {
implicit def stringToCheckable(s: String)(implicit scalaVersion: String = ScalaVersions.DEFAULT_VERSION) =
- new { def check = checkSemis(s, scalaVersion) } // Expected redundant semicolons are indicated with <;>
+ new { def check() = checkSemis(s, scalaVersion) }; // Expected redundant semicolons are indicated with <;>
"""
class A {
def foo = 42<;>
def bar = 123; def baz = 1234
}<;>
- """.check
+ """.check();
"""
{
println("Foo")<;>
}
- """.check
+ """.check();
"""
class A {
@@ -33,17 +33,17 @@ class RedundantSemicolonDetectorTest extends FlatSpec with ShouldMatchers {
y <- 1 to 10
) yield x + y<;>
}
- """.check
+ """.check()
{
- implicit val scalaVersion = "2.10.0"
+ implicit val scalaVersion = "2.10.0";
"""
s"my name is ${person.name<;>}"
""".check
}
private def checkSemis(encodedSource: String, scalaVersion: String) {
- val ordinarySource = encodedSource.replaceAllLiterally("<;>", ";")
+ val ordinarySource = encodedSource.replace("<;>", ";")
val semis = RedundantSemicolonDetector.findRedundantSemis(ordinarySource, scalaVersion)
val encodedSourceAgain = semis.reverse.foldLeft(ordinarySource) { (s, semi) replaceRange(s, semi.range, "<;>") }
encodedSourceAgain should equal(encodedSource)
Please sign in to comment.
Something went wrong with that request. Please try again.