CLI: use JDK 1.6 to compile the "kotlin" launcher script

"kotlin" is used to run programs compiled by "kotlinc" which supports
emitting JVM bytecode 1.6, so it should also be runnable on JDK 1.6
This commit is contained in:
Alexander Udalov
2017-06-01 00:36:19 +03:00
parent 96bd8cb3c2
commit c851e9d206
3 changed files with 10 additions and 5 deletions
+3 -2
View File
@@ -26,7 +26,6 @@
<property name="tools.jar" value="${env.JDK_18}/lib/tools.jar"/> <property name="tools.jar" value="${env.JDK_18}/lib/tools.jar"/>
<property name="java.target" value="1.8"/> <property name="java.target" value="1.8"/>
<property name="java.target.1.6" value="1.6"/>
<condition property="bootstrap.or.local.build" value="true" else="false"> <condition property="bootstrap.or.local.build" value="true" else="false">
<or> <or>
@@ -306,6 +305,8 @@
<cleandir dir="${output}/classes/runner"/> <cleandir dir="${output}/classes/runner"/>
<kotlinc output="${output}/classes/runner"> <kotlinc output="${output}/classes/runner">
<src location="${basedir}/compiler/cli/cli-runner/src"/> <src location="${basedir}/compiler/cli/cli-runner/src"/>
<compilerarg line="-jvm-target 1.6"/>
<compilerarg line="-jdk-home ${env.JDK_16}"/>
</kotlinc> </kotlinc>
<local name="runtime.jar"/> <local name="runtime.jar"/>
@@ -863,7 +864,7 @@
</java> </java>
<javac2 srcdir="${toString:src.dirset}" destdir="@{output}" debug="true" debuglevel="lines,vars,source" <javac2 srcdir="${toString:src.dirset}" destdir="@{output}" debug="true" debuglevel="lines,vars,source"
includeAntRuntime="false" source="${java.target.1.6}" target="${java.target.1.6}"> includeAntRuntime="false" source="1.6" target="1.6">
<skip pattern="kotlin/Metadata"/> <skip pattern="kotlin/Metadata"/>
<classpath> <classpath>
<path refid="classpath.path"/> <path refid="classpath.path"/>
+2 -2
View File
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4"> <module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-runtime" level="project" /> <orderEntry type="library" name="kotlin-runtime" level="project" />
</component> </component>
@@ -77,9 +77,13 @@ class MainClassRunner(override val className: String) : AbstractRunner() {
class JarRunner(private val path: String) : AbstractRunner() { class JarRunner(private val path: String) : AbstractRunner() {
override val className: String = override val className: String =
try { try {
JarFile(path).use { jar -> val jar = JarFile(path)
try {
jar.manifest.mainAttributes.getValue(Attributes.Name.MAIN_CLASS) jar.manifest.mainAttributes.getValue(Attributes.Name.MAIN_CLASS)
} }
finally {
jar.close()
}
} }
catch (e: IOException) { catch (e: IOException) {
throw RunnerException("could not read manifest from " + path + ": " + e.message) throw RunnerException("could not read manifest from " + path + ": " + e.message)