Skip to content

Commit

Permalink
Updated the tools.jar location to be taken from the SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
annaibm committed Oct 9, 2024
1 parent c21e789 commit 4c4bf27
Show file tree
Hide file tree
Showing 2 changed files with 12 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 @@ -15,6 +15,7 @@
package net.adoptopenjdk.stf.environment;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -149,6 +150,14 @@ public static DirectoryRef findFileRoot(String fileRef, ArrayList<DirectoryRef>
* @throws StfException In case we cannot find the file, or if we found it in more than one test root.
*/
public static FileRef findFile(String fileRef, ArrayList<DirectoryRef> testRootRefs, String... errorPrefixes) throws StfException {
// Get the value of JAVA_HOME and construct the path to ../lib
try {
String javaHome = System.getProperty("java.home");
File javaLibDir = new File(javaHome, "../lib");
testRootRefs.add(new DirectoryRef(javaLibDir.getCanonicalPath()));
} catch (IOException e) {
throw new RuntimeException("Failed to add Java lib directory to test roots", e);
}
ArrayList<DirectoryRef> matchingTestRoots = new ArrayList<DirectoryRef>();
for (DirectoryRef oneTestRoot : testRootRefs) {
if (oneTestRoot.childFile(fileRef).exists()) {
Expand Down

0 comments on commit 4c4bf27

Please sign in to comment.