JPS JS: simplified the code and added tests for the missing meta.js case (e.g. empty sourceroot; fixed by yole in 00ed0248d9a23701dbef52da02259d174a9999e7)
This commit is contained in:
@@ -371,6 +371,11 @@ class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
|||||||
assertEquals(Collections.EMPTY_SET, contentOfOutputDir(PROJECT_NAME))
|
assertEquals(Collections.EMPTY_SET, contentOfOutputDir(PROJECT_NAME))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testKotlinJavaScriptProjectWithEmptyDependencies() {
|
||||||
|
initProject(JS_STDLIB)
|
||||||
|
makeAll().assertSuccessful()
|
||||||
|
}
|
||||||
|
|
||||||
fun testKotlinJavaScriptProjectWithTests() {
|
fun testKotlinJavaScriptProjectWithTests() {
|
||||||
initProject(JS_STDLIB)
|
initProject(JS_STDLIB)
|
||||||
makeAll().assertSuccessful()
|
makeAll().assertSuccessful()
|
||||||
@@ -387,9 +392,8 @@ class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
|||||||
buildResult.assertSuccessful()
|
buildResult.assertSuccessful()
|
||||||
|
|
||||||
val warnings = buildResult.getMessages(BuildMessage.Kind.WARNING)
|
val warnings = buildResult.getMessages(BuildMessage.Kind.WARNING)
|
||||||
assertEquals("Warning about duplicate module definition: $warnings", 2, warnings.size)
|
assertEquals("Warning about duplicate module definition: $warnings", 1, warnings.size)
|
||||||
assertEquals("Module \"srcAndTests\" is defined in more, than one file", warnings[0].messageText)
|
assertEquals("Module \"srcAndTests\" is defined in more, than one file", warnings[0].messageText)
|
||||||
assertEquals("Module \"srcAndTests\" is defined in more, than one file", warnings[1].messageText)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testKotlinJavaScriptProjectWithTwoSrcModuleDependency() {
|
fun testKotlinJavaScriptProjectWithTwoSrcModuleDependency() {
|
||||||
|
|||||||
@@ -50,22 +50,12 @@ object JpsJsModuleUtils {
|
|||||||
override fun consume(module: JpsModule) {
|
override fun consume(module: JpsModule) {
|
||||||
if (module.moduleType != JpsJavaModuleType.INSTANCE) return
|
if (module.moduleType != JpsJavaModuleType.INSTANCE) return
|
||||||
|
|
||||||
var yieldProduction = module != target.module || target.isTests
|
if ((module != target.module || target.isTests) && module.sourceRoots.any { it.rootType == JavaSourceRootType.SOURCE}) {
|
||||||
var yieldTests = module != target.module
|
addTarget(module, JavaModuleBuildTargetType.PRODUCTION)
|
||||||
|
}
|
||||||
|
|
||||||
module.sourceRoots.forEach {
|
if (module != target.module && target.isTests && module.sourceRoots.any { it.rootType == JavaSourceRootType.TEST_SOURCE}) {
|
||||||
if (it.rootType == JavaSourceRootType.SOURCE) {
|
addTarget(module, JavaModuleBuildTargetType.TEST)
|
||||||
if (yieldProduction) {
|
|
||||||
addTarget(module, JavaModuleBuildTargetType.PRODUCTION)
|
|
||||||
yieldProduction = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (yieldTests) {
|
|
||||||
addTarget(module, JavaModuleBuildTargetType.TEST)
|
|
||||||
yieldTests = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
Vendored
+25
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="emptySrc" />
|
||||||
|
<orderEntry type="module" module-name="missingSrc" />
|
||||||
|
<orderEntry type="module" module-name="emptyTests" />
|
||||||
|
<orderEntry type="module" module-name="missingTests" />
|
||||||
|
<orderEntry type="module" module-name="srcEmptyTests" />
|
||||||
|
<orderEntry type="module" module-name="srcMissingTests" />
|
||||||
|
<orderEntry type="module" module-name="testsEmptySrc" />
|
||||||
|
<orderEntry type="module" module-name="testsMissingSrc" />
|
||||||
|
<orderEntry type="module" module-name="emptySrcEmptyTests" />
|
||||||
|
<orderEntry type="module" module-name="emptySrcMissingTests" />
|
||||||
|
<orderEntry type="module" module-name="missingSrcEmptyTests" />
|
||||||
|
<orderEntry type="module" module-name="missingSrcMissingTests" />
|
||||||
|
<orderEntry type="module" module-name="missingModule" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/emptySrc/emptySrc.iml" filepath="$PROJECT_DIR$/emptySrc/emptySrc.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/missingSrc/missingSrc.iml" filepath="$PROJECT_DIR$/missingSrc/missingSrc.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/emptyTests/emptyTests.iml" filepath="$PROJECT_DIR$/emptyTests/emptyTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/missingTests/missingTests.iml" filepath="$PROJECT_DIR$/missingTests/missingTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/srcEmptyTests/srcEmptyTests.iml" filepath="$PROJECT_DIR$/srcEmptyTests/srcEmptyTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/srcMissingTests/srcMissingTests.iml" filepath="$PROJECT_DIR$/srcMissingTests/srcMissingTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/testsEmptySrc/testsEmptySrc.iml" filepath="$PROJECT_DIR$/testsEmptySrc/testsEmptySrc.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/testsMissingSrc/testsMissingSrc.iml" filepath="$PROJECT_DIR$/testsMissingSrc/testsMissingSrc.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/emptySrcEmptyTests/emptySrcEmptyTests.iml" filepath="$PROJECT_DIR$/emptySrcEmptyTests/emptySrcEmptyTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/emptySrcMissingTests/emptySrcMissingTests.iml" filepath="$PROJECT_DIR$/emptySrcMissingTests/emptySrcMissingTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/missingSrcEmptyTests/missingSrcEmptyTests.iml" filepath="$PROJECT_DIR$/missingSrcEmptyTests/missingSrcEmptyTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/missingSrcMissingTests/missingSrcMissingTests.iml" filepath="$PROJECT_DIR$/missingSrcMissingTests/missingSrcMissingTests.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/missingModule/missingModule.iml" filepath="$PROJECT_DIR$/missingModule/missingModule.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/kotlinProject.iml" filepath="$PROJECT_DIR$/kotlinProject.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
fun main() {
|
||||||
|
srcEmptyTestsSrc()
|
||||||
|
srcMissingTestsSrc()
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun srcEmptyTestsSrc() {}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
fun srcMissingTestsSrc() {}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
fun test() {
|
||||||
|
testsEmptySrcTest()
|
||||||
|
testsMissingSrcTest()
|
||||||
|
}
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
fun testsEmptySrcTest() {}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun testsMissingSrcTest() {}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />i
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+4
@@ -1,3 +1,7 @@
|
|||||||
|
import src.*
|
||||||
|
import test.*
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
srcAndTests()
|
srcAndTests()
|
||||||
|
ambiguous()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -1 +1,5 @@
|
|||||||
|
package src
|
||||||
|
|
||||||
fun srcAndTests() {}
|
fun srcAndTests() {}
|
||||||
|
|
||||||
|
fun ambiguous() {}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
private fun dummy() {}
|
||||||
+6
@@ -1,3 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
import src.srcAndTests
|
||||||
|
|
||||||
fun testSrcAndTests() {
|
fun testSrcAndTests() {
|
||||||
srcAndTests()
|
srcAndTests()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun ambiguous() {}
|
||||||
+3
@@ -1,3 +1,6 @@
|
|||||||
|
import src.*
|
||||||
|
import test.*
|
||||||
|
|
||||||
fun testMain() {
|
fun testMain() {
|
||||||
main()
|
main()
|
||||||
srcAndTests()
|
srcAndTests()
|
||||||
|
|||||||
Reference in New Issue
Block a user