diff --git a/README.md b/README.md index b95d853d1..06abba8f6 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ To get development branch from source control: https://geti2p.net/newdevelopers http://www.gnu.org/software/gettext/ - Build environment must use a UTF-8 locale. -### Build process +### Ant build process On x86 systems do: @@ -46,6 +46,20 @@ On non-x86, use one of the following instead: Run 'ant' with no arguments to see other build options. +### Gradle build process + +Full builds of installers or updates are not yet possible, but the code can be +compiled with: + + ./gradlew assemble + +This will download dependencies over the clearnet by default, including Gradle +itself. To download through a SOCKS proxy (e.g. Tor), add the following lines to +your `~/.gradle/gradle.properties`: + + systemProp.socksProxyHost=localhost + systemProp.socksProxyPort=9150 + ## Contact info Need help? See the IRC channel #i2p on irc.freenode.net diff --git a/README.txt b/README.txt index 31e99c234..c13095993 100644 --- a/README.txt +++ b/README.txt @@ -19,6 +19,16 @@ To build: Run 'ant' with no arguments to see other build options. See INSTALL.txt or https://geti2p.net/download for installation instructions. +Gradle build system: + Full builds are not yet possible, but the command is: + ./gradlew assemble + + gradlew will download dependencies over the clearnet by default, including + Gradle itself. To download over Tor, create a gradle.properties file + containing: + systemProp.socksProxyHost=localhost + systemProp.socksProxyPort=9150 + Documentation: https://geti2p.net/how API: http://docs.i2p-projekt.de/javadoc/ diff --git a/apps/BOB/build.gradle b/apps/BOB/build.gradle new file mode 100644 index 000000000..309b5768e --- /dev/null +++ b/apps/BOB/build.gradle @@ -0,0 +1,12 @@ +sourceSets { + main { + java { + srcDir 'src' + } + } +} + +dependencies { + compile project(':core') + compile project(':apps:ministreaming') +} diff --git a/apps/addressbook/build.gradle b/apps/addressbook/build.gradle new file mode 100644 index 000000000..184c59c9a --- /dev/null +++ b/apps/addressbook/build.gradle @@ -0,0 +1,12 @@ +sourceSets { + main { + java { + srcDir 'java/src' + } + } +} + +dependencies { + compile project(':core') + compile project(':apps:jetty') +} diff --git a/apps/desktopgui/build.gradle b/apps/desktopgui/build.gradle new file mode 100644 index 000000000..36f8eaaed --- /dev/null +++ b/apps/desktopgui/build.gradle @@ -0,0 +1,13 @@ +sourceSets { + main { + java { + srcDir 'src' + } + } +} + +dependencies { + compile project(':core') + compile project(':router') + compile project(':installer') +} diff --git a/apps/i2psnark/build.gradle b/apps/i2psnark/build.gradle new file mode 100644 index 000000000..23137a085 --- /dev/null +++ b/apps/i2psnark/build.gradle @@ -0,0 +1,43 @@ +apply plugin: 'war' + +sourceSets { + main { + java { + srcDir 'java/src' + } + } +} + +dependencies { + compile project(':core') + compile project(':apps:systray') + providedCompile project(':apps:ministreaming') + providedCompile project(':apps:jetty') +} + +task i2psnarkJar(type: Jar) { + from sourceSets.main.output + exclude 'org/klomp/snark/standalone/**' + exclude 'org/klomp/snark/web/**' + manifest { + attributes 'Main-Class': 'org.klomp.snark.Snark' + attributes 'Class-Path': 'i2p.jar mstreaming.jar streaming.jar' + } +} + +// TODO: standalone jar. This is rather involved! + +artifacts { + archives i2psnarkJar +} + +war { + into '.icons', { + from 'icons' + } + webInf { + into 'classes/org/klomp/snark/web' + from 'mime.properties' + } + webXml = file('web.xml') +} diff --git a/apps/i2ptunnel/build.gradle b/apps/i2ptunnel/build.gradle new file mode 100644 index 000000000..527f5135b --- /dev/null +++ b/apps/i2ptunnel/build.gradle @@ -0,0 +1,59 @@ +apply plugin: 'war' + +sourceSets { + main { + java { + srcDir 'java/src' + } + } + test { + java { + srcDir 'java/test/junit' + } + } +} + +dependencies { + compile project(':core') + compile project(':apps:ministreaming') + providedCompile project(':apps:jetty') +} + +task i2ptunnelJar(type: Jar) { + from sourceSets.main.output + exclude '**/ui/*.class' + exclude '**/EditBean.class' + exclude '**/IndexBean.class' + manifest { + attributes 'Main-Class': 'net.i2p.i2ptunnel.I2PTunnel' + attributes 'Class-Path': 'i2p.jar mstreaming.jar' + } +} + +task tempBeansJar(type: Jar) { + from sourceSets.main.output + include '**/EditBean.class' + include '**/ui/*.class' + include '**/IndexBean.class' + baseName = 'temp-beans' +} + +task uiJar(type: Jar) { + baseName = 'i2ptunnel-ui' + from sourceSets.main.output + include '**/ui/*.class' + manifest { + attributes 'Class-Path' : 'i2p.jar mstreaming.jar i2ptunnel.jar' + } +} + +artifacts { + archives i2ptunnelJar, tempBeansJar, uiJar +} + +war { + from 'jsp' + exclude 'jsp/web.xml' + webXml = file('jsp/web.xml') +} + diff --git a/apps/jetty/build.gradle b/apps/jetty/build.gradle new file mode 100644 index 000000000..ef13b9c2f --- /dev/null +++ b/apps/jetty/build.gradle @@ -0,0 +1,34 @@ +archivesBaseName = 'jetty-i2p' + +sourceSets { + main { + java { + srcDir 'java/src' + } + } +} + +dependencies { + ext.jettyVersion = '9.2.21.v20170120' + ext.tomcatVersion = '8.0.33' + compile project(':core') + compile 'commons-logging:commons-logging:1.0.4' + compile 'org.eclipse.jetty.orbit:javax.servlet.jsp:2.2.0.v201112011158' + compile 'org.eclipse.jetty:jetty-http:' + ext.jettyVersion + compile 'org.eclipse.jetty:jetty-io:' + ext.jettyVersion + compile 'org.eclipse.jetty:jetty-security:' + ext.jettyVersion + compile 'org.eclipse.jetty:jetty-server:' + ext.jettyVersion + compile 'org.eclipse.jetty:jetty-servlet:' + ext.jettyVersion + compile 'org.eclipse.jetty:jetty-util:' + ext.jettyVersion + compile 'org.eclipse.jetty:jetty-xml:' + ext.jettyVersion + runtime 'org.eclipse.jetty:apache-jsp:' + ext.jettyVersion + runtime 'org.eclipse.jetty:jetty-continuation:' + ext.jettyVersion + runtime 'org.eclipse.jetty:jetty-deploy:' + ext.jettyVersion + runtime 'org.eclipse.jetty:jetty-jmx:' + ext.jettyVersion + runtime 'org.eclipse.jetty:jetty-rewrite:' + ext.jettyVersion + runtime 'org.eclipse.jetty:jetty-servlets:' + ext.jettyVersion + runtime 'org.eclipse.jetty:jetty-start:' + ext.jettyVersion + runtime 'org.eclipse.jetty:jetty-webapp:' + ext.jettyVersion + runtime 'org.mortbay.jasper:apache-el:' + ext.tomcatVersion + runtime 'org.mortbay.jasper:apache-jsp:' + ext.tomcatVersion +} diff --git a/apps/jrobin/build.gradle b/apps/jrobin/build.gradle new file mode 100644 index 000000000..5efcf77b9 --- /dev/null +++ b/apps/jrobin/build.gradle @@ -0,0 +1,11 @@ +sourceSets { + main { + java { + srcDir 'java/src' + } + } +} + +dependencies { + compile project(':core') +} diff --git a/apps/ministreaming/build.gradle b/apps/ministreaming/build.gradle new file mode 100644 index 000000000..ee5001ea1 --- /dev/null +++ b/apps/ministreaming/build.gradle @@ -0,0 +1,32 @@ +apply plugin: 'java-library' + +archivesBaseName = 'mstreaming' + +sourceSets { + main { + java { + srcDir 'java/src' + } + } + test { + java { + srcDir 'java/test/junit' + } + } +} + +dependencies { + api project(':core') +} + +configurations { + tests +} +task testJar(type: Jar) { + baseName = 'mstreaming-test' + dependsOn classes + from sourceSets.test.output +} +artifacts { + tests testJar +} diff --git a/apps/routerconsole/build.gradle b/apps/routerconsole/build.gradle new file mode 100644 index 000000000..000fa5cc8 --- /dev/null +++ b/apps/routerconsole/build.gradle @@ -0,0 +1,39 @@ +apply plugin: 'war' + +sourceSets { + main { + java { + srcDir 'java/src' + } + } +} + +dependencies { + compile project(':core') + compile project(':router') + compile project(':installer') + providedCompile project(':apps:desktopgui') + providedCompile project(':apps:systray') + providedCompile project(':apps:jetty') + providedCompile project(':apps:jrobin') +} + +jar { + manifest { + // Top level installer will rename to jrobin.jar + // DTG added in 0.8.4, not in the classpath for very old installs, + // before we changed wrapper.config to specify * + // very old installs don't have i2psnark,jstl,standard in the classpath... + // not added in WebAppConfiguration any more + // 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' + } +} + +war { + from 'jsp' + // Remove classes from the classpath, they are in the jar. + // If we return to precompiling jsps this needs to change. + classpath = [] + webXml = file('jsp/web.xml') +} diff --git a/apps/sam/build.gradle b/apps/sam/build.gradle new file mode 100644 index 000000000..c3bf372a7 --- /dev/null +++ b/apps/sam/build.gradle @@ -0,0 +1,17 @@ +sourceSets { + main { + java { + srcDir 'java/src' + } + } + test { + java { + srcDir 'java/test' + } + } +} + +dependencies { + compile project(':core') + compile project(':apps:ministreaming') +} diff --git a/apps/streaming/build.gradle b/apps/streaming/build.gradle new file mode 100644 index 000000000..45bd7e1ee --- /dev/null +++ b/apps/streaming/build.gradle @@ -0,0 +1,20 @@ +apply plugin: 'java-library' + +sourceSets { + main { + java { + srcDir 'java/src' + } + } + test { + java { + srcDir 'java/test/junit' + } + } +} + +dependencies { + api project(':core') + api project(':apps:ministreaming') + testImplementation project(path: ':apps:ministreaming', configuration: 'tests') +} diff --git a/apps/susidns/build.gradle b/apps/susidns/build.gradle new file mode 100644 index 000000000..103163af7 --- /dev/null +++ b/apps/susidns/build.gradle @@ -0,0 +1,20 @@ +apply plugin: 'war' + +sourceSets { + main { + java { + srcDir 'src/java/src' + } + } +} + +dependencies { + compile project(':core') + providedCompile project(':apps:jetty') +} + +war { + from 'src/jsp' + from 'src/index.html' + webXml = file('src/WEB-INF/web-template.xml') +} diff --git a/apps/susimail/build.gradle b/apps/susimail/build.gradle new file mode 100644 index 000000000..7cb5787fc --- /dev/null +++ b/apps/susimail/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'war' + +sourceSets { + main { + java { + srcDir 'src/src' + } + } +} + +dependencies { + compile project(':core') + providedCompile project(':apps:jetty') +} + +war { + from 'src' + exclude 'WEB-INF/web.xml' + exclude 'LICENSE' + exclude 'src' + exclude 'susimail.properties' + webInf { + into 'classes' + from 'src/susimail.properties' + } + webXml = file('src/WEB-INF/web.xml') +} diff --git a/apps/systray/build.gradle b/apps/systray/build.gradle new file mode 100644 index 000000000..035b394f0 --- /dev/null +++ b/apps/systray/build.gradle @@ -0,0 +1,12 @@ +sourceSets { + main { + java { + srcDir 'java/src' + } + } +} + +dependencies { + compile project(':core') + compile files('java/lib/systray4j.jar') +} diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..8ccdfd252 --- /dev/null +++ b/build.gradle @@ -0,0 +1,31 @@ +subprojects { + apply plugin: 'java' + apply plugin: 'eclipse' + + repositories { + jcenter() + } + + + dependencies { + testCompile 'junit:junit:4.+' + testCompile 'org.hamcrest:hamcrest-library:1.3' + testCompile 'org.mockito:mockito-core:2.11.0' + } + + jar { + manifest { + attributes 'Implementation-Version': '0.9.31-7' + } + } + + sourceCompatibility = 1.7 + // Set i2pBootClasspath=/path/to/rt.jar:/path/to/jce.jar in ~/.gradle/gradle.properties if needed + if (i2pBootClasspath) { + tasks.withType(AbstractCompile, { AbstractCompile ac -> + ac.options.bootstrapClasspath = files(i2pBootClasspath) + }) + } +} + +//apply from: file('gradle/update.gradle') diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 000000000..5f37909d8 --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,38 @@ +apply plugin: 'java-library' + +archivesBaseName = 'i2p' + +sourceSets { + main { + java { + srcDir 'java/src' + } + resources { + srcDir 'java/src' + include 'gnu/getopt/*.properties' + } + } + test { + java { + srcDir 'java/test/junit' + } + resources { + srcDir 'java/test/junit' + include 'net/i2p/crypto/eddsa/test.data' + include 'net/i2p/crypto/eddsa/math/baseDblPrecmp' + include 'net/i2p/crypto/eddsa/math/basePrecmp' + } + } +} + +configurations { + tests +} +task testJar(type: Jar) { + baseName = 'i2p-test' + dependsOn classes + from sourceSets.test.output +} +artifacts { + tests testJar +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..63fe06e83 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +# Override these in ~/.gradle/gradle.properties if necessary +i2pBootClasspath= diff --git a/gradle/update.gradle b/gradle/update.gradle new file mode 100644 index 000000000..fc4cdc391 --- /dev/null +++ b/gradle/update.gradle @@ -0,0 +1,78 @@ +task prepUpdateRouter(type: Copy) { + dependsOn ':core:jar', ':router:jar' + // Pass in paths as a closure, so they are not executed during configuration + from {[ + project(':core').jar.archivePath, + project(':router').jar.archivePath + ]} + into 'pkg-temp/lib' +} + +task prepUpdateSmall(type: Copy) { + dependsOn prepUpdateRouter + dependsOn ':apps:ministreaming:jar', ':apps:streaming:jar' + dependsOn ':apps:routerconsole:jar', ':apps:i2ptunnel:i2ptunnelJar' + dependsOn ':apps:routerconsole:war', ':apps:i2ptunnel:war' + dependsOn ':apps:addressbook:war' + // Base dir + into 'pkg-temp' + into('lib') { + from {[ + project(':apps:ministreaming').jar.archivePath, + project(':apps:streaming').jar.archivePath, + project(':apps:routerconsole').jar.archivePath, + project(':apps:i2ptunnel').i2ptunnelJar.archivePath, + ]} + // pulled out of routerconsole.jar in 0.7.12, someday we can take out of updater + // name without version so we can overwrite if we upgrade + from('apps/jrobin/jrobin-1.5.9.1.jar') { + rename { 'jrobin.jar' } + } + } + into('webapps') { + from {[ + project(':apps:routerconsole').war.archivePath, + project(':apps:i2ptunnel').war.archivePath, + project(':apps:addressbook').war.archivePath, + ]} + } +} + +task prepUpdate(type: Copy) { + dependsOn prepUpdateSmall + dependsOn ':apps:BOB:jar', ':apps:sam:jar' + dependsOn ':apps:i2psnark:i2psnarkJar', ':apps:systray:jar' + //dependsOn ':apps:desktopgui:jar' + dependsOn ':apps:susidns:war', ':apps:susimail:war' + dependsOn ':apps:i2psnark:war' + // Base dir + into 'pkg-temp' + into('lib') { + from {[ + project(':apps:BOB').jar.archivePath, + project(':apps:sam').jar.archivePath, + project(':apps:i2psnark').i2psnarkJar.archivePath, + // include systray changes in 0.7.5 + project(':apps:systray').jar.archivePath, + // removed from updater in 0.9 + //project(':apps:desktopgui').jar.archivePath, + ]} + // as of 0.7.12; someday, we can remove these from the updater + from 'apps/susidns/src/WEB-INF/lib/jstl.jar' + from 'apps/susidns/src/WEB-INF/lib/standard.jar' + } + into('webapps') { + from {[ + project(':apps:susidns').war.archivePath, + project(':apps:susimail').war.archivePath, + project(':apps:i2psnark').war.archivePath, + ]} + } + from('history.txt') { + filter(org.apache.tools.ant.filters.HeadFilter, lines:1500) + } + doLast { + String more = '\n\n----------------\n\nEARLIER HISTORY IS AVAILABLE IN THE SOURCE PACKAGE' + ant.concat(more, append: 'true', destfile: 'pkg-temp/history.txt') + } +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..27768f1bb Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..92165eede --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip diff --git a/gradlew b/gradlew new file mode 100755 index 000000000..cccdd3d51 --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..e95643d6a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/installer/build.gradle b/installer/build.gradle new file mode 100644 index 000000000..469ff1134 --- /dev/null +++ b/installer/build.gradle @@ -0,0 +1,22 @@ +sourceSets { + main { + java { + srcDir 'java/src' + } + } +} + +dependencies { + compile project(':core') + runtime files('lib/wrapper/all/wrapper.jar') +} + +jar { + baseName 'utility' + from project(':core').sourceSets.main.output + include 'net/i2p/installer/**' + include 'net/i2p/util/FileUtil.class' + manifest { + attributes 'Main-Class': 'net.i2p.installer.Main' + } +} diff --git a/router/build.gradle b/router/build.gradle new file mode 100644 index 000000000..e38bb9688 --- /dev/null +++ b/router/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'java-library' + +sourceSets { + main { + java { + srcDir 'java/src' + } + } + test { + java { + srcDir 'java/test/junit' + } + } +} + +dependencies { + api project(':core') + testImplementation project(path: ':core', configuration: 'tests') +} + +jar { + manifest { + // 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' + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 000000000..580063a4c --- /dev/null +++ b/settings.gradle @@ -0,0 +1,17 @@ +include 'apps:addressbook' +include 'apps:BOB' +include 'apps:desktopgui' +include 'apps:i2psnark' +include 'apps:i2ptunnel' +include 'apps:jetty' +include 'apps:jrobin' +include 'apps:ministreaming' +include 'apps:routerconsole' +include 'apps:sam' +include 'apps:streaming' +include 'apps:susidns' +include 'apps:susimail' +include 'apps:systray' +include 'core' +include 'installer' +include 'router'