Skip to content

Commit e9a3752

Browse files
committed
Merge pull request scala#4113 from retronym/ticket/8967
SI-8967 Only add JARs and dirs from $SCALA_HOME/lib to classpath
2 parents 459538f + 5df64a4 commit e9a3752

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/compiler/scala/tools/ant/templates/tool-unix.tmpl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,14 @@ fi
8686
TOOL_CLASSPATH="@classpath@"
8787
if [[ -z "$TOOL_CLASSPATH" ]]; then
8888
for ext in "$SCALA_HOME"/lib/* ; do
89-
if [[ -z "$TOOL_CLASSPATH" ]]; then
90-
TOOL_CLASSPATH="$ext"
91-
else
92-
TOOL_CLASSPATH="${TOOL_CLASSPATH}${SEP}${ext}"
89+
file_extension="${ext##*.}"
90+
# SI-8967 Only consider directories and files named '*.jar'
91+
if [[ -d "$ext" || $file_extension == "jar" ]]; then
92+
if [[ -z "$TOOL_CLASSPATH" ]]; then
93+
TOOL_CLASSPATH="$ext"
94+
else
95+
TOOL_CLASSPATH="${TOOL_CLASSPATH}${SEP}${ext}"
96+
fi
9397
fi
9498
done
9599
fi

src/compiler/scala/tools/ant/templates/tool-windows.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ if defined _JAVA_PARAMS set _JAVA_OPTS=%_JAVA_OPTS% %_JAVA_PARAMS%
128128

129129
set _TOOL_CLASSPATH=@classpath@
130130
if "%_TOOL_CLASSPATH%"=="" (
131-
for %%f in ("!_SCALA_HOME!\lib\*") do call :add_cpath "%%f"
131+
for %%f in ("!_SCALA_HOME!\lib\*.jar") do call :add_cpath "%%f"
132132
for /d %%f in ("!_SCALA_HOME!\lib\*") do call :add_cpath "%%f"
133133
)
134134

0 commit comments

Comments
 (0)