jps: support dev kit module types (and all other ModuleBasedBuildTargetType)
#KT-24500 fixed
Original commit: ec5110e1f4
This commit is contained in:
@@ -27,6 +27,7 @@ dependencies {
|
|||||||
testCompile(projectTests(":kotlin-build-common"))
|
testCompile(projectTests(":kotlin-build-common"))
|
||||||
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||||
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "platform-api", "log4j") }
|
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "platform-api", "log4j") }
|
||||||
|
testCompile(intellijDep("devkit"))
|
||||||
testCompile(intellijDep("jps-build-test"))
|
testCompile(intellijDep("jps-build-test"))
|
||||||
compilerModules.forEach {
|
compilerModules.forEach {
|
||||||
testRuntime(project(it))
|
testRuntime(project(it))
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ dependencies {
|
|||||||
testCompile(projectTests(":kotlin-build-common"))
|
testCompile(projectTests(":kotlin-build-common"))
|
||||||
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||||
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "log4j") }
|
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "log4j") }
|
||||||
|
testCompile(intellijDep("devkit"))
|
||||||
testCompile(intellijDep("jps-build-test"))
|
testCompile(intellijDep("jps-build-test"))
|
||||||
compilerModules.forEach {
|
compilerModules.forEach {
|
||||||
testRuntime(project(it))
|
testRuntime(project(it))
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ dependencies {
|
|||||||
testCompile(projectTests(":kotlin-build-common"))
|
testCompile(projectTests(":kotlin-build-common"))
|
||||||
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||||
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "log4j") }
|
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "log4j") }
|
||||||
|
testCompile(intellijDep("devkit"))
|
||||||
testCompile(intellijDep("jps-build-test"))
|
testCompile(intellijDep("jps-build-test"))
|
||||||
compilerModules.forEach {
|
compilerModules.forEach {
|
||||||
testRuntime(project(it))
|
testRuntime(project(it))
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ dependencies {
|
|||||||
testCompile(projectTests(":kotlin-build-common"))
|
testCompile(projectTests(":kotlin-build-common"))
|
||||||
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||||
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "platform-api", "log4j") }
|
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "platform-api", "log4j") }
|
||||||
|
testCompile(intellijDep("devkit"))
|
||||||
testCompile(intellijDep("jps-build-test"))
|
testCompile(intellijDep("jps-build-test"))
|
||||||
compilerModules.forEach {
|
compilerModules.forEach {
|
||||||
testRuntime(project(it))
|
testRuntime(project(it))
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.jetbrains.jps.builders.TestProjectBuilderLogger
|
|||||||
import org.jetbrains.jps.builders.impl.BuildDataPathsImpl
|
import org.jetbrains.jps.builders.impl.BuildDataPathsImpl
|
||||||
import org.jetbrains.jps.builders.logging.BuildLoggingManager
|
import org.jetbrains.jps.builders.logging.BuildLoggingManager
|
||||||
import org.jetbrains.jps.cmdline.ProjectDescriptor
|
import org.jetbrains.jps.cmdline.ProjectDescriptor
|
||||||
|
import org.jetbrains.jps.devkit.model.JpsPluginModuleType
|
||||||
import org.jetbrains.jps.incremental.BuilderRegistry
|
import org.jetbrains.jps.incremental.BuilderRegistry
|
||||||
import org.jetbrains.jps.incremental.CompileContext
|
import org.jetbrains.jps.incremental.CompileContext
|
||||||
import org.jetbrains.jps.incremental.IncProjectBuilder
|
import org.jetbrains.jps.incremental.IncProjectBuilder
|
||||||
@@ -677,6 +678,12 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
|||||||
result.assertSuccessful()
|
result.assertSuccessful()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testDevKitProject() {
|
||||||
|
initProject(JVM_MOCK_RUNTIME)
|
||||||
|
assertEquals(myProject.modules.single().moduleType, JpsPluginModuleType.INSTANCE)
|
||||||
|
buildAllModules().assertSuccessful()
|
||||||
|
}
|
||||||
|
|
||||||
fun testAccessToInternalInProductionFromTests() {
|
fun testAccessToInternalInProductionFromTests() {
|
||||||
initProject(JVM_MOCK_RUNTIME)
|
initProject(JVM_MOCK_RUNTIME)
|
||||||
val result = buildAllModules()
|
val result = buildAllModules()
|
||||||
|
|||||||
@@ -676,6 +676,12 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
|||||||
result.assertSuccessful()
|
result.assertSuccessful()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testDevKitProject() {
|
||||||
|
initProject(JVM_MOCK_RUNTIME)
|
||||||
|
assertEquals(myProject.modules.single().moduleType, JpsPluginModuleType.INSTANCE)
|
||||||
|
buildAllModules().assertSuccessful()
|
||||||
|
}
|
||||||
|
|
||||||
fun testAccessToInternalInProductionFromTests() {
|
fun testAccessToInternalInProductionFromTests() {
|
||||||
initProject(JVM_MOCK_RUNTIME)
|
initProject(JVM_MOCK_RUNTIME)
|
||||||
val result = buildAllModules()
|
val result = buildAllModules()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.jps.platforms
|
package org.jetbrains.kotlin.jps.platforms
|
||||||
|
|
||||||
import com.intellij.openapi.util.Key
|
import com.intellij.openapi.util.Key
|
||||||
|
import org.jetbrains.jps.builders.ModuleBasedBuildTargetType
|
||||||
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType
|
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType
|
||||||
import org.jetbrains.jps.incremental.CompileContext
|
import org.jetbrains.jps.incremental.CompileContext
|
||||||
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
||||||
@@ -55,7 +56,7 @@ class KotlinBuildTargets internal constructor(val compileContext: CompileContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
operator fun get(target: ModuleBuildTarget): KotlinModuleBuilderTarget? {
|
operator fun get(target: ModuleBuildTarget): KotlinModuleBuilderTarget? {
|
||||||
if (target.module.moduleType != JpsJavaModuleType.INSTANCE) return null
|
if (target.targetType !is ModuleBasedBuildTargetType) return null
|
||||||
|
|
||||||
return byJpsModuleBuildTarget.computeIfAbsent(target) {
|
return byJpsModuleBuildTarget.computeIfAbsent(target) {
|
||||||
when (target.module.targetPlatform ?: detectTargetPlatform(target)) {
|
when (target.module.targetPlatform ?: detectTargetPlatform(target)) {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PLUGIN_MODULE" version="4">
|
||||||
|
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
|
||||||
|
<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$/resources" type="java-resource" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?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"
|
||||||
|
default="true"
|
||||||
|
project-jdk-name="IntelliJ IDEA"
|
||||||
|
project-jdk-type="IDEA JDK" >
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<idea-plugin>
|
||||||
|
<id>com.your.company.unique.plugin.id</id>
|
||||||
|
<name>Plugin display name here</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<vendor email="support@yourcompany.com" url="http://www.yourcompany.com">YourCompany</vendor>
|
||||||
|
|
||||||
|
<description><![CDATA[
|
||||||
|
Enter short description for your plugin here.<br>
|
||||||
|
<em>most HTML tags may be used</em>
|
||||||
|
]]></description>
|
||||||
|
|
||||||
|
<change-notes><![CDATA[
|
||||||
|
Add change notes here.<br>
|
||||||
|
<em>most HTML tags may be used</em>
|
||||||
|
]]>
|
||||||
|
</change-notes>
|
||||||
|
|
||||||
|
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
|
||||||
|
<idea-version since-build="173.0"/>
|
||||||
|
|
||||||
|
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
|
||||||
|
on how to target different products -->
|
||||||
|
<!-- uncomment to enable plugin in all products
|
||||||
|
<depends>com.intellij.modules.lang</depends>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<!-- Add your extensions here -->
|
||||||
|
</extensions>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<!-- Add your actions here -->
|
||||||
|
</actions>
|
||||||
|
|
||||||
|
</idea-plugin>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fun main(args: Array<String>) {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user