Skip to content

Commit b786707

Browse files
Update to build against NetLogo hexy
1 parent bc48c76 commit b786707

4 files changed

Lines changed: 34 additions & 35 deletions

File tree

build.sbt

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name := "LevelsSpace"
22

3-
scalaVersion := "2.9.2"
3+
scalaVersion := "2.11.7"
44

5-
retrieveManaged := true
5+
enablePlugins(NetLogoExtension)
6+
7+
netLogoExtName := "ls"
8+
9+
netLogoClassManager := "LevelsSpace"
610

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

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

18+
val netLogoJarURL =
19+
Option(System.getProperty("netlogo.jar.url")).getOrElse("https://s3.amazonaws.com/ccl-artifacts/NetLogo-hexy-fd7cd755.jar")
20+
21+
val netLogoJarsOrDependencies = {
22+
import java.io.File
23+
import java.net.URI
24+
val urlSegments = netLogoJarURL.split("/")
25+
val lastSegment = urlSegments.last.replaceFirst("NetLogo", "NetLogo-tests")
26+
val testsUrl = (urlSegments.dropRight(1) :+ lastSegment).mkString("/")
27+
if (netLogoJarURL.startsWith("file:"))
28+
Seq(unmanagedJars in Compile ++= Seq(
29+
new File(new URI(netLogoJarURL)), new File(new URI(testsUrl))))
30+
else
31+
Seq(libraryDependencies ++= Seq(
32+
"org.nlogo" % "NetLogo" % "6.0-PREVIEW-12-15" from netLogoJarURL,
33+
"org.nlogo" % "NetLogo-tests" % "6.0-PREVIEW-12-15" % "test" from testsUrl))
34+
}
35+
36+
netLogoJarsOrDependencies
37+
1438
libraryDependencies ++= Seq(
1539
"com.google.guava" % "guava" % "18.0",
16-
"org.nlogo" % "NetLogo" % "5.1.0" from "http://ccl.northwestern.edu/netlogo/5.1.0/NetLogo.jar",
17-
"org.nlogo" % "NetLogo-tests" % "5.1.0" % "test" from "http://ccl.northwestern.edu/netlogo/5.1.0/NetLogo-tests.jar",
18-
"org.scalatest" %% "scalatest" % "1.8" % "test",
40+
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
1941
"org.picocontainer" % "picocontainer" % "2.13.6" % "test",
20-
"asm" % "asm-all" % "3.3.1" % "test"
42+
"org.ow2.asm" % "asm-all" % "5.0.3" % "test"
2143
)
2244

23-
artifactName := { (_, _, _) => "ls.jar" }
24-
25-
packageOptions := Seq(
26-
Package.ManifestAttributes(
27-
("Extension-Name", "ls"),
28-
("Class-Manager", "LevelsSpace"),
29-
("NetLogo-Extension-API-Version", "5.0")))
30-
31-
packageBin in Compile := {
32-
val jar = (packageBin in Compile).value
33-
val target = baseDirectory.value / "extensions" / "ls"
34-
val s = streams.value
35-
IO.createDirectory(target)
36-
IO.copyFile(jar, target / "ls.jar")
37-
val classpath = (dependencyClasspath in Runtime).value
38-
val libraryJarPaths =
39-
classpath.files.filter{path =>
40-
path.getName.endsWith(".jar") &&
41-
!path.getName.startsWith("scala-library") &&
42-
!path.getName.startsWith("NetLogo")}
43-
for(path <- libraryJarPaths) {
44-
IO.copyFile(path, target / path.getName)
45-
}
46-
jar
47-
}
48-
4945
test in Test := {
5046
val _ = (packageBin in Compile).value
5147
(test in Test).value

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.7
1+
sbt.version=0.13.9

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
addSbtPlugin("org.nlogo" % "netlogo-extension-plugin" % "2.4_5.3-M1" from
2+
"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")
3+

sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

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

66
if [ ! -f $LAUNCH ] ; then
77
echo "downloading" $URL

0 commit comments

Comments
 (0)