Do not pass non-existing source roots to the compiler
#KT-3679 Fixed Maven build fails when some source directories don't exist
This commit is contained in:
+12
-2
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.config.Services;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -240,7 +241,16 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
|||||||
arguments.verbose = true;
|
arguments.verbose = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> sources = getSources();
|
List<String> sources = new ArrayList<String>();
|
||||||
|
for (String source : getSources()) {
|
||||||
|
if (new File(source).exists()) {
|
||||||
|
sources.add(source);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG.warn("Source root doesn't exist: " + source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sources == null || sources.isEmpty()) {
|
if (sources == null || sources.isEmpty()) {
|
||||||
throw new MojoExecutionException("No source roots to compile");
|
throw new MojoExecutionException("No source roots to compile");
|
||||||
}
|
}
|
||||||
@@ -248,7 +258,7 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
|
|||||||
arguments.suppressWarnings = nowarn;
|
arguments.suppressWarnings = nowarn;
|
||||||
|
|
||||||
arguments.freeArgs.addAll(sources);
|
arguments.freeArgs.addAll(sources);
|
||||||
LOG.info("Compiling Kotlin sources from " + sources );
|
LOG.info("Compiling Kotlin sources from " + sources);
|
||||||
|
|
||||||
configureSpecificCompilerArguments(arguments);
|
configureSpecificCompilerArguments(arguments);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user