Skip to content
Snippets Groups Projects
Commit 135ab347 authored by Philippe Suter's avatar Philippe Suter
Browse files

finally, clean works :)

parent efbca75c
No related branches found
No related tags found
No related merge requests found
import sbt._ import sbt._
class FunCheckProject(info: ProjectInfo) extends ParentProject(info) with FileTasks { class FunCheckProject(info: ProjectInfo) extends DefaultProject(info) with FileTasks {
override def outputDirectoryName = "bin" override def outputDirectoryName = "bin"
override def dependencyPath = "lib" override def dependencyPath = "lib"
override def shouldCheckOutputDirectories = false override def shouldCheckOutputDirectories = false
...@@ -11,35 +11,50 @@ class FunCheckProject(info: ProjectInfo) extends ParentProject(info) with FileTa ...@@ -11,35 +11,50 @@ class FunCheckProject(info: ProjectInfo) extends ParentProject(info) with FileTa
val scriptPath: Path = "." / "scalac-funcheck" val scriptPath: Path = "." / "scalac-funcheck"
lazy val all = fileTask(scriptPath :: Nil)(allActions) dependsOn(plugin.`package`) describedAs("Compile everything and produce a script file.") lazy val all = fileTask(scriptPath :: Nil)(generateScript) dependsOn(purescala.`package`, plugin.`package`) describedAs("Compile everything and produce a script file.")
def allActions: Option[String] = { override def cleanAction = super.cleanAction dependsOn(deleteScript)
val nl = System.getProperty("line.separator")
val f = scriptPath.asFile lazy val deletescr = deleteScript
val fw = new java.io.FileWriter(f)
fw.write("#!/bin/sh" + nl) def deleteScript = task {
fw.write("LD_LIBRARY_PATH=" + ("." / "lib-bin").absolutePath + " \\" + nl) scriptPath.asFile.delete
fw.write("java \\" + nl)
val libStr = (buildLibraryJar.absolutePath).toString
fw.write(" -Dscala.home=" + libStr.substring(0, libStr.length-21) + " \\" + nl)
fw.write(" -classpath \\" + nl)
fw.write(" " + buildLibraryJar.absolutePath + ":")
fw.write(buildCompilerJar.absolutePath + ":")
fw.write(purescala.jarPath.absolutePath + ":")
fw.write(plugin.jarPath.absolutePath + ":")
fw.write(("lib" / "z3.jar").absolutePath + " \\" + nl)
fw.write(" scala.tools.nsc.Main -Xplugin:" + plugin.jarPath.absolutePath + " $@" + nl)
fw.close
f.setExecutable(true)
None None
} }
def generateScript: Option[String] = {
try {
val nl = System.getProperty("line.separator")
val f = scriptPath.asFile
val fw = new java.io.FileWriter(f)
fw.write("#!/bin/sh" + nl)
fw.write("LD_LIBRARY_PATH=" + ("." / "lib-bin").absolutePath + " \\" + nl)
fw.write("java \\" + nl)
// This is a hack :(
val libStr = (buildLibraryJar.absolutePath).toString
fw.write(" -Dscala.home=" + libStr.substring(0, libStr.length-21) + " \\" + nl)
fw.write(" -classpath \\" + nl)
fw.write(" " + buildLibraryJar.absolutePath + ":")
fw.write(buildCompilerJar.absolutePath + ":")
fw.write(purescala.jarPath.absolutePath + ":")
fw.write(plugin.jarPath.absolutePath + ":")
fw.write(("lib" / "z3.jar").absolutePath + " \\" + nl)
fw.write(" scala.tools.nsc.Main -Xplugin:" + plugin.jarPath.absolutePath + " $@" + nl)
fw.close
f.setExecutable(true)
None
} catch {
case e => Some("There was an error while generating the script file: " + e.getLocalizedMessage)
}
}
sealed abstract class PersonalizedProject(info: ProjectInfo) extends DefaultProject(info) { sealed abstract class PersonalizedProject(info: ProjectInfo) extends DefaultProject(info) {
override def dependencyPath = "lib" override def dependencyPath = "lib"
override def outputDirectoryName = "bin" override def outputDirectoryName = "bin"
override def compileOptions = super.compileOptions ++ Seq(Unchecked) override def compileOptions = super.compileOptions ++ Seq(Unchecked)
} }
class PureScalaProject(info: ProjectInfo) extends PersonalizedProject(info) { class PureScalaProject(info: ProjectInfo) extends PersonalizedProject(info) {
override def outputPath = "bin" / "purescala" override def outputPath = "bin" / "purescala"
override def mainScalaSourcePath = "src" / "purescala" override def mainScalaSourcePath = "src" / "purescala"
...@@ -50,8 +65,6 @@ class FunCheckProject(info: ProjectInfo) extends ParentProject(info) with FileTa ...@@ -50,8 +65,6 @@ class FunCheckProject(info: ProjectInfo) extends ParentProject(info) with FileTa
override def mainScalaSourcePath = "src" / "funcheck" override def mainScalaSourcePath = "src" / "funcheck"
override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath
override def mainResourcesPath = "resources" / "funcheck" override def mainResourcesPath = "resources" / "funcheck"
} }
class MultisetsProject(info: ProjectInfo) extends PersonalizedProject(info) { class MultisetsProject(info: ProjectInfo) extends PersonalizedProject(info) {
override def outputPath = "bin" / "multisets" override def outputPath = "bin" / "multisets"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment