Skip to content

Commit

Permalink
Remove find-java-rt-jar.sh, document how -b interacts with older JDKs
Browse files Browse the repository at this point in the history
* Remove the use of the `find-java-rt-jar.sh` script in CI, as this is no
  longer necessary with the advent of `--java-bin-dirs`/searching the `PATH`
  for Java. This fixes #1061.

* Now that `find-java-rt-jar.sh` is gone, there is no longer any need for the
  `.github/PropertiesTest.java` utility, nor is there any need for the
  `find_java` bash function that leverages this. This patch remove both of them
  as well.

* On a related note, it turns out that SAW's approach to detecting where
  `rt.jar` lives likely doesn't work on pre-7 JDKs on macOS. Given how
  ancient these versions of Java anymore, let's just document this infelicity
  in the manual and describe a workaround for those brave enough to try this.
  Fixes #1062.
  • Loading branch information
RyanGlScott committed Feb 8, 2021
1 parent 2e2ef89 commit bcfe003
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 43 deletions.
7 changes: 0 additions & 7 deletions .github/PropertiesTest.java

This file was deleted.

11 changes: 0 additions & 11 deletions .github/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ install_system_deps() {
}

test_dist() {
find_java
pushd intTests
for t in test0019_jss_switch_statement test_crucible_jvm test_ecdsa test_issue108 test_tutorial1 test_tutorial2 test_tutorial_w4; do echo $t >> disabled_tests.txt; done
env
Expand Down Expand Up @@ -196,16 +195,6 @@ bundle_files() {
cp -r examples/* dist/examples
}

find_java() {
pushd .github
javac PropertiesTest.java
RT_JAR="$(java PropertiesTest | tr : '\n' | grep rt.jar | head -n 1)"
export RT_JAR
echo "RT_JAR=$RT_JAR" >> "$GITHUB_ENV"
rm PropertiesTest.class
popd
}

sign() {
gpg --batch --import <(echo "$SIGNING_KEY")
fingerprint="$(gpg --list-keys | grep galois -a1 | head -n1 | awk '{$1=$1};1')"
Expand Down
10 changes: 8 additions & 2 deletions doc/manual/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -1557,8 +1557,14 @@ control where to look for classes:
files found in that directory (and its subdirectories) to the class database.
By default, the current directory is included in the class path.

Most Java programs will only require setting the `-b` flag, as that is enough
to bring in the standard Java libraries.
Most Java programs will only require setting the `-b` flag (or the `PATH`), as
that is enough to bring in the standard Java libraries. Note that when
searching the `PATH`, SAW makes assumptions about where the standard library
classes live. These assumptions are likely to hold on JDK 7 or later, but they
may not hold on older JDKs on certain operating systems. If you are using an
old version of the JDK and SAW is unable to find a standard Java class, you may
need to specify the location of the standard classes' JAR file with the `-j`
flag (or, alternatively, with the `SAW_JDK_JAR` environment variable).

Once the class path is configured, you can pass the name of a class to
the `java_load_class` function.
Expand Down
12 changes: 6 additions & 6 deletions intTests/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ fi

# Build the class path. On Windows, Java requires Windows-style paths
# here, even in Cygwin.
#
# Locate rt.jar. This is already a Windows path on windows, so no need
# to 'cygpath' it.
JDK=$(support/find-java-rt-jar.sh)
CP="$JDK"
CP=""
# Add our bundled .jars to the class path.
for i in "$TESTBASE"/jars/*.jar; do
if [ "$OS" == "Windows_NT" ]; then
i=$(cygpath -w "$i")
fi
CP=$CP$CPSEP$i
if [ -z "$CP" ]; then
CP=$i
else
CP=$CP$CPSEP$i
fi
done
export CP

Expand Down
17 changes: 0 additions & 17 deletions intTests/support/find-java-rt-jar.sh

This file was deleted.

0 comments on commit bcfe003

Please sign in to comment.