source: launchers/macosx/build.sbt @ 8adf55a

Last change on this file since 8adf55a was 8adf55a, checked in by meeh <meeh@…>, 3 years ago

Still WIP, but I've added a new sbt plugin named
sbt-native-packager for future rpm/deb/windows and
maybe even OSX packages. Also, the macosx sbt project
now has a task named buildAppBundleTask and which will
produce an I2P.app and copy over needed directories/jars/wars
which later needs to be extracted to an writeable area which
would be i2p base directory in runtime.

The MacOSXRouterLauncherApp contains more information about how
the executable in the OS X bundle will locate our R/O i2pbase so
it can copy it to a writable area. The R/O is also to ensure valid
signature on the bundle.

At last, this approach is done casue letting an Mach-O binary load
libjvm.dylib was proved unstable, so MacOSXRouterLauncherApp will
rather use an JNI module to load the needed glue with the
Mac OS X system.

  • Property mode set to 100644
File size: 2.4 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
12
13// Pointing the resources directory to the "installer" directory
14resourceDirectory in Compile := baseDirectory.value / ".." / ".." / "installer" / "resources"
15lazy val resDir = new File("./../installer/resources")
16lazy val i2pBuildDir = new File("./../build")
17lazy val warsForCopy = i2pBuildDir.list.filter { f => f.endsWith(".war") }
18lazy val jarsForCopy = i2pBuildDir.list.filter { f => f.endsWith(".jar") }
19
20buildAppBundleTask := {
21  println(s"Building Mac OS X bundle for I2P version ${i2pVersion}.")
22  bundleBuildPath.mkdir()
23  val paths = Map[String,File](
24    "execBundlePath" -> new File(bundleBuildPath, "I2P.app/Contents/MacOS"),
25     "resBundlePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources"),
26     "i2pbaseBunldePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources/i2pbase"),
27    "i2pJarsBunldePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources/i2pbase/lib"),
28     "webappsBunldePath" -> new File(bundleBuildPath, "I2P.app/Contents/Resources/i2pbase/webapps")
29  )
30  paths.map { case (s,p) => p.mkdirs() }
31  val dirsToCopy = List("certificates","locale","man")
32  dirsToCopy.map { d => IO.copyDirectory( new File(resDir, d), new File(paths.get("i2pbaseBunldePath").get, d) ) }
33  warsForCopy.map { w => IO.copyFile( new File(i2pBuildDir, w), new File(paths.get("webappsBunldePath").get, w) ) }
34  warsForCopy.map { j => IO.copyFile( new File(i2pBuildDir, j), new File(paths.get("i2pJarsBunldePath").get, j) ) }
35}
36
37// Unmanaged classpath will be available at compile time
38unmanagedClasspath in Compile ++= Seq(
39  baseDirectory.value / ".." / ".." / "build" / "*.jar",
40  baseDirectory.value / ".." / ".." / "router" / "java" / "src"
41)
42
43// Please note the difference between browserbundle, this has
44// the "in Compile" which limit it's scope to that.
45//unmanagedBase in Compile := baseDirectory.value / ".." / ".." / "build"
46
47libraryDependencies ++= Seq(
48  "net.i2p" % "router" % i2pVersion % Compile
49)
50
51
52assemblyOption in assembly := (assemblyOption in assembly).value.copy(prependShellScript = Some(defaultShellScript))
53
54assemblyJarName in assembly := s"${name.value}-${version.value}"
Note: See TracBrowser for help on using the repository browser.