Files
processing4/build/linux/processing
A Samuel Pottinger ee299ef935 Move to ANTLR 4 with Java 11 lang features and localization. (#5)
* Move to ANTLR 4 with Java 11 lang features and localization.

Introduces ANTLR4 and Java 8 language feature support within IDE while also adding additional hooks for localization of syntax error messages, addressing https://github.com/processing/processing/issues/3054 and https://github.com/processing/processing/issues/3055.

The PR is broadly a continuation of https://github.com/processing/processing/issues/3055, bringing it up to speed with the latest Processing master plus the changes introduced at https://github.com/processing/processing/pull/5753. **Requires https://github.com/processing/processing/pull/5753 as pre-requisite.** This introduces a number of edits beyond https://github.com/processing/processing/issues/3055 beyond compatibility with current Processing master and https://github.com/processing/processing/pull/5753 including:

 - Update to the grammar itself
 - Change ANTLR listeners to emit `TextTransform.Edit` to unify JDT-based `PreprocessingService` and `JavaBuild`, removing code with duplicate purpose.
 - Introduction of syntax error rewriting with support for localization.
 - Addition of complete localized strings set for English and Spanish.
 - Addition of partial localized strings set for other languages.
 - Refactor of ANTLR-related code for testability and readability
 - Expansion of tests including full parse tests for new Java features (type inference, lambdas).

* Ask travis for ant upgrade prior to run.

* Ask Travis for java11 update.

* Add openjdk ppa

* Travis no confirmation on add ppa.

* Force newer ant on travis.

* Swtich ant download to www-us mirror.

* Switch ant to 1.10.7

* Start x for unit tests in travis.

* More complete start x in travis.

* Revert x in travis.

* Try x in services.
2019-10-05 23:34:38 -07:00

120 lines
3.0 KiB
Bash
Executable File

#!/bin/sh
# This script runs Processing, using the JRE in the Processing
# installation directory.
# If your system needs a different version of Java than what's included
# in the download, replace the 'java' folder with the contents of a new
# Oracle JRE (Java 8 only), or create a symlink named "java" in the
# Processing installation directory that points to the JRE home directory.
# This must be a Sun/Oracle JDK. For more details, see here:
# https://github.com/processing/processing/wiki/Supported-Platforms
# Thanks to Ferdinand Kasper for this build script. [fry]
# JARs required from JDK (anywhere in/below the JDK home directory)
JDKLIBS="rt.jar"
# Set this to non-zero for logging
LOGGING=0
# Logs name and value of a variable to stdout if LOGGING is non-zero.
# Expects the variable name as parameter $1.
log() {
if [ $LOGGING -ne 0 ]; then
eval echo $1=\$$1
fi
}
# Locates JDKLIBS in a directory and its subdirectories and saves their
# absolute paths as list to JDKCP. Expects the directory as parameter $1.
# Sets SUCCESS to 1 if all libraries were found, to 0 otherwise.
make_jdkcp() {
# Back out of JRE directory if apparently located inside a JDK
if [ -f "$1/../bin/java" ]; then
DIR="$1/.."
else
DIR="$1"
fi
log DIR
JDKCP=
SUCCESS=1
# Locate JDKLIBS
for L in $JDKLIBS; do
# Locate only the first library with a matching name
LIB=`find "$DIR" -name $L 2>/dev/null | head -n 1`
log L
log LIB
# Library found?
if [ -n "$LIB" ]; then
JDKCP="$JDKCP"${JDKCP:+:}"$LIB"
else
SUCCESS=0
fi
done
log JDKCP
}
# Get absolute path of directory where this script is located
APPDIR=`readlink -f "$0"`
APPDIR=`dirname "$APPDIR"`
log APPDIR
# Try using a local JDK from the same directory as this script
JDKDIR=`readlink -f "$APPDIR/java"`
make_jdkcp "$JDKDIR"
log SUCCESS
# Don't use the installed JDK, because it's not supported.
# Local JDK found?
#if [ $SUCCESS -ne 1 ]; then
# # No, try using the preferred system JRE/JDK (if any)
# JDKDIR=`which java` && JDKDIR=`readlink -e "$JDKDIR"` && JDKDIR=`dirname "$JDKDIR"`/..
# make_jdkcp "$JDKDIR"
# log SUCCESS
#fi
# Add all required JARs to CLASSPATH
CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$JDKCP"
for LIB in "$APPDIR"/lib/*.jar; do
CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$LIB"
done
for LIB in "$APPDIR"/core/library/*.jar; do
CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$LIB"
done
for LIB in "$APPDIR"/modes/java/mode/*.jar; do
CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$LIB"
done
export CLASSPATH
log CLASSPATH
# Make all JDK binaries available in PATH
export PATH="$JDKDIR/bin":"$PATH"
log PATH
current_name=`basename $0`
cmd_name='processing-java'
if [ $current_name = $cmd_name ]
then
java -Djna.nosys=true -Xmx512m processing.mode.java.Commander "$@"
exit $?
else
# Start Processing in the same directory as this script
if [ "$1" ]; then
SKETCH=`readlink -f "$1"`
else
SKETCH=
fi
cd "$APPDIR"
java -splash:lib/about-1x.png -Djna.nosys=true -Xmx512m processing.app.Base "$SKETCH" &
fi