11name := " 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
711javaSource in Compile <<= baseDirectory(_ / " src" / " main" )
812
@@ -11,41 +15,33 @@ scalaSource in Test <<= baseDirectory(_ / "src" / "test")
1115scalacOptions ++= 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+
1438libraryDependencies ++= 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-
4945test in Test := {
5046 val _ = (packageBin in Compile ).value
5147 (test in Test ).value
0 commit comments