Skip to content

Commit

Permalink
Update to build against NetLogo hexy
Browse files Browse the repository at this point in the history
  • Loading branch information
mrerrormessage committed Jan 22, 2016
1 parent bc48c76 commit b786707
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 35 deletions.
60 changes: 28 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name := "LevelsSpace"

scalaVersion := "2.9.2"
scalaVersion := "2.11.7"

retrieveManaged := true
enablePlugins(NetLogoExtension)

netLogoExtName := "ls"

netLogoClassManager := "LevelsSpace"

javaSource in Compile <<= baseDirectory(_ / "src" / "main")

Expand All @@ -11,41 +15,33 @@ scalaSource in Test <<= baseDirectory(_ / "src" / "test")
scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xfatal-warnings",
"-encoding", "us-ascii")

val netLogoJarURL =
Option(System.getProperty("netlogo.jar.url")).getOrElse("https://s3.amazonaws.com/ccl-artifacts/NetLogo-hexy-fd7cd755.jar")

val netLogoJarsOrDependencies = {
import java.io.File
import java.net.URI
val urlSegments = netLogoJarURL.split("/")
val lastSegment = urlSegments.last.replaceFirst("NetLogo", "NetLogo-tests")
val testsUrl = (urlSegments.dropRight(1) :+ lastSegment).mkString("/")
if (netLogoJarURL.startsWith("file:"))
Seq(unmanagedJars in Compile ++= Seq(
new File(new URI(netLogoJarURL)), new File(new URI(testsUrl))))
else
Seq(libraryDependencies ++= Seq(
"org.nlogo" % "NetLogo" % "6.0-PREVIEW-12-15" from netLogoJarURL,
"org.nlogo" % "NetLogo-tests" % "6.0-PREVIEW-12-15" % "test" from testsUrl))
}

netLogoJarsOrDependencies

libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "18.0",
"org.nlogo" % "NetLogo" % "5.1.0" from "http://ccl.northwestern.edu/netlogo/5.1.0/NetLogo.jar",
"org.nlogo" % "NetLogo-tests" % "5.1.0" % "test" from "http://ccl.northwestern.edu/netlogo/5.1.0/NetLogo-tests.jar",
"org.scalatest" %% "scalatest" % "1.8" % "test",
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
"org.picocontainer" % "picocontainer" % "2.13.6" % "test",
"asm" % "asm-all" % "3.3.1" % "test"
"org.ow2.asm" % "asm-all" % "5.0.3" % "test"
)

artifactName := { (_, _, _) => "ls.jar" }

packageOptions := Seq(
Package.ManifestAttributes(
("Extension-Name", "ls"),
("Class-Manager", "LevelsSpace"),
("NetLogo-Extension-API-Version", "5.0")))

packageBin in Compile := {
val jar = (packageBin in Compile).value
val target = baseDirectory.value / "extensions" / "ls"
val s = streams.value
IO.createDirectory(target)
IO.copyFile(jar, target / "ls.jar")
val classpath = (dependencyClasspath in Runtime).value
val libraryJarPaths =
classpath.files.filter{path =>
path.getName.endsWith(".jar") &&
!path.getName.startsWith("scala-library") &&
!path.getName.startsWith("NetLogo")}
for(path <- libraryJarPaths) {
IO.copyFile(path, target / path.getName)
}
jar
}

test in Test := {
val _ = (packageBin in Compile).value
(test in Test).value
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=0.13.7
sbt.version=0.13.9
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
addSbtPlugin("org.nlogo" % "netlogo-extension-plugin" % "2.4_5.3-M1" from
"https://github.com/NetLogo/NetLogo-Extension-Plugin/releases/download/v2.4-M1_5.3.x/netlogo-extension-plugin-2.4-M1_5.3.x.jar")

4 changes: 2 additions & 2 deletions sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

LAUNCH=$HOME/.sbt/sbt-launch-0.13.7.jar
URL='http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.7/sbt-launch.jar'
LAUNCH=$HOME/.sbt/sbt-launch-0.13.9.jar
URL='http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.9/sbt-launch.jar'

if [ ! -f $LAUNCH ] ; then
echo "downloading" $URL
Expand Down

0 comments on commit b786707

Please sign in to comment.