Don't fail when output directory not specified for "friend" build target

#KT-10505 Fixed

Original commit: d9af9472f0
This commit is contained in:
Zalim Bashorov
2016-01-12 23:32:46 +03:00
parent b87baebf1f
commit b7971cf9ae
5 changed files with 37 additions and 2 deletions
@@ -115,12 +115,12 @@ public class KotlinBuilderModuleScriptGenerator {
} }
@Nullable @Nullable
public static File getFriendDirSafe(@NotNull ModuleBuildTarget target) throws ProjectBuildException { private static File getFriendDirSafe(@NotNull ModuleBuildTarget target) throws ProjectBuildException {
if (!target.isTests()) return null; if (!target.isTests()) return null;
File outputDirForProduction = JpsJavaExtensionService.getInstance().getOutputDirectory(target.getModule(), false); File outputDirForProduction = JpsJavaExtensionService.getInstance().getOutputDirectory(target.getModule(), false);
if (outputDirForProduction == null) { if (outputDirForProduction == null) {
throw new ProjectBuildException("No output production directory found for " + target); return null;
} }
return outputDirForProduction; return outputDirForProduction;
} }
@@ -728,6 +728,10 @@ class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
doTest() doTest()
} }
fun testKotlinProjectWithEmptyProductionOutputDirWithoutSrcDir() {
doTest()
}
private fun BuildResult.checkErrors() { private fun BuildResult.checkErrors() {
val actualErrors = getMessages(BuildMessage.Kind.ERROR) val actualErrors = getMessages(BuildMessage.Kind.ERROR)
.map { it as CompilerMessage } .map { it as CompilerMessage }
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output-test url="file://$MODULE_DIR$/out/test/kotlinProject" />
<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="jdk" jdkName="IDEA_JDK" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="kotlinProject" />
</component>
</module>
@@ -0,0 +1,14 @@
<?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$/kotlinProject.iml" filepath="$PROJECT_DIR$/kotlinProject.iml" />
</modules>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA_JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>