Introduce -Xcommon-sources and pass it correctly from build tool plugins
#KT-25196 In Progress
This commit is contained in:
+8
-8
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.jps.build
|
||||
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.util.containers.HashMap
|
||||
import com.intellij.util.containers.StringInterner
|
||||
import org.jetbrains.kotlin.TestWithWorkingDir
|
||||
import org.jetbrains.kotlin.build.JvmSourceRoot
|
||||
@@ -78,13 +77,14 @@ abstract class AbstractJvmLookupTrackerTest : AbstractLookupTrackerTest() {
|
||||
|
||||
override fun runCompiler(filesToCompile: Iterable<File>, env: JpsCompilerEnvironment): Any? {
|
||||
val moduleFile = makeModuleFile(
|
||||
name = "test",
|
||||
isTest = true,
|
||||
outputDir = outDir,
|
||||
sourcesToCompile = filesToCompile.toList(),
|
||||
javaSourceRoots = listOf(JvmSourceRoot(srcDir, null)),
|
||||
classpath = listOf(outDir, ForTestCompileRuntime.runtimeJarForTests()).filter { it.exists() },
|
||||
friendDirs = emptyList()
|
||||
name = "test",
|
||||
isTest = true,
|
||||
outputDir = outDir,
|
||||
sourcesToCompile = filesToCompile.toList(),
|
||||
commonSources = emptyList(),
|
||||
javaSourceRoots = listOf(JvmSourceRoot(srcDir, null)),
|
||||
classpath = listOf(outDir, ForTestCompileRuntime.runtimeJarForTests()).filter { it.exists() },
|
||||
friendDirs = emptyList()
|
||||
)
|
||||
|
||||
val args = K2JVMCompilerArguments().apply {
|
||||
|
||||
@@ -41,16 +41,17 @@ class ClasspathOrderTest : TestCaseWithTmpdir() {
|
||||
|
||||
fun testClasspathOrderForModuleScriptBuild() {
|
||||
val xmlContent = KotlinModuleXmlBuilder().addModule(
|
||||
"name",
|
||||
File(tmpdir, "output").absolutePath,
|
||||
listOf(sourceDir),
|
||||
listOf(JvmSourceRoot(sourceDir)),
|
||||
listOf(PathUtil.kotlinPathsForDistDirectory.stdlibPath),
|
||||
null,
|
||||
JavaModuleBuildTargetType.PRODUCTION.typeId,
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests,
|
||||
setOf(),
|
||||
emptyList()
|
||||
"name",
|
||||
File(tmpdir, "output").absolutePath,
|
||||
listOf(sourceDir),
|
||||
listOf(JvmSourceRoot(sourceDir)),
|
||||
listOf(PathUtil.kotlinPathsForDistDirectory.stdlibPath),
|
||||
emptyList(),
|
||||
null,
|
||||
JavaModuleBuildTargetType.PRODUCTION.typeId,
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests,
|
||||
setOf(),
|
||||
emptyList()
|
||||
).asText().toString()
|
||||
|
||||
val xml = File(tmpdir, "module.xml")
|
||||
|
||||
+5
@@ -33,6 +33,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Arrays.asList(new File("s1"), new File("s2")),
|
||||
Collections.singletonList(new JvmSourceRoot(new File("java"), null)),
|
||||
Arrays.asList(new File("cp1"), new File("cp2")),
|
||||
Collections.emptyList(),
|
||||
null,
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
@@ -49,6 +50,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Arrays.asList(new File("s1"), new File("s2")),
|
||||
Collections.emptyList(),
|
||||
Arrays.asList(new File("cp1"), new File("cp2")),
|
||||
Collections.emptyList(),
|
||||
null,
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
@@ -66,6 +68,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Arrays.asList(new File("s1"), new File("s2")),
|
||||
Collections.emptyList(),
|
||||
Arrays.asList(new File("cp1"), new File("cp2")),
|
||||
Collections.emptyList(),
|
||||
null,
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
@@ -78,6 +81,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Arrays.asList(new File("s12"), new File("s22")),
|
||||
Collections.emptyList(),
|
||||
Arrays.asList(new File("cp12"), new File("cp22")),
|
||||
Collections.emptyList(),
|
||||
null,
|
||||
JavaModuleBuildTargetType.TEST.getTypeId(),
|
||||
JavaModuleBuildTargetType.TEST.isTests(),
|
||||
@@ -95,6 +99,7 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList(),
|
||||
new File("/path/to/modular/jdk"),
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
|
||||
@@ -150,6 +150,7 @@ class KotlinJvmModuleBuildTarget(compileContext: CompileContext, jpsModuleBuildT
|
||||
val friendDirs = target.friendOutputDirs
|
||||
|
||||
val moduleSources = collectSourcesToCompile(target, dirtyFilesHolder)
|
||||
val commonSources = emptyList<File>() // TODO: pass common sources here
|
||||
val hasDirtyOrRemovedSources = checkShouldCompileAndLog(target, dirtyFilesHolder, moduleSources)
|
||||
if (hasDirtyOrRemovedSources) hasDirtySources = true
|
||||
|
||||
@@ -160,6 +161,7 @@ class KotlinJvmModuleBuildTarget(compileContext: CompileContext, jpsModuleBuildT
|
||||
moduleSources,
|
||||
target.findSourceRoots(context),
|
||||
target.findClassPathRoots(),
|
||||
commonSources,
|
||||
target.findModularJdkRoot(),
|
||||
kotlinModuleId.type,
|
||||
isTests,
|
||||
|
||||
Reference in New Issue
Block a user