binary distribution for Kotlin

This commit is contained in:
Dmitry Jemerov
2011-10-17 18:01:02 +02:00
parent 5a1bca0615
commit 3083fde2dd
4 changed files with 219 additions and 0 deletions
Generated
+8
View File
@@ -26,6 +26,14 @@
<maximumStackSize value="2" />
<properties />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/build.xml">
<additionalClassPath />
<antReference projectDefault="true" />
<customJdkName value="" />
<maximumHeapSize value="128" />
<maximumStackSize value="2" />
<properties />
</buildFile>
</component>
</project>
+64
View File
@@ -0,0 +1,64 @@
<project name="Kotlin" default="dist">
<property name="output" value="${basedir}/dist"/>
<property name="build.number" value="snapshot"/>
<path id="classpath">
<fileset dir="${basedir}/ideaSDK" includes="*.jar"/>
<fileset dir="${basedir}/lib" includes="*.jar"/>
<pathelement path="${output}/classes/runtime"/>
</path>
<path id="sourcepath">
<dirset dir="${basedir}/compiler">
<include name="frontend/src"/>
<include name="frontend.java/src"/>
<include name="backend/src"/>
<include name="cli/src"/>
</dirset>
</path>
<target name="compileRT">
<mkdir dir="${output}/classes/runtime"/>
<javac destdir="${output}/classes/runtime">
<src path="${basedir}/stdlib/src"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="jarRT" depends="compileRT">
<jar destfile="${output}/kotlin-runtime.jar">
<fileset dir="${output}/classes/runtime"/>
</jar>
</target>
<target name="compile" depends="compileRT">
<mkdir dir="${output}/classes/compiler"/>
<javac destdir="${output}/classes/compiler">
<src refid="sourcepath"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="jar">
<jar destfile="${output}/kotlin-compiler.jar">
<fileset dir="${output}/classes/compiler"/>
</jar>
</target>
<target name="dist" depends="jarRT,jar">
<zip destfile="${output}/kotlin-${build.number}.zip">
<zipfileset prefix="kotlin-${build.number}/bin" filemode="755">
<include name="${basedir}/compile/cli/bin/*"/>
</zipfileset>
<zipfileset prefix="kotlin-${build.number}/examples" includes="examples/src/**"/>
<zipfileset prefix="kotlin-${build.number}/lib">
<include name="ideaSDK/*.jar"/>
<include name="lib/*.jar"/>
<include name="${output}/*.jar"/>
</zipfileset>
<zipfileset prefix="kotlin-${build.number}/examples" includes="examples/src/**"/>
</zip>
</target>
</project>
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash --posix
#
##############################################################################
# Copyright 2002-2011, LAMP/EPFL
# Copyright 2011, JetBrains
#
# This is free software; see the distribution for copying conditions.
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
##############################################################################
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
# Finding the root folder for this Kotlin distribution
SOURCE=$0;
SCRIPT=`basename "$SOURCE"`;
while [ -h "$SOURCE" ]; do
SCRIPT=`basename "$SOURCE"`;
LOOKUP=`ls -ld "$SOURCE"`;
TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`;
if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then
SOURCE=${TARGET:-.};
else
SOURCE=`dirname "$SOURCE"`/${TARGET:-.};
fi;
done;
# see #2092
KOTLIN_HOME=`dirname "$SOURCE"`
KOTLIN_HOME=`cd "$KOTLIN_HOME"; pwd -P`
KOTLIN_HOME=`cd "$KOTLIN_HOME"/..; pwd`
# Remove spaces from KOTLIN_HOME on windows
if $cygwin; then
KOTLIN_HOME=`cygpath --windows --short-name "$KOTLIN_HOME"`
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
# so they reach the underlying JVM in time to do some good. The
# -D options will be available as system properties.
declare -a java_args
declare -a kotlin_args
while [ $# -gt 0 ]; do
case "$1" in
-D*)
# pass to kotlin as well: otherwise we lose it sometimes when we
# need it, e.g. communicating with a server compiler.
java_args=("${java_args[@]}" "$1")
kotlin_args=("${kotlin_args[@]}" "$1")
shift
;;
-J*)
# as with -D, pass to scala even though it will almost
# never be used.
java_args=("${java_args[@]}" "${1:2}")
kotlin_args=("${kotlin_args[@]}" "$1")
shift
;;
*)
kotlin_args=("${kotlin_args[@]}" "$1")
shift
;;
esac
done
# reset "$@" to the remaining args
set -- "${kotlin_args[@]}"
if [ -z "$JAVACMD" -a -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
JAVACMD="$JAVA_HOME/bin/java"
fi
"${JAVACMD:=java}" \
$JAVA_OPTS \
"${java_args[@]}" \
${CPSELECT}${TOOL_CLASSPATH} \
org.jetbrains.jet.cli.KotlinCompiler "$@"
+51
View File
@@ -0,0 +1,51 @@
rem based on scalac.bat from the Scala distribution
rem ##########################################################################
rem # Copyright 2002-2011, LAMP/EPFL
rem # Copyright 2011, JetBrains
rem #
rem # This is free software; see the distribution for copying conditions.
rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
rem # PARTICULAR PURPOSE.
rem ##########################################################################
@echo off
@setlocal
call :set_home
if not "%JAVA_HOME%"=="" (
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
)
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.KotlinCompiler %*
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
set _KOTLIN_HOME=%_BIN_DIR%..
goto :eof
:end
@endlocal