Skip to content

Commit

Permalink
Use tools.jar from java.home/lib directory (#140)
Browse files Browse the repository at this point in the history
Update STF to use tools.jar from the java.home/lib directory

related:eclipse-openj9/openj9#19888

Signed-off-by: Anna Babu Palathingal <[email protected]>
  • Loading branch information
annaibm authored Nov 18, 2024
1 parent c21e789 commit c859a78
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stf.build/include/top.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ limitations under the License.
<pathelement location="${first_prereqs_root}/log4j/log4j-core.jar"/>
</path>
<path id="tools.class.path">
<pathelement location="${first_prereqs_root}/tools/tools.jar"/>
<pathelement location="${java.home}/../lib/tools.jar"/>
</path>
<path id="asm.class.path">
<pathelement location="${first_prereqs_root}/asm/asm.jar"/>
Expand Down Expand Up @@ -332,9 +332,9 @@ limitations under the License.
-->

<target name="configure-tools-jar" depends="setup-java-properties" unless="${tools_jar_correct}">
<property name="tools_jar_origin" value="${java_bindir}/../lib/tools.jar"/>
<property name="tools_jar_origin" value="${java.home}/../lib/tools.jar"/>
<echo message="configure-tools-jar: Copying ${tools_jar_origin} to ${tools_jar_dir}"/>
<copy file="${tools_jar_origin}" todir="${tools_jar_dir}"/>
<copy file="${tools_jar_origin}" todir="${tools_jar_dir}"/>
<property name="tools_jar" value="${tools_jar_dir}/${tools_jar_file}"/>
<available file="${tools_jar_dir}/${tools_jar_file}" property="tools_jar_correct"/>
</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ public StfEnvironmentCore(ArrayList<PropertyFileDetails> propertyFileDetails, Ar
this.testRoots.add(defaultTestRoot);
invocationProperties.put(Stf.ARG_TEST_ROOT.getName(), defaultTestRoot.getSpec());
}

try {
String javaHome = System.getProperty("java.home");
File javaLibDir = new File(javaHome, "../lib");
if (javaLibDir.exists() && javaLibDir.isDirectory()) {
this.testRoots.add(new DirectoryRef(javaLibDir.getCanonicalPath()));
} else {
System.out.println("Java lib directory does not exist: " + javaLibDir.getCanonicalPath());
}
} catch (IOException e) {
throw new RuntimeException("Failed to add Java lib directory to test roots", e);
}

// Work out where the prereqs are
if (!getProperty(Stf.ARG_SYSTEMTEST_PREREQS).isEmpty()) {
Expand Down

0 comments on commit c859a78

Please sign in to comment.