Jar deployment, SBT hacking, and more related to launcher code.

Some refactoring, bugfixing, and self awareness of launcher jar.
This commit is contained in:
meeh
2018-05-01 11:15:11 +00:00
parent 345e7414e6
commit f6c8e44329
7 changed files with 95 additions and 33 deletions

View File

@@ -31,24 +31,17 @@ lazy val jarsForCopy = i2pBuildDir.list.filter { f => f.endsWith(".jar") }
// Pointing the resources directory to the "installer" directory
resourceDirectory in Compile := baseDirectory.value / ".." / ".." / "installer" / "resources"
// Unmanaged base will be included in a fat jar
unmanagedBase in Compile := baseDirectory.value / ".." / ".." / "build"
// Unmanaged classpath will be available at compile time
unmanagedClasspath in Compile ++= Seq(
baseDirectory.value / ".." / ".." / "build" / "*.jar",
baseDirectory.value / ".." / ".." / "router" / "java" / "src"
baseDirectory.value / ".." / ".." / "build" / "*.jar"
)
// Please note the difference between browserbundle, this has
// the "in Compile" which limit it's scope to that.
//unmanagedBase in Compile := baseDirectory.value / ".." / ".." / "build"
libraryDependencies ++= Seq(
"net.i2p" % "router" % i2pVersion % Compile
)
//assemblyOption in assembly := (assemblyOption in assembly).value.copy(prependShellScript = Some(defaultShellScript))
assemblyJarName in assembly := s"${name.value}-${version.value}"
assemblyJarName in assembly := s"OSXLauncher"
// TODO: MEEH: Add assemblyExcludedJars and load the router from own jar files, to handle upgrades better.
@@ -71,6 +64,10 @@ buildAppBundleTask := {
paths.map { case (s,p) => p.mkdirs() }
val dirsToCopy = List("certificates","locale","man")
val launcherBinary = Some(assembly.value)
launcherBinary.map { l => IO.copyFile( new File(l.toString), new File(paths.get("execBundlePath").get, "I2P") ) }
/**
*
* First of, if "map" is unknown for you - shame on you :p
@@ -85,5 +82,5 @@ buildAppBundleTask := {
*/
dirsToCopy.map { d => IO.copyDirectory( new File(resDir, d), new File(paths.get("i2pbaseBunldePath").get, d) ) }
warsForCopy.map { w => IO.copyFile( new File(i2pBuildDir, w), new File(paths.get("webappsBunldePath").get, w) ) }
warsForCopy.map { j => IO.copyFile( new File(i2pBuildDir, j), new File(paths.get("i2pJarsBunldePath").get, j) ) }
jarsForCopy.map { j => IO.copyFile( new File(i2pBuildDir, j), new File(paths.get("i2pJarsBunldePath").get, j) ) }
}

View File

@@ -1,9 +1,10 @@
package net.i2p
import net.i2p.router.Router
import net.i2p.launchers.{OSXDefaults, OSXDeployment}
import java.io.File
import collection.JavaConverters._
import net.i2p.launchers.{OSXDefaults, OSXDeployment}
/**
*
* For java developers:
@@ -34,12 +35,21 @@ import java.io.File
*/
object MacOSXRouterLauncherApp extends App {
val i2pBaseDir = new File(OSXDefaults.getOSXBaseDirectory)
val i2pBaseDir = OSXDefaults.getOSXBaseDirectory
new OSXDeployment()
// Change directory to base dir
System.setProperty("user.dir", i2pBaseDir.getAbsolutePath)
Router.main(args)
val i2pJarDir = new File(i2pBaseDir.getAbsolutePath, "lib")
i2pJarDir.list().toList.map { jar => {
val jarFile = new File(i2pJarDir, jar)
println(s"Loading jar: ${jarFile.toURI.toURL} => ${MacOSXRouterLauncher.addJarToClassPath(jarFile.toURI.toURL)}")
} }
MacOSXRouterLauncher.runRouter(args)
//net.i2p.Router.main(args)
}