diff --git a/build.sbt b/build.sbt
index 632a134ab..b5022a350 100644
--- a/build.sbt
+++ b/build.sbt
@@ -10,3 +10,5 @@
Generic.settings
Docs.settings
+
+Wix.settings
diff --git a/project/Windows.scala b/project/Windows.scala
deleted file mode 100644
index db01df86c..000000000
--- a/project/Windows.scala
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
-object Windows {
- // distributionFiles in Windows <+= packageMsi in Windows
-
- // This is a complicated means to convert maven version numbers into monotonically increasing windows versions.
- def makeWindowsVersion(version: String): String = {
- val Majors = new scala.util.matching.Regex("(\\d+).(\\d+).(\\d+)(-.*)?")
- val Rcs = new scala.util.matching.Regex("(\\-\\d+)?\\-RC(\\d+)")
- val Milestones = new scala.util.matching.Regex("(\\-\\d+)?\\-M(\\d+)")
- val BuildNum = new scala.util.matching.Regex("\\-(\\d+)")
-
- def calculateNumberFour(buildNum: Int = 0, rc: Int = 0, milestone: Int = 0) =
- if(rc > 0 || milestone > 0) (buildNum)*400 + rc*20 + milestone
- else (buildNum+1)*400 + rc*20 + milestone
-
- version match {
- case Majors(major, minor, bugfix, rest) => Option(rest) getOrElse "" match {
- case Milestones(null, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(0,0,num.toInt)
- case Milestones(bnum, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(bnum.drop(1).toInt,0,num.toInt)
- case Rcs(null, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(0,num.toInt,0)
- case Rcs(bnum, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(bnum.drop(1).toInt,num.toInt,0)
- case BuildNum(bnum) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(bnum.toInt,0,0)
- case _ => major + "." + minor + "." + bugfix + "." + calculateNumberFour(0,0,0)
- }
- case x => x
- }
- }
-
- def fixBatFiles(scalaDistDir: File): Unit =
- for {
- f <- (scalaDistDir ** "*.bat").get
- } Process(Seq("todos", f.getAbsolutePath), None).! match {
- case 0 => ()
- case n => sys.error("Could not execute todos: " + f.getAbsolutePath + ". Exit code: " + n)
- }
- }
-
- def settings = Seq(
- version in Windows := makeWindowsVersion(version.value),
- // Windows installer configuration
- // name in Windows := "scala",
- lightOptions ++= Seq("-ext", "WixUIExtension", "-cultures:en-us"),
- //mappings in packageMsi in Windows <++= scalaDistDir map { (dir) => (dir.*** --- dir) x relativeTo(dir) },
- // wixConfig <<= (version in Windows, scalaDistDir, scalaSource in examples in Compile, sourceDirectory in Windows) map generateWindowsXml,
- wixConfig := generateWindowsXml(version.value, ???, ???)
- )
- def generateWindowsXml(version: String, dir: File, winDir: File): scala.xml.Node = {
- import com.typesafe.packager.windows.WixHelper._
- val (binIds, binDirXml) = {
- val bindir = dir / "bin"
- val files = (bindir.*** --- bindir).get
- files.foldLeft[(Seq[String], scala.xml.NodeSeq)](Vector.empty[String] -> ()) {
- case ((oldids: Seq[String], oldxml: scala.xml.NodeSeq), file) =>
- val (ids, xml) = generateComponentsAndDirectoryXml(file, "bin_")
- (oldids ++ ids, oldxml ++ xml)
- }
- }
- val docdir = dir / "doc"
- val (readmeId, readmeXml) = generateComponentsAndDirectoryXml(docdir / "README")
- val (licenseId, licenseXml) = generateComponentsAndDirectoryXml(docdir / "LICENSE")
- val (licensesIds, licensesDirXml) = generateComponentsAndDirectoryXml(docdir / "licenses", "licenses_")
- val (tooldocIds, tooldocDirXml) = generateComponentsAndDirectoryXml(docdir / "tools", "tools_")
-
- val (libIds, libDirXml) = generateComponentsAndDirectoryXml(dir / "lib")
- val (apiIds, apiDirXml) = generateComponentsAndDirectoryXml(dir / "api", "api_")
-
- (
-
-
-
-
-
-
-
-
-
-
- { binDirXml }
-
-
-
-
-
- {libDirXml}
- {srcDirXml}
-
- {readmeXml}
- {licenseXml}
- {licensesDirXml}
- {apiDirXml}
- {tooldocDirXml}
-
-
- {exampleDirXml}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- { for(ref <- (binIds ++ libIds ++ licenseId ++ readmeId ++ licensesIds)) yield }
-
-
-
-
-
-
- { for(ref <- apiIds) yield }
-
-
-
-
-
- { for(ref <- tooldocIds) yield }
-
-
-
-
-
-
-
-
-
- )
- }
-}
-*/
\ No newline at end of file
diff --git a/project/Wix.scala b/project/Wix.scala
new file mode 100644
index 000000000..a0198b3df
--- /dev/null
+++ b/project/Wix.scala
@@ -0,0 +1,126 @@
+import sbt._
+import sbt.Keys._
+
+import com.typesafe.sbt.SbtNativePackager._
+import com.typesafe.sbt.packager.Keys._
+
+import com.typesafe.sbt.packager.windows._
+import WixHelper.{generateComponentsAndDirectoryXml, cleanFileName}
+
+// can't call it Windows, that's a config name
+object Wix {
+ // Windows installer configuration
+ def settings: Seq[Setting[_]] = Seq(
+ mappings in Windows := (mappings in Universal).value,
+ // distributionFiles in Windows += (packageMsi in Windows).value,
+
+ wixProductId := "7606e6da-e168-42b5-8345-b08bf774cb30",
+ wixProductUpgradeId := "6061c134-67c7-4fb2-aff5-32b01a186968",
+ // wixProductComments := "Scala Programming language for use in Windows.",
+ version in Windows := makeWindowsVersion(version.value),
+
+ wixProductConfig := makeProductConfig((stagingDirectory in Universal).value, (stagingDirectory in UniversalDocs).value),
+ wixProductConfig <<= (wixProductConfig
+ dependsOn (stage in Universal)
+ dependsOn (stage in UniversalDocs))
+ )
+
+ private def makeProductConfig(stage: File, stageApi: File) = {
+ val (bin, binDirXml0) = generateComponentsAndDirectoryXml(stage / "bin")
+ val (doc, docDirXml) = generateComponentsAndDirectoryXml(stage / "doc", "doc_")
+ val (lib, libDirXml) = generateComponentsAndDirectoryXml(stage / "lib")
+ val (api, apiDirXml) = generateComponentsAndDirectoryXml(stageApi / "api", "api_")
+
+ // add component that adds bin folder to path
+ val binDirXml = binDirXml0 match {
+ case d@({files@_*}) =>
+
+ {files}
+
+
+
+
+
+ }
+
+ val directoriesXml = binDirXml ++ libDirXml ++ docDirXml ++ apiDirXml
+
+ def componentRefs(refs: Seq[String]) = refs map {ref => }
+ val core = (bin ++ lib ++ doc)
+
+ val apiDirId = apiDirXml \ "@Id"
+ val apiIndex = s"[$apiDirId]/scala-library/index.html"
+ // TODO: create (advertised?) shortcut to other api subdirs and to repl -- man, why is this so hard?
+ // val scalaRepl = """[INSTALLDIR]\bin\scala.bat"""
+ val licensePath = cleanFileName((stage / "doc" / "License.rtf").getAbsolutePath)
+
+
+
+
+
+
+ { directoriesXml }
+
+
+
+
+
+
+
+
+
+
+
+ { componentRefs(core) }
+
+
+
+
+
+
+
+ { componentRefs(api) }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+
+ // This is a complicated means to convert maven version numbers into monotonically increasing windows versions.
+ private def makeWindowsVersion(version: String): String = {
+ val Majors = new scala.util.matching.Regex("(\\d+).(\\d+).(\\d+)(-.*)?")
+ val Rcs = new scala.util.matching.Regex("(\\-\\d+)?\\-RC(\\d+)")
+ val Milestones = new scala.util.matching.Regex("(\\-\\d+)?\\-M(\\d+)")
+ val BuildNum = new scala.util.matching.Regex("\\-(\\d+)")
+
+ def calculateNumberFour(buildNum: Int = 0, rc: Int = 0, milestone: Int = 0) =
+ if(rc > 0 || milestone > 0) (buildNum)*400 + rc*20 + milestone
+ else (buildNum+1)*400 + rc*20 + milestone
+
+ version match {
+ case Majors(major, minor, bugfix, rest) => Option(rest) getOrElse "" match {
+ case Milestones(null, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(0,0,num.toInt)
+ case Milestones(bnum, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(bnum.drop(1).toInt,0,num.toInt)
+ case Rcs(null, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(0,num.toInt,0)
+ case Rcs(bnum, num) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(bnum.drop(1).toInt,num.toInt,0)
+ case BuildNum(bnum) => major + "." + minor + "." + bugfix + "." + calculateNumberFour(bnum.toInt,0,0)
+ case _ => major + "." + minor + "." + bugfix + "." + calculateNumberFour(0,0,0)
+ }
+ case x => x
+ }
+ }
+}