Skip to content

Commit

Permalink
Move to Gradle 8.11
Browse files Browse the repository at this point in the history
The latest version of Gradle allows compiles on ARM64 (aarch64) to work.
This means one can build PJRmi natively on Raspbian. Also fix a couple
of issues spotted along the way.

Finally, move to a new subminor version, since we made enough changes
lately to warrant it.
  • Loading branch information
iamsrp-deshaw committed Nov 14, 2024
1 parent 678a23b commit 582d683
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ binpath=
// string in the code. The minor value will be bumped for changes in the wire
// format or major feature additions. The subminor version is typically bumped
// for non-breaking changes, like bugfixes or minor enhancements.
pjrmiVersion=1.13.11
pjrmiVersion=1.13.12
snappyVersion=1.1.0.1
// Have a decent heap for the daemon
org.gradle.jvmargs=-Xmx4g
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
44 changes: 31 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +82,12 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${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='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +134,29 @@ 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.
if ! command -v java >/dev/null 2>&1
then
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
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +201,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
4 changes: 3 additions & 1 deletion java/src/main/java/com/deshaw/pjrmi/PJRmi.java
Original file line number Diff line number Diff line change
Expand Up @@ -6286,7 +6286,7 @@ else if (valueFormat == PythonValueFormat.PYTHON_REFERENCE) {

default:
throw new IllegalArgumentException(
"Unhandled return format" + valueFormat
"Unhandled return format " + valueFormat
);
}
}
Expand Down Expand Up @@ -9109,7 +9109,9 @@ protected byte[] initialValue()
"java.lang.IndexOutOfBoundsException",
"java.lang.Integer",
"java.lang.Iterable",
"java.lang.LinkageError",
"java.lang.Long",
"java.lang.NoClassDefFoundError",
"java.lang.NoSuchFieldException",
"java.lang.NoSuchMethodException",
"java.lang.Number",
Expand Down
15 changes: 12 additions & 3 deletions python/tests/pjrmi_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ def get_pjrmi():

# Connect to PJRmi
_pjrmi_connection = pjrmi.connect_to_child_jvm(
# We need around least 3Gb of heap for these tests but we give it a bit
# of headroom just in case. Some systems with a smaller memory footprint
# will have a smaller default heap size. It's safe to set the maximum
# value to higher number than the available memory, since the JVM will
# only allocate what it needs to.
java_args=("-Xmx4g",),
# Turning class blocking on but allowing class injection does reduce
# the fidelity of these tests compared to production but it's at least
# better than not having class blocking.
Expand Down Expand Up @@ -759,10 +765,13 @@ def _kill_alive_process(pid):
except IOError:
child_python_pid, java_pid = (None, None)

# Now if we have found the file, we will wait for 1 second to let the
# processes cleanup.
# Now if we have found the file, we will wait for a bit to let the
# processes cleanup. This is a little racy in nature since the child can
# take longer to die on some systems so we try to do it vaguely nicely.
if child_python_pid:
time.sleep(1)
for i in range(50):
if _kill_alive_process(child_python_pid):
time.sleep(0.1)

# Need to poll the parent process, so that it gets cleared from defunct
# state, if it has exited.
Expand Down

0 comments on commit 582d683

Please sign in to comment.