Realised a better way to handle the build process of both the

Browser Bundle i2p launcher, as well as the upcoming Mac OS X
i2p launcher. They share some few properties and how code has
to be managed for both system's update managers and so on.
More details will be documentated in README.md files as well as
in those commit messages I now write :)
This commit is contained in:
meeh
2018-04-22 23:13:32 +00:00
parent b9a2459315
commit 8c10ec9db3
25 changed files with 166 additions and 55 deletions

View File

@ -297,6 +297,28 @@
</script>
</target>
<target name="bbLauncher" depends="build">
<sequential>
<exec executable="sbt" dir="launcher" failonerror="true">
<arg value="browserbundle:clean" />
</exec>
<exec executable="sbt" dir="launcher" failonerror="true">
<arg value="browserbundle:assembly" />
</exec>
</sequential>
</target>
<target name="osxLauncher" depends="build">
<sequential>
<exec executable="sbt" dir="launcher" failonerror="true">
<arg value="macosx:clean" />
</exec>
<exec executable="sbt" dir="launcher" failonerror="true">
<arg value="macosx:assembly" />
</exec>
</sequential>
</target>
<target name="buildBOB" depends="buildStreaming" >
<ant dir="apps/BOB/" target="jar" />
<copy file="apps/BOB/dist/BOB.jar" todir="build/" />

View File

@ -1,9 +0,0 @@
# The Launcher
This code won't really make any sense for other than in the portable i2p that's shipped with the browser bundle.
Anyway, if you wanna build it and have fun, just do `./sbt`
Scala isn't scary - it's java except the ;;;;;;;; ;)

View File

@ -1,46 +0,0 @@
import sbtassembly.AssemblyPlugin.defaultShellScript
import sbt.Keys._
lazy val root = (project in file("."))
.settings(
name := "RouterLaunchApp",
organization := "net.i2p",
scalaVersion := "2.11.11", // We have to use Scala 11 as long as we're going to support JRE 1.7
version := "0.1.0-SNAPSHOT",
assemblyJarName in assembly := s"${name.value}-${version.value}.jar",
mainClass in assembly := Some("net.i2p.RouterLauncherApp")
// This will prepend shebang and become executable, however, it will only work on unix systems and not windows.
//assemblyOption in assembly := (assemblyOption in assembly).value.copy(prependShellScript = Some(defaultShellScript))
)
resolvers ++= Seq(
DefaultMavenRepository,
Resolver.mavenLocal,
Resolver.sonatypeRepo("releases"),
Resolver.typesafeRepo("releases"),
Resolver.sbtPluginRepo("releases")
)
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-native" % "3.5.3"
)
assemblyExcludedJars in assembly := {
val donts = List("BOB.jar", "sam.jar", "desktopgui.jar", "i2ptunnel-ui.jar", "i2psnark.jar", "jetty-sslengine.jar")
val cp = (fullClasspath in assembly).value
cp filter { s => donts.contains(s.data.getName)}
}
fork := true
run / javaOptions += "-Xmx512M"
run / connectInput := true
unmanagedBase := baseDirectory.value / ".." / "build"
unmanagedClasspath in Compile ++= Seq(
baseDirectory.value / ".." / "build" / "*.jar"
)

11
launchers/README.md Normal file
View File

@ -0,0 +1,11 @@
# The Launcher
Here you'll find the code for the next generation Mac OS X launcher, as well as the Browser Bundle i2p launcher.
Anyway, if you wanna build it and have fun, just do `./sbt`
Scala isn't scary - it's java except the ;;;;;;;; ;)
https://www.scala-lang.org/
https://www.scala-sbt.org/

View File

@ -0,0 +1,5 @@
# The browser bundle i2p launcher
This code won't really make any sense for other than in the portable i2p that's shipped with the browser bundle.

View File

@ -0,0 +1,26 @@
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-native" % "3.5.3"
)
assemblyExcludedJars in assembly := {
val donts = List(
"BOB.jar",
"sam.jar",
"desktopgui.jar",
"i2ptunnel-ui.jar",
"i2psnark.jar",
"jetty-sslengine.jar"
)
val cp = (fullClasspath in assembly).value
cp filter { s => donts.contains(s.data.getName)}
}
// Unmanaged base will be included in a fat jar
unmanagedBase := baseDirectory.value / ".." / ".." / "build"
// Unmanaged classpath will be available at compile time
unmanagedClasspath in Compile ++= Seq(
baseDirectory.value / ".." / ".." / "build" / "*.jar"
)

44
launchers/build.sbt Normal file
View File

@ -0,0 +1,44 @@
import sbt.Keys._
resolvers ++= Seq(
DefaultMavenRepository,
Resolver.mavenLocal,
Resolver.sonatypeRepo("releases"),
Resolver.typesafeRepo("releases"),
Resolver.sbtPluginRepo("releases")
)
lazy val commonSettings = Seq(
organization := "net.i2p",
scalaVersion := "2.11.11", // We have to use Scala 11 as long as we're going to support JRE 1.7
version := "0.1.0-SNAPSHOT"
)
lazy val browserbundle = (project in file("browserbundle"))
.settings(
commonSettings,
name := "RouterLaunchApp",
assemblyJarName in assembly := s"${name.value}-${version.value}.jar",
mainClass in assembly := Some("net.i2p.RouterLauncherApp")
)
lazy val macosx = (project in file("macosx"))
.settings(
commonSettings,
name := "RouterLaunchApp",
assemblyJarName in assembly := s"${name.value}-${version.value}.jar",
mainClass in assembly := Some("net.i2p.MacOSXRouterLauncherApp")
)
lazy val root = (project in file("."))
.aggregate(browserbundle, macosx)
fork := true
run / javaOptions += "-Xmx512M"
run / connectInput := true

View File

@ -0,0 +1,8 @@
# The Mac OS X Launcher
**Note** this project is WIP, cause Meeh has yet to merge in Obj-C/Swift code for GUI stuff in OSX.
However, this is a thin wrapper launching both Mac OS X trayicon and the I2P router - and make them talk together.
More code will be merged in, it's just a f* mess which Meeh needs to clean up and move into repo.

View File

@ -0,0 +1,22 @@
import sbtassembly.AssemblyPlugin.defaultShellScript
lazy val i2pVersion = "0.9.34"
// Unmanaged classpath will be available at compile time
unmanagedClasspath in Compile ++= Seq(
baseDirectory.value / ".." / ".." / "build" / "*.jar",
baseDirectory.value / ".." / ".." / "router" / "java" / "src"
)
// 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}"

View File

@ -0,0 +1,28 @@
package net.i2p
import net.i2p.router.Router
/**
*
* For java developers:
* A scala object is like an instance of a class.
* If you define a method inside an object, it's equals to
* java's static methods.
*
* Also, in scala, the body of a class/object is executed as it's
* constructor.
*
* Also noteworthy;
* val is immutable
* var is mutable
*
*
* @author Meeh
* @version 0.0.1
* @since 0.9.35
*/
object MacOSXRouterLauncherApp extends App {
Router.main(args)
}