[JS IR BE] Support JS IR in maven plugin
This commit is contained in:
@@ -78,6 +78,7 @@ object LibraryUtils {
|
|||||||
return manifestFound && irFound
|
return manifestFound && irFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun isKotlinJavascriptIrLibrary(candidate: File): Boolean {
|
fun isKotlinJavascriptIrLibrary(candidate: File): Boolean {
|
||||||
return when {
|
return when {
|
||||||
FileUtil.isJarOrZip(candidate) -> isZippedKlib(candidate)
|
FileUtil.isJarOrZip(candidate) -> isZippedKlib(candidate)
|
||||||
|
|||||||
+12
-2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.maven;
|
package org.jetbrains.kotlin.maven;
|
||||||
|
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
|
import kotlin.collections.CollectionsKt;
|
||||||
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
@@ -94,6 +95,9 @@ public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArgument
|
|||||||
@Parameter(defaultValue = "plain")
|
@Parameter(defaultValue = "plain")
|
||||||
private String moduleKind;
|
private String moduleKind;
|
||||||
|
|
||||||
|
@Parameter(defaultValue = "false")
|
||||||
|
private boolean useIrBackend;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureSpecificCompilerArguments(@NotNull K2JSCompilerArguments arguments, @NotNull List<File> sourceRoots) throws MojoExecutionException {
|
protected void configureSpecificCompilerArguments(@NotNull K2JSCompilerArguments arguments, @NotNull List<File> sourceRoots) throws MojoExecutionException {
|
||||||
arguments.setOutputFile(outputFile);
|
arguments.setOutputFile(outputFile);
|
||||||
@@ -101,6 +105,8 @@ public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArgument
|
|||||||
arguments.setMetaInfo(metaInfo);
|
arguments.setMetaInfo(metaInfo);
|
||||||
arguments.setModuleKind(moduleKind);
|
arguments.setModuleKind(moduleKind);
|
||||||
arguments.setMain(main);
|
arguments.setMain(main);
|
||||||
|
arguments.setIrBackend(useIrBackend);
|
||||||
|
arguments.setIrLegacyGradlePluginCompatibility(true);
|
||||||
|
|
||||||
List<String> libraries;
|
List<String> libraries;
|
||||||
try {
|
try {
|
||||||
@@ -138,6 +144,10 @@ public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArgument
|
|||||||
return project.getCompileClasspathElements();
|
return project.getCompileClasspathElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkIsKotlinJavascriptLibrary(File file) {
|
||||||
|
return useIrBackend ? LibraryUtils.isKotlinJavascriptIrLibrary(file) : LibraryUtils.isKotlinJavascriptLibrary(file);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all Kotlin Javascript dependencies that this project has, including transitive ones.
|
* Returns all Kotlin Javascript dependencies that this project has, including transitive ones.
|
||||||
*
|
*
|
||||||
@@ -150,7 +160,7 @@ public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArgument
|
|||||||
for (String path : getClassPathElements()) {
|
for (String path : getClassPathElements()) {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
|
|
||||||
if (file.exists() && LibraryUtils.isKotlinJavascriptLibrary(file)) {
|
if (file.exists() && checkIsKotlinJavascriptLibrary(file)) {
|
||||||
libraries.add(file.getAbsolutePath());
|
libraries.add(file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -162,7 +172,7 @@ public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArgument
|
|||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
|
|
||||||
if (file.exists() && LibraryUtils.isKotlinJavascriptLibrary(file)) {
|
if (file.exists() && checkIsKotlinJavascriptLibrary(file)) {
|
||||||
libraries.add(file.getAbsolutePath());
|
libraries.add(file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user