Skip to content

Commit

Permalink
Infrastructure: Update Scala, SBT versions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBizzle committed Feb 15, 2019
1 parent 4af9d85 commit 8ba7fb9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ lazy val commonSettings = Seq(
// These settings are common to all builds involving scala
// Any scala-specific settings should change here (and thus for all projects at once)
lazy val scalaSettings = Seq(
scalaVersion := "2.12.4",
scalaVersion := "2.12.8",
scalaSource in Compile := baseDirectory.value / "src" / "main",
scalaSource in Test := baseDirectory.value / "src" / "test",
crossPaths := false, // don't cross-build for different Scala versions
Expand Down
4 changes: 4 additions & 0 deletions netlogo-core/src/main/api/FileIO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ object FileIO {
def fileToString(path: String)(implicit codec: Codec) =
io.Source.fromFile(path)(codec).mkString

@throws(classOf[java.io.IOException])
def fileToString(path: String, encoding: String) =
io.Source.fromFile(path, encoding).mkString

@throws(classOf[java.io.IOException])
def url2String(sampleURL: String): String = {
if(sampleURL.startsWith("/"))
Expand Down
15 changes: 10 additions & 5 deletions netlogo-core/src/main/fileformat/ThreeDViewReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object ThreeDViewReader extends WidgetReader with BaseWidgetParser with ConstWid
}

def PatchSize: Rule1[View => View] = rule { (DoubleValue ~ NewLine) ~> ((size: Double) =>
dimensionTransform(_.copyThreeD(patchSize = size))(_))
dimensionTransform(wd => wd.copyThreeD(patchSize = size))(_))
}

def PCors: Rule1[View => View] = rule {
Expand Down Expand Up @@ -90,13 +90,18 @@ object ThreeDViewReader extends WidgetReader with BaseWidgetParser with ConstWid
((v: View) => v.copy(left = dims(0), top = dims(1), right = dims(2), bottom = dims(3))))
}

def WrappingInXAndY: Rule1[View => View] = rule { (BooleanDigit ~ NewLine ~ BooleanDigit ~ NewLine) ~> ((wrapsInX: Boolean, wrapsInY: Boolean) =>
dimensionTransform(_.copyThreeD(wrappingAllowedInX = wrapsInX, wrappingAllowedInY = wrapsInY))(_))
def WrappingInXAndY: Rule1[View => View] = rule {
(BooleanDigit ~ NewLine ~ BooleanDigit ~ NewLine) ~> (
(wrapsInX: Boolean, wrapsInY: Boolean) => (view: View) =>
dimensionTransform(wd => wd.copyThreeD(wrappingAllowedInX = wrapsInX, wrappingAllowedInY = wrapsInY))(view)
)
}

def WrappingInZ: Rule1[View => View] = rule {
(BooleanDigit ~ NewLine) ~> ((allowed: Boolean) =>
dimensionTransform(_.copyThreeD(wrappingAllowedInZ = allowed))(_))
(BooleanDigit ~ NewLine) ~> (
(allowed: Boolean) => (view: View) =>
dimensionTransform(wd => wd.copyThreeD(wrappingAllowedInZ = allowed))(view)
)
}

def GraphicsWindow: Rule0 = rule { "GRAPHICS-WINDOW" }
Expand Down
2 changes: 1 addition & 1 deletion netlogo-headless/src/main/workspace/ModelsLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static Node scanForModelsAtRoot(String path) {

public static String getInfoWindow(String filePath)
throws java.io.IOException {
String file = FileIO.file2String(filePath);
String file = FileIO.fileToString(filePath, "UTF-8");
// parse out info text
String delimiter = org.nlogo.core.model.ModelReader$.MODULE$.SEPARATOR();
int dlength = delimiter.length();
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.1.1
sbt.version=1.2.8

0 comments on commit 8ba7fb9

Please sign in to comment.