Changeset f6c8e44
- Timestamp:
- May 1, 2018 11:15:11 AM (3 years ago)
- Branches:
- master
- Children:
- c326bb7
- Parents:
- 345e741
- Location:
- launchers
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
launchers/browserbundle/build.sbt
r345e741 rf6c8e44 1 1 2 2 3 libraryDependencies ++= Seq(4 "org.json4s" %% "json4s-native" % "3.5.3"5 )6 3 7 4 assemblyExcludedJars in assembly := { -
launchers/browserbundle/src/main/scala/net/i2p/RouterLauncherApp.scala
r345e741 rf6c8e44 3 3 import java.io.{File, InputStream} 4 4 5 //import net.i2p.Router 5 6 import net.i2p.launchers.DeployProfile 6 import net.i2p.router.Router7 import org.json4s._8 import org.json4s.native.JsonMethods._9 7 10 8 /** … … 105 103 //ErrorUtils.printError(s"Starting up with arguments ${(args mkString ", ")}",":)") 106 104 107 Router.main(args)105 //Router.main(args) 108 106 } 109 107 -
launchers/build.sbt
r345e741 rf6c8e44 32 32 name := "RouterLaunchApp", 33 33 assemblyJarName in assembly := s"${name.value}-${version.value}.jar", 34 mainClass in assembly := Some("net.i2p.RouterLauncherApp") 34 mainClass in assembly := Some("net.i2p.RouterLauncherApp"), 35 libraryDependencies ++= Seq( 36 "org.json4s" %% "json4s-native" % "3.5.3" 37 ) 35 38 ).dependsOn(common) 36 39 … … 53 56 run / javaOptions += "-Xmx512M" 54 57 run / connectInput := true 58 -
launchers/common/src/main/scala/net/i2p/launchers/OSXDeployment.scala
r345e741 rf6c8e44 2 2 3 3 import java.io.{File, IOException} 4 import java.nio.file.FileAlreadyExistsException 4 5 import java.util.zip.ZipFile 6 7 import java.nio.file.StandardCopyOption.REPLACE_EXISTING 8 import java.nio.file.Files.copy 9 import java.nio.file.Paths.get 10 5 11 import collection.JavaConverters._ 6 12 … … 121 127 def copyDirFromRes(dir: File): Unit = { 122 128 // A small hack 123 val zipFile = new ZipFile(DeployProfile.executingJarFile.getFile) 124 zipFile.entries().asScala.toList.filter(_.toString.startsWith(dir.getPath)).filter(!_.isDirectory).map { entry => 125 new File(DeployProfile.pathJoin(baseDir,entry.getName)).getParentFile.mkdirs() 126 if (entry.isDirectory) { 127 createFileOrDirectory(new File(DeployProfile.pathJoin(baseDir,entry.getName)), true) 128 } else { 129 copyBaseFileResToDisk(entry.getName, getClass.getResourceAsStream("/".concat(entry.getName))) 130 } 129 try { 130 val zipFile = new ZipFile(DeployProfile.executingJarFile.getFile) 131 zipFile.entries().asScala.toList.filter(_.toString.startsWith(dir.getPath)).filter(!_.isDirectory).map { entry => 132 new File(DeployProfile.pathJoin(baseDir,entry.getName)).getParentFile.mkdirs() 133 if (entry.isDirectory) { 134 createFileOrDirectory(new File(DeployProfile.pathJoin(baseDir,entry.getName)), true) 135 } else { 136 copyBaseFileResToDisk(entry.getName, getClass.getResourceAsStream("/".concat(entry.getName))) 137 } 138 } 139 } catch { 140 case ex:IOException => println(s"Error! Exception ${ex}") 141 case _:FileAlreadyExistsException => {} // Ignored 131 142 } 132 143 } … … 157 168 } catch { 158 169 case ex:IOException => println(s"Error! Exception ${ex}") 170 case _:FileAlreadyExistsException => {} // Ignored 159 171 } 160 172 } … … 163 175 if (!new File(baseDir).exists()) { 164 176 new File(baseDir).mkdirs() 177 } 178 179 implicit def toPath (filename: String) = get(filename) 180 181 val selfFile = new File(DeployProfile.executingJarFile.getFile) 182 val selfDir = selfFile.getParentFile 183 val resDir = new File(selfDir.getParent, "Resources") 184 val i2pBaseBundleDir = new File(resDir, "i2pbase") 185 val i2pBundleJarDir = new File(i2pBaseBundleDir, "lib") 186 187 val i2pBaseDir = OSXDefaults.getOSXBaseDirectory 188 val i2pDeployJarDir = new File(i2pBaseDir, "lib") 189 if (!i2pDeployJarDir.exists()) { 190 i2pDeployJarDir.mkdirs() 191 i2pBundleJarDir.list().toList.map { 192 jar => { 193 copy ( 194 DeployProfile.pathJoin(i2pBundleJarDir.getAbsolutePath, jar), 195 DeployProfile.pathJoin(i2pDeployJarDir.getAbsolutePath, jar), 196 REPLACE_EXISTING) 197 println(s"Copied ${jar} to right place") 198 } 199 } 165 200 } 166 201 … … 185 220 case Left(is) => { 186 221 // Write file 187 if (!new File(DeployProfile.pathJoin(baseDir, fd.getPath)).exists()) { 222 val f = DeployProfile.pathJoin(baseDir, fd.getPath) 223 println(s"f: ${f.toString}") 224 if (!new File(f).exists()) { 188 225 //println(s"copyBaseFileResToDisk(${fd.getPath})") 189 226 try { … … 191 228 } catch { 192 229 case ex:IOException => println(s"Error! Exception ${ex}") 230 case _:FileAlreadyExistsException => {} // Ignored 193 231 } 194 232 } -
launchers/macosx/build.sbt
r345e741 rf6c8e44 32 32 resourceDirectory in Compile := baseDirectory.value / ".." / ".." / "installer" / "resources" 33 33 34 // Unmanaged base will be included in a fat jar 35 unmanagedBase in Compile := baseDirectory.value / ".." / ".." / "build" 36 34 37 // Unmanaged classpath will be available at compile time 35 38 unmanagedClasspath in Compile ++= Seq( 36 baseDirectory.value / ".." / ".." / "build" / "*.jar", 37 baseDirectory.value / ".." / ".." / "router" / "java" / "src" 39 baseDirectory.value / ".." / ".." / "build" / "*.jar" 38 40 ) 39 40 // Please note the difference between browserbundle, this has41 // the "in Compile" which limit it's scope to that.42 //unmanagedBase in Compile := baseDirectory.value / ".." / ".." / "build"43 44 libraryDependencies ++= Seq(45 "net.i2p" % "router" % i2pVersion % Compile46 )47 48 41 49 42 //assemblyOption in assembly := (assemblyOption in assembly).value.copy(prependShellScript = Some(defaultShellScript)) 50 43 51 assemblyJarName in assembly := s" ${name.value}-${version.value}"44 assemblyJarName in assembly := s"OSXLauncher" 52 45 53 46 … … 72 65 val dirsToCopy = List("certificates","locale","man") 73 66 67 val launcherBinary = Some(assembly.value) 68 launcherBinary.map { l => IO.copyFile( new File(l.toString), new File(paths.get("execBundlePath").get, "I2P") ) } 69 70 74 71 /** 75 72 * … … 86 83 dirsToCopy.map { d => IO.copyDirectory( new File(resDir, d), new File(paths.get("i2pbaseBunldePath").get, d) ) } 87 84 warsForCopy.map { w => IO.copyFile( new File(i2pBuildDir, w), new File(paths.get("webappsBunldePath").get, w) ) } 88 warsForCopy.map { j => IO.copyFile( new File(i2pBuildDir, j), new File(paths.get("i2pJarsBunldePath").get, j) ) }85 jarsForCopy.map { j => IO.copyFile( new File(i2pBuildDir, j), new File(paths.get("i2pJarsBunldePath").get, j) ) } 89 86 } -
launchers/macosx/src/main/scala/net/i2p/MacOSXRouterLauncherApp.scala
r345e741 rf6c8e44 1 1 package net.i2p 2 2 3 import net.i2p.router.Router 3 import java.io.File 4 5 import collection.JavaConverters._ 4 6 import net.i2p.launchers.{OSXDefaults, OSXDeployment} 5 import java.io.File6 7 7 8 /** … … 35 36 object MacOSXRouterLauncherApp extends App { 36 37 37 val i2pBaseDir = new File(OSXDefaults.getOSXBaseDirectory) 38 val i2pBaseDir = OSXDefaults.getOSXBaseDirectory 39 38 40 39 41 new OSXDeployment() … … 42 44 System.setProperty("user.dir", i2pBaseDir.getAbsolutePath) 43 45 44 Router.main(args) 46 val i2pJarDir = new File(i2pBaseDir.getAbsolutePath, "lib") 47 i2pJarDir.list().toList.map { jar => { 48 val jarFile = new File(i2pJarDir, jar) 49 println(s"Loading jar: ${jarFile.toURI.toURL} => ${MacOSXRouterLauncher.addJarToClassPath(jarFile.toURI.toURL)}") 50 51 } } 52 53 MacOSXRouterLauncher.runRouter(args) 54 //net.i2p.Router.main(args) 45 55 }
Note: See TracChangeset
for help on using the changeset viewer.