Changeset d4dd0ea for launchers


Ignore:
Timestamp:
Jun 30, 2018 1:11:17 PM (2 years ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
3b34581
Parents:
0b01cc5
Message:

Adjustments in Scala code to adopt to work with the Obj-C++ code.

Location:
launchers
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • launchers/build.sbt

    r0b01cc5 rd4dd0ea  
    4141  .settings(
    4242    commonSettings,
    43     name         := "MacI2PLauncher",
     43    name         := "RouterPack.jar",
    4444    mainClass in assembly := Some("net.i2p.launchers.osx.LauncherAppMain")
    4545  ).dependsOn(common)
  • launchers/macosx/build.sbt

    r0b01cc5 rd4dd0ea  
    22import java.util.zip._
    33
    4 lazy val i2pVersion = "0.9.34"
     4lazy val i2pVersion = "0.9.35"
    55
    66lazy val cleanAllTask = taskKey[Unit]("Clean up and remove the OSX bundle")
     
    2525lazy val jarsForCopy = new File(i2pBuildDir, "lib").list.filter { f => f.endsWith(".jar") }
    2626
    27 
     27// TODO: Meeh: To be removed - logic is moved to obj-cpp
    2828def defaultOSXLauncherShellScript(javaOpts: Seq[String] = Seq.empty): Seq[String] = {
    2929  val javaOptsString = javaOpts.map(_ + " ").mkString
     
    139139  launcherBinary.map { l => IO.copyFile( new File(l.toString), new File(paths.get("execBundlePath").get, "I2P") ) }
    140140
    141 
    142   val plistFile = new File("./macosx/Info.plist")
    143   if (plistFile.exists()) {
    144     println(s"Adding Info.plist...")
    145     IO.copyFile(plistFile, new File(bundleBuildPath, "I2P.app/Contents/Info.plist"))
    146   }
    147 
    148141  val zipFilePath = Some(buildDeployZipTask.value)
    149142
  • launchers/macosx/src/main/scala/net/i2p/launchers/osx/LauncherAppMain.scala

    r0b01cc5 rd4dd0ea  
    8888    }
    8989
    90     //Await.result(routerProcess, 5000 millis)
    91 
    9290  } finally {
    9391    System.out.println("Exit?")
  • launchers/macosx/src/main/scala/net/i2p/launchers/osx/MacOSXRouterLauncher.scala

    r0b01cc5 rd4dd0ea  
    1717  */
    1818object MacOSXRouterLauncher extends RouterLauncher {
    19 
    20   def pid(p: Process): Long = {
    21     val procField = p.getClass.getDeclaredField("p")
    22     procField.synchronized {
    23       procField.setAccessible(true)
    24       val proc = procField.get(p)
    25       try {
    26         proc match {
    27           case unixProc
    28             if unixProc.getClass.getName == "java.lang.UNIXProcess" => {
    29             val pidField = unixProc.getClass.getDeclaredField("pid")
    30             pidField.synchronized {
    31               pidField.setAccessible(true)
    32               try {
    33                 pidField.getLong(unixProc)
    34               } finally {
    35                 pidField.setAccessible(false)
    36               }
    37             }
    38           }
    39           case procImpl:java.lang.Process => {
    40             val f: Field = p.getClass().getDeclaredField("p")
    41             val f2: Field = f.get(p).getClass.getDeclaredField("pid")
    42             try {
    43               f.setAccessible(true)
    44               f2.setAccessible(true)
    45               val pid = f2.getLong(p)
    46               pid
    47             } finally {
    48               f2.setAccessible(false)
    49               f.setAccessible(false)
    50             }
    51           }
    52           // If someone wants to add support for Windows processes,
    53           // this would be the right place to do it:
    54           case _ => throw new RuntimeException(
    55             "Cannot get PID of a " + proc.getClass.getName)
    56         }
    57       } finally {
    58         procField.setAccessible(false)
    59       }
    60     }
    61   }
    62 
    6319
    6420  // ??? equals "throw not implemented" IIRC - it compiles at least :)
Note: See TracChangeset for help on using the changeset viewer.