Changeset 8adf55a


Ignore:
Timestamp:
Apr 24, 2018 4:18:21 AM (3 years ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
832e55d
Parents:
9307b27
Message:

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.

Location:
launchers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • launchers/build.sbt

    r9307b27 r8adf55a  
    1 import sbt.Keys._
     1import sbt._
     2import Keys._
     3
    24
    35resolvers ++= Seq(
     
    1214  organization := "net.i2p",
    1315  scalaVersion := "2.11.11", // We have to use Scala 11 as long as we're going to support JRE 1.7
    14   version      := "0.1.0-SNAPSHOT"
     16  version      := "0.1.0-SNAPSHOT",
     17  maintainer := "Meeh <mikalv@mikalv.net>",
     18  packageSummary := "The Invisible Internet Project",
     19  packageDescription := "Blabla"
    1520)
    1621
     
    2732  .settings(
    2833    commonSettings,
    29     name         := "RouterLaunchApp",
     34    name         := "MacI2PLauncher",
    3035    assemblyJarName in assembly := s"${name.value}-${version.value}.jar",
    3136    mainClass in assembly := Some("net.i2p.MacOSXRouterLauncherApp")
     
    3742
    3843
    39 
    40 
    4144fork := true
    4245
  • launchers/macosx/build.sbt

    r9307b27 r8adf55a  
    11import sbtassembly.AssemblyPlugin.defaultShellScript
     2import sbt._
     3import Keys._
     4import sbt.io.IO
     5import java.io.File
    26
    37lazy 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}
    436
    537// Unmanaged classpath will be available at compile time
  • launchers/macosx/src/main/scala/net/i2p/MacOSXRouterLauncherApp.scala

    r9307b27 r8adf55a  
    22
    33import net.i2p.router.Router
     4import java.io.File
    45
    56/**
     
    1819  *
    1920  *
     21  * The i2p base directory in the build should be in a relative path from
     22  * the launcher, which would be ../Resources/i2pbase - this directory would
     23  * need to be copied out to a "writable" area, since we're in a signed "immutable"
     24  * bundle. First this launcher will check if i2pbase is already deployed to a
     25  * writable area, if it's not, it deploys, if the i2pbase directory has an older
     26  * version than the one in the bundle, it upgrades. It does nothing if versions
     27  * matches.
     28  *
     29  *
    2030  * @author Meeh
    2131  * @version 0.0.1
     
    2434object MacOSXRouterLauncherApp extends App {
    2535
     36  val i2pBaseBundleDir = new File(new File("."), "../Resources/i2pbase")
    2637
    2738  Router.main(args)
  • launchers/project/build.properties

    r9307b27 r8adf55a  
    1 sbt.version=1.1.1
     1sbt.version=1.1.2
  • launchers/project/plugins.sbt

    r9307b27 r8adf55a  
    22addSbtPlugin("com.oradian.sbt" % "sbt-sh" % "0.3.0")
    33addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
    4 
     4addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.4")
Note: See TracChangeset for help on using the changeset viewer.