forked from I2P_Developers/i2p.i2p
Adjustments in Scala code to adopt to work with the Obj-C++ code.
This commit is contained in:
@@ -40,7 +40,7 @@ lazy val browserbundle = (project in file("browserbundle"))
|
||||
lazy val macosx = (project in file("macosx"))
|
||||
.settings(
|
||||
commonSettings,
|
||||
name := "MacI2PLauncher",
|
||||
name := "RouterPack.jar",
|
||||
mainClass in assembly := Some("net.i2p.launchers.osx.LauncherAppMain")
|
||||
).dependsOn(common)
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>I2P</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Public Domain</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>0.9.35-experimental</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>i2p</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.i2p</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>I2P</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>I2P</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1</string>
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<true/>
|
||||
<key>CGDisableCoalescedUpdates</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.5</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>I2P</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>i386</key>
|
||||
<string>10.5.0</string>
|
||||
<key>x86_64</key>
|
||||
<string>10.6.0</string>
|
||||
</dict>
|
||||
<key>LSUIElement</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.io.{File, FileNotFoundException, FileOutputStream}
|
||||
import java.util.zip._
|
||||
|
||||
lazy val i2pVersion = "0.9.34"
|
||||
lazy val i2pVersion = "0.9.35"
|
||||
|
||||
lazy val cleanAllTask = taskKey[Unit]("Clean up and remove the OSX bundle")
|
||||
lazy val buildAppBundleTask = taskKey[Unit](s"Build an Mac OS X bundle for I2P ${i2pVersion}.")
|
||||
@@ -24,7 +24,7 @@ lazy val i2pBuildDir = new File("./../pkg-temp")
|
||||
lazy val warsForCopy = new File(i2pBuildDir, "webapps").list.filter { f => f.endsWith(".war") }
|
||||
lazy val jarsForCopy = new File(i2pBuildDir, "lib").list.filter { f => f.endsWith(".jar") }
|
||||
|
||||
|
||||
// TODO: Meeh: To be removed - logic is moved to obj-cpp
|
||||
def defaultOSXLauncherShellScript(javaOpts: Seq[String] = Seq.empty): Seq[String] = {
|
||||
val javaOptsString = javaOpts.map(_ + " ").mkString
|
||||
Seq(
|
||||
@@ -138,13 +138,6 @@ buildAppBundleTask := {
|
||||
val launcherBinary = Some(assembly.value)
|
||||
launcherBinary.map { l => IO.copyFile( new File(l.toString), new File(paths.get("execBundlePath").get, "I2P") ) }
|
||||
|
||||
|
||||
val plistFile = new File("./macosx/Info.plist")
|
||||
if (plistFile.exists()) {
|
||||
println(s"Adding Info.plist...")
|
||||
IO.copyFile(plistFile, new File(bundleBuildPath, "I2P.app/Contents/Info.plist"))
|
||||
}
|
||||
|
||||
val zipFilePath = Some(buildDeployZipTask.value)
|
||||
|
||||
val zipFileOrigin = new File(zipFilePath.get)
|
||||
|
||||
@@ -87,8 +87,6 @@ object LauncherAppMain extends App {
|
||||
}
|
||||
}
|
||||
|
||||
//Await.result(routerProcess, 5000 millis)
|
||||
|
||||
} finally {
|
||||
System.out.println("Exit?")
|
||||
}
|
||||
|
||||
@@ -17,50 +17,6 @@ import scala.concurrent.ExecutionContext.Implicits.global
|
||||
*/
|
||||
object MacOSXRouterLauncher extends RouterLauncher {
|
||||
|
||||
def pid(p: Process): Long = {
|
||||
val procField = p.getClass.getDeclaredField("p")
|
||||
procField.synchronized {
|
||||
procField.setAccessible(true)
|
||||
val proc = procField.get(p)
|
||||
try {
|
||||
proc match {
|
||||
case unixProc
|
||||
if unixProc.getClass.getName == "java.lang.UNIXProcess" => {
|
||||
val pidField = unixProc.getClass.getDeclaredField("pid")
|
||||
pidField.synchronized {
|
||||
pidField.setAccessible(true)
|
||||
try {
|
||||
pidField.getLong(unixProc)
|
||||
} finally {
|
||||
pidField.setAccessible(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
case procImpl:java.lang.Process => {
|
||||
val f: Field = p.getClass().getDeclaredField("p")
|
||||
val f2: Field = f.get(p).getClass.getDeclaredField("pid")
|
||||
try {
|
||||
f.setAccessible(true)
|
||||
f2.setAccessible(true)
|
||||
val pid = f2.getLong(p)
|
||||
pid
|
||||
} finally {
|
||||
f2.setAccessible(false)
|
||||
f.setAccessible(false)
|
||||
}
|
||||
}
|
||||
// If someone wants to add support for Windows processes,
|
||||
// this would be the right place to do it:
|
||||
case _ => throw new RuntimeException(
|
||||
"Cannot get PID of a " + proc.getClass.getName)
|
||||
}
|
||||
} finally {
|
||||
procField.setAccessible(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ??? equals "throw not implemented" IIRC - it compiles at least :)
|
||||
override def runRouter(args: Array[String]): Future[Process] = ???
|
||||
|
||||
|
||||
Reference in New Issue
Block a user