From 46fe1ba74adaeb65522021c8164b5779908896cf Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 1 Jan 2021 10:17:00 -0500 Subject: [PATCH] Build: Gradle fixes Add resources to jars and wars remove .jsi and .jsp files from wars remove classes that are in jars from the wars for apps that have both compile jsps in routerconsole.war build routerconsole.jar --- apps/i2psnark/build.gradle | 12 +++++++++--- apps/i2ptunnel/build.gradle | 21 +++++++++++++++++++++ apps/routerconsole/build.gradle | 26 ++++++++++++++++++++++---- apps/susidns/build.gradle | 11 +++++++++++ core/build.gradle | 3 +++ router/build.gradle | 3 +++ settings.gradle | 3 +++ 7 files changed, 72 insertions(+), 7 deletions(-) diff --git a/apps/i2psnark/build.gradle b/apps/i2psnark/build.gradle index 001043e99..b9f7037d1 100644 --- a/apps/i2psnark/build.gradle +++ b/apps/i2psnark/build.gradle @@ -35,12 +35,18 @@ artifacts { } war { - into '.icons', { - from 'icons' - } + rootSpec.exclude('/org/klomp/snark/*.class') + rootSpec.exclude('/org/klomp/snark/bencode/**') + rootSpec.exclude('/org/klomp/snark/comments/**') + rootSpec.exclude('/org/klomp/snark/dht/**') + rootSpec.exclude('/org/klomp/snark/standalone/**') + from ('resources', { + into ".resources" + }) webInf { into 'classes/org/klomp/snark/web' from 'mime.properties' } webXml = file('web.xml') + // TODO why is this in there? WEB-INF/lib/systray.jar } diff --git a/apps/i2ptunnel/build.gradle b/apps/i2ptunnel/build.gradle index 02180bd45..8b9259bd4 100644 --- a/apps/i2ptunnel/build.gradle +++ b/apps/i2ptunnel/build.gradle @@ -31,6 +31,16 @@ task i2ptunnelJar(type: Jar) { attributes 'Main-Class': 'net.i2p.i2ptunnel.I2PTunnel' attributes 'Class-Path': 'i2p.jar mstreaming.jar' } + from ('resources', { + into "net/i2p/i2ptunnel/resources" + }) + from ('../routerconsole/jsp', { + include 'themes/console/*/*.css' + include 'themes/console/images/i2plogo.png' + include 'themes/console/images/favicon.ico' + include 'themes/console/images/itoopie_sm.png' + into "net/i2p/i2ptunnel/resources" + }) } task tempBeansJar(type: Jar) { @@ -56,7 +66,18 @@ artifacts { war { from 'jsp' + rootSpec.exclude('/net/i2p/i2ptunnel/*.class') + rootSpec.exclude('/net/i2p/i2ptunnel/access') + rootSpec.exclude('/net/i2p/i2ptunnel/irc') + rootSpec.exclude('/net/i2p/i2ptunnel/localServer') + rootSpec.exclude('/net/i2p/i2ptunnel/socks') + rootSpec.exclude('/net/i2p/i2ptunnel/streamr') + rootSpec.exclude('/net/i2p/i2ptunnel/udp') + rootSpec.exclude('/net/i2p/i2ptunnel/udpTunnel') exclude 'jsp/web.xml' + exclude '*.jsi' + exclude '*.jsp' webXml = file('jsp/web.xml') + // FIXME why is this in there? WEB-INF/lib/mstreaming.jar } diff --git a/apps/routerconsole/build.gradle b/apps/routerconsole/build.gradle index 879983d44..48f37c461 100644 --- a/apps/routerconsole/build.gradle +++ b/apps/routerconsole/build.gradle @@ -40,7 +40,9 @@ if (System.getenv("TARGET_JAVA_HOME") == null && JavaVersion.current() != JavaVe test.dependsOn scalaTest } -jar { +task consoleJar(type: Jar) { + from sourceSets.main.output + exclude 'net/i2p/router/web/helpers/**' manifest { // Top level installer will rename to jrobin.jar // DTG added in 0.8.4, not in the classpath for very old installs, @@ -50,12 +52,28 @@ jar { // All new jetty 7 jars should have been in 0.9.6, added in 0.9.7 attributes 'Class-Path': 'i2p.jar router.jar jrobin.jar desktopgui.jar i2psnark.jar jstl.jar standard.jar jetty-continuation.jar jetty-http.jar jetty-io.jar jetty-security.jar jetty-servlet.jar jetty-servlets.jar jetty-util.jar jetty-webapp.jar' } + from ('resources-news', { + into "net/i2p/router/news/resources" + }) +} + +artifacts { + archives consoleJar } war { + rootSpec.exclude('/com/vuze/**/*') + rootSpec.exclude('/edu/internet2/**/*') + rootSpec.exclude('/net/i2p/router/news/*') + rootSpec.exclude('/net/i2p/router/sybil/*') + rootSpec.exclude('/net/i2p/router/update/*') + rootSpec.exclude('/net/i2p/router/web/*.class') from 'jsp' - // Remove classes from the classpath, they are in the jar. - // If we return to precompiling jsps this needs to change. - classpath = [] + exclude 'jsp/web.xml' + exclude '*.jsi' + exclude '*.jsp' webXml = file('jsp/web.xml') + from ('resources', { + into "WEB-INF/classes/net/i2p/router/web/resources" + }) } diff --git a/apps/susidns/build.gradle b/apps/susidns/build.gradle index ed958e3a9..e960b28f0 100644 --- a/apps/susidns/build.gradle +++ b/apps/susidns/build.gradle @@ -18,5 +18,16 @@ dependencies { war { from 'src/jsp' from 'src/index.html' + from ('src/js', { + into "js" + }) + from ('src/svg', { + into "svg" + }) + from ('src/themes', { + into "themes" + }) + exclude '*.jsi' + exclude '*.jsp' webXml = file('src/WEB-INF/web-template.xml') } diff --git a/core/build.gradle b/core/build.gradle index db161f711..338a61ec6 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -73,6 +73,9 @@ jar { attributes 'Implementation-Title': 'I2P Java Core API' attributes 'Main-Class': 'net.i2p.util.CommandLine' } + from ('resources', { + into "net/i2p/util/resources" + }) } configurations { diff --git a/router/build.gradle b/router/build.gradle index 7e73d59b9..43387ce2e 100644 --- a/router/build.gradle +++ b/router/build.gradle @@ -34,4 +34,7 @@ jar { // so people with very old wrapper.config files will still work with Jetty 6 attributes 'Class-Path': 'jetty-i2p.jar jetty-java5-threadpool.jar jetty-rewrite-handler.jar jetty-sslengine.jar jetty-start.jar jetty-util.jar' } + from ('resources', { + into "net/i2p/router/util/resources" + }) } diff --git a/settings.gradle b/settings.gradle index 0ca293b93..1a12aa700 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,3 +15,6 @@ include 'apps:susimail' include 'core' include 'installer' include 'router' +// TODO +//include 'apps:i2pcontrol' +//include 'apps:imagegen'