maven plugin: cleanup
This commit is contained in:
+1
@@ -24,6 +24,7 @@ import org.jetbrains.jet.cli.CompilerArguments;
|
|||||||
*
|
*
|
||||||
* @goal js
|
* @goal js
|
||||||
* @phase compile
|
* @phase compile
|
||||||
|
* @noinspection UnusedDeclaration
|
||||||
*/
|
*/
|
||||||
public class K2JSCompilerMojo extends KotlinCompileMojo {
|
public class K2JSCompilerMojo extends KotlinCompileMojo {
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-9
@@ -36,7 +36,6 @@ import java.util.List;
|
|||||||
* Compiles Kotlin code to JavaScript
|
* Compiles Kotlin code to JavaScript
|
||||||
*/
|
*/
|
||||||
public class K2JSCompilerPlugin implements CompilerPlugin {
|
public class K2JSCompilerPlugin implements CompilerPlugin {
|
||||||
|
|
||||||
private String outFile = "target/js/program.js";
|
private String outFile = "target/js/program.js";
|
||||||
|
|
||||||
public void processFiles(CompilerPluginContext context) {
|
public void processFiles(CompilerPluginContext context) {
|
||||||
@@ -56,12 +55,11 @@ public class K2JSCompilerPlugin implements CompilerPlugin {
|
|||||||
|
|
||||||
K2JSTranslator translator = new K2JSTranslator(config);
|
K2JSTranslator translator = new K2JSTranslator(config);
|
||||||
final String code = translator.generateProgramCode(sources);
|
final String code = translator.generateProgramCode(sources);
|
||||||
|
|
||||||
File file = new File(outFile);
|
File file = new File(outFile);
|
||||||
File outDir = file.getParentFile();
|
|
||||||
if (outDir != null && !outDir.exists()) {
|
|
||||||
outDir.mkdirs();
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
Files.createParentDirs(file);
|
||||||
Files.write(code, file, Charset.forName("UTF-8"));
|
Files.write(code, file, Charset.forName("UTF-8"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -70,10 +68,6 @@ public class K2JSCompilerPlugin implements CompilerPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOutFile() {
|
|
||||||
return outFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutFile(String outFile) {
|
public void setOutFile(String outFile) {
|
||||||
this.outFile = outFile;
|
this.outFile = outFile;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -25,6 +25,7 @@ import org.jetbrains.jet.cli.CompilerArguments;
|
|||||||
* @goal compile
|
* @goal compile
|
||||||
* @phase compile
|
* @phase compile
|
||||||
* @requiresDependencyResolution compile
|
* @requiresDependencyResolution compile
|
||||||
|
* @noinspection UnusedDeclaration
|
||||||
*/
|
*/
|
||||||
public class KotlinCompileMojo extends KotlinCompileMojoBase {
|
public class KotlinCompileMojo extends KotlinCompileMojoBase {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
@@ -26,6 +26,7 @@ import org.jetbrains.jet.cli.CompilerArguments;
|
|||||||
* @goal test-compile
|
* @goal test-compile
|
||||||
* @phase test-compile
|
* @phase test-compile
|
||||||
* @requiresDependencyResolution test
|
* @requiresDependencyResolution test
|
||||||
|
* @noinspection UnusedDeclaration
|
||||||
*/
|
*/
|
||||||
public class KotlinTestCompileMojo extends KotlinCompileMojoBase {
|
public class KotlinTestCompileMojo extends KotlinCompileMojoBase {
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user