CompilerAdapter for <javac> task + test for compiler attribute

No test for the typedef <withKotlin/> because Ant 1.7 doesn't seem to support typedef inside <javac>
This commit is contained in:
Andrey Breslav
2013-10-08 17:15:30 +04:00
parent bf49bc0220
commit a985882baf
8 changed files with 116 additions and 8 deletions
@@ -0,0 +1,42 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.buildtools.ant;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Javac;
import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
import org.apache.tools.ant.taskdefs.compilers.Javac13;
public class KotlinCompilerAdapter extends DefaultCompilerAdapter {
@Override
public boolean execute() throws BuildException {
Javac javac = getJavac();
BytecodeCompilerTask kotlinTask = new BytecodeCompilerTask();
kotlinTask.setOutput(javac.getDestdir());
kotlinTask.setClasspath(javac.getClasspath());
kotlinTask.setSrc(javac.getSrcdir());
kotlinTask.execute();
javac.log("Running javac...");
Javac13 javac13 = new Javac13();
javac13.setJavac(javac);
return javac13.execute();
}
}
@@ -9,4 +9,7 @@
<taskdef
name = "kotlinJSc"
classname = "org.jetbrains.jet.buildtools.ant.JavaScriptCompilerTask"/>
<typedef
name = "withKotlin"
classname = "org.jetbrains.jet.buildtools.ant.KotlinCompilerAdapter"/>
</antlib>