source: launchers/macosx/build.sbt @ 345e741

Last change on this file since 345e741 was 975d8a0, checked in by meeh <meeh@…>, 3 years ago

Cleaned up in SBT build file. Sorted assignments, task definitions and such.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1import sbtassembly.AssemblyPlugin.defaultShellScript
2import sbt._
3import Keys._
4import sbt.io.IO
5import java.io.File
6
7lazy val i2pVersion = "0.9.34"
8
9lazy val buildAppBundleTask = taskKey[Unit](s"Build an Mac OS X bundle for I2P ${i2pVersion}.")
10lazy val bundleBuildPath = file("./output")
11
12lazy val staticFiles = List(
13  "blocklist.txt",
14  "clients.config",
15  "continents.txt",
16  "countries.txt",
17  "hosts.txt",
18  "geoip.txt",
19  "router.config",
20  "webapps.config"
21)
22
23lazy val resDir = new File("./../installer/resources")
24lazy val i2pBuildDir = new File("./../build")
25lazy val warsForCopy = i2pBuildDir.list.filter { f => f.endsWith(".war") }
26lazy val jarsForCopy = i2pBuildDir.list.filter { f => f.endsWith(".jar") }
27
28
29
30
31// Pointing the resources directory to the "installer" directory
32resourceDirectory in Compile := baseDirectory.value / ".." / ".." / "installer" / "resources"
33
34// Unmanaged classpath will be available at compile time
35unmanagedClasspath in Compile ++= Seq(
36  baseDirectory.value / ".." / ".." / "build" / "*.jar",
37  baseDirectory.value / ".." / ".." / "router" / "java" / "src"
38)
39
40// Please note the difference between browserbundle, this has
41// the "in Compile" which limit it's scope to that.
42//unmanagedBase in Compile := baseDirectory.value / ".." / ".." / "build"
43
44libraryDependencies ++= Seq(
45  "net.i2p" % "router" % i2pVersion % Compile
46)
47
48
49//assemblyOption in assembly := (assemblyOption in assembly).value.copy(prependShellScript = Some(defaultShellScript))
50
51assemblyJarName in assembly := s"${name.value}-${version.value}"
52
53
54// TODO: MEEH: Add assemblyExcludedJars and load the router from own jar files, to handle upgrades better.
55// In fact, most likely the bundle never would need an update except for the router jars/wars.
56
57convertToICNSTask := {
58  println("TODO")
59}
60
61buildAppBundleTask := {
62  println(s"Building Mac OS X bundle for I2P version ${i2pVersion}.")
63  bundleBuildPath.mkdir()
64  val paths = Map[String,File](
65    "execBundlePath" -> new File(bundleBuildPath, "I2P.app/Contents/MacOS"),
66    "resBundlePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources"),
67    "i2pbaseBunldePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources/i2pbase"),
68    "i2pJarsBunldePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources/i2pbase/lib"),
69    "webappsBunldePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources/i2pbase/webapps")
70  )
71  paths.map { case (s,p) => p.mkdirs() }
72  val dirsToCopy = List("certificates","locale","man")
73
74  /**
75    *
76    * First of, if "map" is unknown for you - shame on you :p
77    *
78    * It's a loop basically where it loops through a list/array
79    * with the current indexed item as subject.
80    *
81    * The code bellow takes the different lists and
82    * copy all the directories or files from the i2p.i2p build dir,
83    * and into the bundle so the launcher will know where to find i2p.
84    *
85    */
86  dirsToCopy.map { d => IO.copyDirectory( new File(resDir, d), new File(paths.get("i2pbaseBunldePath").get, d) ) }
87  warsForCopy.map { w => IO.copyFile( new File(i2pBuildDir, w), new File(paths.get("webappsBunldePath").get, w) ) }
88  warsForCopy.map { j => IO.copyFile( new File(i2pBuildDir, j), new File(paths.get("i2pJarsBunldePath").get, j) ) }
89}
Note: See TracBrowser for help on using the repository browser.