Build: Improve i2psnark standalone build

by not depending on router, and not bundling DTG internal classes
This commit is contained in:
zzz
2026-08-22 14:56:23 -04:00
parent 517e660389
commit cf329f3829
3 changed files with 62 additions and 5 deletions
+45 -1
View File
@@ -43,6 +43,27 @@
</javac>
</target>
<!-- exclude router classes, for i2psnark standalone -->
<target name="compile-external" depends="init">
<javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
release="${javac.release}"
includeAntRuntime="false"
encoding="UTF-8"
sourcepath=""
srcdir="${src}" destdir="${build}">
<compilerarg line="${javac.compilerargs}" />
<include name="**/*.java" />
<exclude name="**/InternalTrayManager.java" />
<exclude name="**/Main.java" />
<exclude name="**/RouterManager.java" />
<classpath>
<pathelement location="../../core/java/build/i2p.jar" />
<pathelement location="../../installer/lib/wrapper/all/wrapper.jar" />
<pathelement location="../systray/java/build/systray.jar" />
</classpath>
</javac>
</target>
<target name="bundle" unless="no.bundle" depends="init">
<exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
<env key="JAVA_HOME" value="${java.home}" />
@@ -84,7 +105,7 @@
</exec>
</target>
<target name="jar" depends="compile, bundle, listChangedFiles" unless="jar.uptodate" >
<target name="jar" depends="compile, bundle, listChangedFiles" >
<!-- set if unset -->
<property name="workspace.changes.tr" value="" />
<!-- ideal for linux: 24x24, but transparency doesn't work -->
@@ -106,6 +127,29 @@
</jar>
</target>
<!-- exclude router classes, for i2psnark standalone -->
<target name="jar-external" depends="compile-external, bundle, listChangedFiles" >
<!-- set if unset -->
<property name="workspace.changes.tr" value="" />
<!-- ideal for linux: 24x24, but transparency doesn't work -->
<copy tofile="${build}/desktopgui/resources/images/logo.png" file="../../apps/routerconsole/jsp/themes/console/images/itoopie_xsm.png" />
<copy todir="${build}/desktopgui/resources/images" file="images/itoopie_black_24.png" />
<copy todir="${build}/desktopgui/resources/images" file="images/itoopie_white_24.png" />
<jar basedir="${build}" excludes="messages-src/** **/router/* **/Internal* **/Main*" destfile="${dist}/${jar}">
<manifest>
<attribute name="Main-Class" value="net.i2p.desktopgui.ExternalMain"/>
<attribute name="${manifest.classpath.name}" value="i2p.jar" />
<attribute name="Implementation-Version" value="${full.version}" />
<attribute name="Built-By" value="${build.built-by}" />
<attribute name="Build-Date" value="${build.timestamp}" />
<attribute name="Base-Revision" value="${workspace.version}" />
<attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
<attribute name="X-Compile-Source-JDK" value="${javac.version}" />
<attribute name="X-Compile-Target-JDK" value="${javac.version}" />
</manifest>
</jar>
</target>
<target name="jarUpToDate">
<uptodate property="jar.uptodate" targetfile="${dist}/${jar}" >
<srcfiles dir= "." includes="build/**/*.class" />
@@ -5,13 +5,14 @@ import java.awt.PopupMenu;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.Method;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.SwingWorker;
import net.i2p.I2PAppContext;
import net.i2p.desktopgui.router.RouterManager;
//import net.i2p.desktopgui.router.RouterManager;
/**
* When started before the router, e.g. with
@@ -35,7 +36,13 @@ class ExternalTrayManager extends TrayManager {
new SwingWorker<Object, Object>() {
@Override
protected Object doInBackground() throws Exception {
RouterManager.start();
// Use reflection to compile without router classes for external-only
//RouterManager.start();
try {
Class mgr = Class.forName("net.i2p.desktopgui.router.RouterManager");
Method start = mgr.getMethod("start", new Class[0]);
start.invoke(mgr);
} catch (Exception e) {}
return null;
}
+8 -2
View File
@@ -385,6 +385,12 @@
<copy file="apps/desktopgui/dist/desktopgui.jar" todir="build/" />
</target>
<!-- exclude router dependencies, for i2psnark standalone -->
<target name="buildDesktopGui-external" depends="buildCore, buildSystray" >
<ant dir="apps/desktopgui" target="jar-external" />
<copy file="apps/desktopgui/dist/desktopgui.jar" todir="build/" />
</target>
<target name="buildRouterConsole" depends="buildrouter, buildSystray, buildDesktopGui, buildJetty, buildJrobin" >
<ant dir="apps/routerconsole/java/" target="jar" />
</target>
@@ -2390,7 +2396,7 @@
</target> -->
<!-- standalone i2psnark zip -->
<target name="i2psnark" depends="buildStreaming, buildJetty, buildSystray, jbigi, buildDesktopGui" >
<target name="i2psnark" depends="buildStreaming, buildJetty, buildSystray, jbigi, buildDesktopGui-external" >
<ant dir="apps/i2psnark/java" target="standalone" />
<copy file="apps/i2psnark/java/build/i2psnark-standalone.zip" todir="." />
</target>
@@ -2400,7 +2406,7 @@
</target>
<!-- standalone susimail zip -->
<target name="susimail" depends="buildStreaming, buildJetty, buildSystray, jbigi, buildDesktopGui" >
<target name="susimail" depends="buildStreaming, buildJetty, buildSystray, jbigi, buildDesktopGui-external" >
<ant dir="apps/susimail" target="standalone" />
<copy file="apps/susimail/build/susimail-standalone.zip" todir="." />
</target>