Skip to content

Commit

Permalink
Added compilation options, bumped version to 0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
melezov committed Mar 5, 2013
1 parent 922e769 commit 8c1159c
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 14 deletions.
75 changes: 69 additions & 6 deletions build.sbt
Expand Up @@ -2,16 +2,65 @@ organization := "hr.element.doit"

name := "doit-csv"

version := "0.1.6-T1"
version := "0.1.7"

// ### Build settings ###

libraryDependencies += "org.scalatest" % "scalatest_2.9.2" % "1.8" % "test"
libraryDependencies += "org.scalatest" %% "scalatest" % "2.0.M5b" % "test"

crossScalaVersions := Seq("2.10.1-RC2", "2.10.1-RC1", "2.10.0", "2.9.3", "2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0")
crossScalaVersions := Seq("2.10.1-RC2", "2.9.3", "2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0")

scalaVersion <<= crossScalaVersions(_.head)

scalacOptions <<= scalaVersion map { sV =>
val scala2_8 = Seq(
"-unchecked"
, "-deprecation"
, "-optimise"
, "-encoding", "UTF-8"
, "-Xcheckinit"
, "-Xfatal-warnings"
, "-Yclosure-elim"
, "-Ydead-code"
, "-Yinline"
)
//
val scala2_9 = Seq(
"-Xmax-classfile-name", "72"
)
//
val scala2_9_1 = Seq(
"-Yrepl-sync"
, "-Xlint"
, "-Xverify"
, "-Ywarn-all"
)
//
val scala2_10 = Seq(
"-feature"
, "-language:postfixOps"
, "-language:implicitConversions"
, "-language:existentials"
)
//
scala2_8 ++ (sV match {
case x if (x startsWith "2.10.") => scala2_9 ++ scala2_9_1 ++ scala2_10
case x if (x startsWith "2.9.") && x >= "2.9.1" => scala2_9 ++ scala2_9_1
case x if (x startsWith "2.9.") => scala2_9
case _ => Nil
})
}

javaHome := sys.env.get("JDK16_HOME").map(file(_))

javacOptions := Seq(
"-deprecation"
, "-encoding", "UTF-8"
, "-Xlint:unchecked"
, "-source", "1.6"
, "-target", "1.6"
)

scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-optimise")

unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)(_ :: Nil)
Expand All @@ -20,13 +69,27 @@ unmanagedSourceDirectories in Test <<= (scalaSource in Test )(_ :: Nil)

// ### Publishing ###

publishTo := Some("Element Releases" at "http://repo.element.hr/nexus/content/repositories/releases/")
resolvers := Seq("Element Nexus" at "http://repo.element.hr/nexus/content/groups/public/")

credentials += Credentials(Path.userHome / ".publish" / "element.credentials")
externalResolvers <<= resolvers map { r =>
Resolver.withDefaultResolvers(r, mavenCentral = false)
}

publishArtifact in (Compile, packageDoc) := false
publishTo <<= version { version => Some(
if (version endsWith "SNAPSHOT")
"Element Snapshots" at "http://repo.element.hr/nexus/content/repositories/snapshots/"
else
"Element Releases" at "http://repo.element.hr/nexus/content/repositories/releases/"
)}

credentials += Credentials(Path.userHome / ".config" / "doit-csv" / "nexus.config")

publishArtifact in (Compile, packageDoc) := false

// ### Misc ###

initialCommands := "import hr.element.doit.csv._"

seq(graphSettings: _*)

seq(eclipseSettings: _*)
2 changes: 1 addition & 1 deletion cross-publish.bat
@@ -1,4 +1,4 @@
@echo off

echo Will cross-publish project to the maven server
call "%~dp0sbt.bat" %* +publish
call "%~dp0sbt.bat" %* clean +compile +publish
2 changes: 1 addition & 1 deletion cross-publish.sh
@@ -1,4 +1,4 @@
#!/bin/bash

echo Will cross-publish project to the maven server
`dirname $0`/sbt.sh --no-jrebel "$@" clean +publish
`dirname $0`/sbt.sh --no-jrebel "$@" clean +compile +publish
1 change: 0 additions & 1 deletion src/main/scala/hr/element/doit/csv/CSVWriter.scala
Expand Up @@ -43,6 +43,5 @@ class CSVWriter(val config: CSVConfig, writer: Writer) {
writer.write(config.newLine)
writer.flush()
}
this
}
}
11 changes: 6 additions & 5 deletions src/main/scala/hr/element/doit/csv/LineReader.scala
Expand Up @@ -109,25 +109,26 @@ class LineReader(config: CSVConfig, reader: Reader) extends IndexedSeq[String] {
case (EndMode) => "End Mode"
case _ => "Stupid mode"
}

}

def loop(
mode: SmrMode,
curr: StringBuilder = new StringBuilder("")) {
val read = reader.read()
//println( "loop: " + curr + " " + stringMode(mode)+" read :"+read.toChar+"| uc"+read+"|")

// println( "loop: " + curr + " " + stringMode(mode)+" read :"+read.toChar+"| uc"+read+"|")

if (read == -1) { // End Of File
if (mode == QuotedMode) sys.error("Malformated CSV, unexpected eof!")
else if (curr.nonEmpty)
res += (curr appendAll sliM.flush()).result()
else if (mode == NewWordMode)
res += ""
else
res
} else {
val returnResult = sliM.consume(read.toChar, mode)
//println(returnResult.getClass())

// println(returnResult.getClass())

if (mode(returnResult) == Unexpected)
sys.error("Malformated CSV! " + stringMode(mode) + " with " + returnResult.getClass())
else {
Expand Down

0 comments on commit 8c1159c

Please sign in to comment.