reworked kotlin compiler dist
This commit is contained in:
@@ -39,18 +39,6 @@ if $cygwin; then
|
||||
KOTLIN_HOME=`cygpath --unix "$KOTLIN_HOME"`
|
||||
fi
|
||||
|
||||
# Constructing the extension classpath
|
||||
TOOL_CLASSPATH=""
|
||||
if [ -z "$TOOL_CLASSPATH" ] ; then
|
||||
for ext in "$KOTLIN_HOME"/lib/* ; do
|
||||
if [ -z "$TOOL_CLASSPATH" ] ; then
|
||||
TOOL_CLASSPATH="$ext"
|
||||
else
|
||||
TOOL_CLASSPATH="$TOOL_CLASSPATH:$ext"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"
|
||||
|
||||
# break out -D and -J options and add them to JAVA_OPTS as well
|
||||
@@ -69,7 +57,7 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
;;
|
||||
-J*)
|
||||
# as with -D, pass to scala even though it will almost
|
||||
# as with -D, pass to kotlin even though it will almost
|
||||
# never be used.
|
||||
java_args=("${java_args[@]}" "${1:2}")
|
||||
kotlin_args=("${kotlin_args[@]}" "$1")
|
||||
@@ -94,5 +82,5 @@ CPSELECT="-cp "
|
||||
"${JAVACMD:=java}" \
|
||||
$JAVA_OPTS \
|
||||
"${java_args[@]}" \
|
||||
${CPSELECT}${TOOL_CLASSPATH} \
|
||||
${CPSELECT}${KOTLIN_HOME}"/lib/kotlin-compiler.jar" \
|
||||
org.jetbrains.jet.cli.jvm.K2JVMCompiler "$@"
|
||||
@@ -21,26 +21,12 @@ if "%_JAVACMD%"=="" set _JAVACMD=java
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined
|
||||
set _JAVA_OPTS=-Xmx256M -Xms32M
|
||||
|
||||
set _TOOL_CLASSPATH=
|
||||
if "%_TOOL_CLASSPATH%"=="" (
|
||||
for %%f in ("%_KOTLIN_HOME%\lib\*") do call :add_cpath "%%f"
|
||||
for /d %%f in ("%_KOTLIN_HOME%\lib\*") do call :add_cpath "%%f"
|
||||
)
|
||||
|
||||
"%_JAVACMD%" %_JAVA_OPTS% -cp "%_TOOL_CLASSPATH%" org.jetbrains.jet.cli.jvm.K2JVMCompiler %*
|
||||
"%_JAVACMD%" %_JAVA_OPTS% -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar" org.jetbrains.jet.cli.jvm.K2JVMCompiler %*
|
||||
goto end
|
||||
|
||||
rem ##########################################################################
|
||||
rem # subroutines
|
||||
|
||||
:add_cpath
|
||||
if "%_TOOL_CLASSPATH%"=="" (
|
||||
set _TOOL_CLASSPATH=%~1
|
||||
) else (
|
||||
set _TOOL_CLASSPATH=%_TOOL_CLASSPATH%;%~1
|
||||
)
|
||||
goto :eof
|
||||
|
||||
:set_home
|
||||
set _BIN_DIR=
|
||||
for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi
|
||||
@@ -29,12 +29,11 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import org.junit.ComparisonFailure;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.rules.TestWatcher;
|
||||
import org.junit.runner.Description;
|
||||
import sun.misc.JarFilter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -74,13 +73,7 @@ public abstract class KotlinIntegrationTestBase {
|
||||
protected int runCompiler(String logName, String... arguments) throws Exception {
|
||||
final File lib = getCompilerLib();
|
||||
|
||||
final File[] jars = lib.listFiles(new JarFilter());
|
||||
final String classpath = StringUtil.join(jars, new Function<File, String>() {
|
||||
@Override
|
||||
public String fun(File file) {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
}, File.pathSeparator);
|
||||
final String classpath = lib.getAbsolutePath() + File.separator + "kotlin-compiler.jar";
|
||||
|
||||
Collection<String> javaArgs = new ArrayList<String>();
|
||||
javaArgs.add("-cp");
|
||||
@@ -122,10 +115,12 @@ public abstract class KotlinIntegrationTestBase {
|
||||
final String goldContent = Files.toString(expectedFile, UTF_8);
|
||||
try {
|
||||
assertEquals(goldContent, content.toString());
|
||||
}
|
||||
finally {
|
||||
tmpFile.delete();
|
||||
}
|
||||
catch (ComparisonFailure e) {
|
||||
Files.write(content, tmpFile, Charsets.UTF_8);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user