From e98c929be69264008e5d7a2c4319dfe4dd2f7585 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 22 Jan 2015 16:40:01 +0300 Subject: [PATCH] Modules.xml: add Java sources right after Kotlin sources Java sources should appear before classpath dependencies because they should have higher priority if the same symbol is located in the module source and in the classpath. This is so because by default module source has the highest priority in IDEA except the JDK. Ideally this will be handled later by full support of modules in the compiler Original commit: fa2116040e9673f1807dbfa0052c37a9245d4d90 --- .../jps/build/KotlinBuilderModuleScriptGenerator.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.java b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.java index 1da65710ab5..46b8b5828f5 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.java +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.java @@ -89,8 +89,9 @@ public class KotlinBuilderModuleScriptGenerator { builder.addModule( target.getId(), outputDir.getAbsolutePath(), - getKotlinModuleDependencies(context, target), + getKotlinModuleDependencies(target), moduleSources, + findSourceRoots(context, target), target.isTests(), // this excludes the output directories from the class path, to be removed for true incremental compilation outputDirs @@ -115,12 +116,11 @@ public class KotlinBuilderModuleScriptGenerator { return outputDir; } - private static DependencyProvider getKotlinModuleDependencies(final CompileContext context, final ModuleBuildTarget target) { + private static DependencyProvider getKotlinModuleDependencies(final ModuleBuildTarget target) { return new DependencyProvider() { @Override public void processClassPath(@NotNull DependencyProcessor processor) { processor.processClassPathSection("Classpath", findClassPathRoots(target)); - processor.processClassPathSection("Java Source Roots", findSourceRoots(context, target)); processor.processAnnotationRoots(findAnnotationRoots(target)); } }; @@ -132,9 +132,9 @@ public class KotlinBuilderModuleScriptGenerator { } @NotNull - private static Collection findSourceRoots(@NotNull CompileContext context, @NotNull ModuleBuildTarget target) { + private static List findSourceRoots(@NotNull CompileContext context, @NotNull ModuleBuildTarget target) { List roots = context.getProjectDescriptor().getBuildRootIndex().getTargetRoots(target, context); - Collection result = ContainerUtil.newArrayList(); + List result = ContainerUtil.newArrayList(); for (JavaSourceRootDescriptor root : roots) { File file = root.getRootFile(); if (file.exists()) {