Set destination to null when module is set in JPS
This fixes the warning "The '-d' option with a directory destination
is ignored because '-module' is specified", when a project imported
from Gradle is built with JPS.
#KT-17665 fixed
Original commit: b06b18de07
This commit is contained in:
@@ -915,6 +915,20 @@ class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
|||||||
buildAllModules().assertSuccessful()
|
buildAllModules().assertSuccessful()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testCustomDestination() {
|
||||||
|
loadProject(workDir.absolutePath + File.separator + PROJECT_NAME + ".ipr")
|
||||||
|
addKotlinRuntimeDependency()
|
||||||
|
buildAllModules().apply {
|
||||||
|
assertSuccessful()
|
||||||
|
|
||||||
|
val aClass = File(workDir, "customOut/A.class")
|
||||||
|
assert(aClass.exists()) { "$aClass does not exist!" }
|
||||||
|
|
||||||
|
val warnings = getMessages(BuildMessage.Kind.WARNING)
|
||||||
|
assert(warnings.isEmpty()) { "Unexpected warnings: \n${warnings.joinToString("\n")}" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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 }
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner<JpsCompilerEnvironment>() {
|
|||||||
private fun setupK2JvmArguments(moduleFile: File, settings: K2JVMCompilerArguments) {
|
private fun setupK2JvmArguments(moduleFile: File, settings: K2JVMCompilerArguments) {
|
||||||
with(settings) {
|
with(settings) {
|
||||||
module = moduleFile.absolutePath
|
module = moduleFile.absolutePath
|
||||||
|
destination = null
|
||||||
noStdlib = true
|
noStdlib = true
|
||||||
noReflect = true
|
noReflect = true
|
||||||
noJdk = true
|
noJdk = true
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="kotlin-language" name="Kotlin">
|
||||||
|
<configuration version="3" platform="JVM 1.8" useProjectSettings="false">
|
||||||
|
<compilerSettings />
|
||||||
|
<compilerArguments>
|
||||||
|
<option name="destination" value="$MODULE_DIR$/customOut/" />
|
||||||
|
</compilerArguments>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<output url="$MODULE_DIR$/customOut/"/>
|
||||||
|
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</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>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class A
|
||||||
Reference in New Issue
Block a user