Remove ultimate dir
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
.idea/shelf
|
|
||||||
dependencies
|
|
||||||
ideaSDK
|
|
||||||
out
|
|
||||||
tmp
|
|
||||||
workspace.xml
|
|
||||||
*.versionsBackup
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Kotlin Ultimate
|
|
||||||
|
|
||||||
This project is a part of **Kotlin IntelliJ IDEA Plugin**
|
|
||||||
which provides support for Ultimate IDEA features from Kotlin side.
|
|
||||||
@@ -1,228 +0,0 @@
|
|||||||
|
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
||||||
|
|
||||||
description = "Kotlin IDEA Ultimate plugin"
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
kotlin("jvm")
|
|
||||||
}
|
|
||||||
|
|
||||||
val ideaProjectResources = provider { project(":idea").mainSourceSet.output.resourcesDir }
|
|
||||||
val intellijUltimateEnabled : Boolean by rootProject.extra
|
|
||||||
|
|
||||||
val springClasspath by configurations.creating
|
|
||||||
val ideaPlugin by configurations.creating
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
if (intellijUltimateEnabled) {
|
|
||||||
testRuntime(intellijUltimateDep())
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOnly(project(":kotlin-reflect-api"))
|
|
||||||
compile(kotlinStdlib("jdk8"))
|
|
||||||
compile(project(":core:descriptors")) { isTransitive = false }
|
|
||||||
compile(project(":compiler:psi")) { isTransitive = false }
|
|
||||||
compile(project(":core:descriptors.jvm")) { isTransitive = false }
|
|
||||||
compile(project(":core:util.runtime")) { isTransitive = false }
|
|
||||||
compile(project(":compiler:light-classes")) { isTransitive = false }
|
|
||||||
compile(project(":core:type-system")) { isTransitive = false }
|
|
||||||
compile(project(":compiler:frontend")) { isTransitive = false }
|
|
||||||
compile(project(":compiler:frontend.common")) { isTransitive = false }
|
|
||||||
compile(project(":compiler:frontend.java")) { isTransitive = false }
|
|
||||||
compile(project(":compiler:util")) { isTransitive = false }
|
|
||||||
compile(project(":js:js.frontend")) { isTransitive = false }
|
|
||||||
compile(project(":idea")) { isTransitive = false }
|
|
||||||
compile(project(":idea:idea-jvm")) { isTransitive = false }
|
|
||||||
compile(project(":idea:idea-core")) { isTransitive = false }
|
|
||||||
compile(project(":idea:ide-common")) { isTransitive = false }
|
|
||||||
compile(project(":idea:idea-gradle")) { isTransitive = false }
|
|
||||||
compile(project(":compiler:util")) { isTransitive = false }
|
|
||||||
compile(project(":idea:idea-jps-common")) { isTransitive = false }
|
|
||||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
|
||||||
|
|
||||||
if (intellijUltimateEnabled) {
|
|
||||||
compileOnly(nodeJSPlugin())
|
|
||||||
compileOnly(intellijUltimateDep()) { includeJars("trove4j", "openapi", "platform-api", "platform-impl", "java-api", "java-impl", "idea", "util", "jdom") }
|
|
||||||
compileOnly(intellijUltimatePluginDep("CSS"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("DatabaseTools"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("JavaEE"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("jsp"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("PersistenceSupport"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("Spring"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("properties"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("java-i18n"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("gradle"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("Groovy"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("junit"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("uml"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("JavaScriptLanguage"))
|
|
||||||
compileOnly(intellijUltimatePluginDep("JavaScriptDebugger"))
|
|
||||||
}
|
|
||||||
|
|
||||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
|
||||||
testCompile(projectTests(":idea:idea-test-framework")) { isTransitive = false }
|
|
||||||
testCompile(project(":plugins:lint")) { isTransitive = false }
|
|
||||||
testCompile(project(":idea:idea-jvm")) { isTransitive = false }
|
|
||||||
testCompile(projectTests(":compiler:tests-common"))
|
|
||||||
testCompile(projectTests(":idea")) { isTransitive = false }
|
|
||||||
testCompile(projectTests(":generators:test-generator"))
|
|
||||||
testCompile(commonDep("junit:junit"))
|
|
||||||
|
|
||||||
testCompile(project(":idea:idea-native")) { isTransitive = false }
|
|
||||||
testCompile(project(":idea:idea-gradle-native")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlin-native:kotlin-native-library-reader")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlin-native:kotlin-native-utils")) { isTransitive = false }
|
|
||||||
|
|
||||||
if (intellijUltimateEnabled) {
|
|
||||||
testCompileOnly(intellijUltimateDep())
|
|
||||||
}
|
|
||||||
|
|
||||||
testCompile(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
|
|
||||||
|
|
||||||
testRuntime(project(":kotlin-reflect"))
|
|
||||||
testRuntime(project(":kotlin-script-runtime"))
|
|
||||||
testRuntimeOnly(project(":kotlin-compiler"))
|
|
||||||
testRuntime(project(":plugins:android-extensions-ide")) { isTransitive = false }
|
|
||||||
testRuntime(project(":plugins:android-extensions-compiler")) { isTransitive = false }
|
|
||||||
testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:idea-android")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:idea-maven")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:idea-jps-common")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:jvm-debugger:eval4j")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:jvm-debugger:jvm-debugger-util")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:jvm-debugger:jvm-debugger-core")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:jvm-debugger:jvm-debugger-evaluation")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:jvm-debugger:jvm-debugger-sequence")) { isTransitive = false }
|
|
||||||
testRuntime(project(":idea:formatter")) { isTransitive = false }
|
|
||||||
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlin-sam-with-receiver-compiler-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":noarg-ide-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlin-noarg-compiler-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":allopen-ide-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlin-allopen-compiler-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlin-scripting-compiler-impl")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":kotlinx-serialization-ide-plugin")) { isTransitive = false }
|
|
||||||
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
|
|
||||||
testRuntime(project(":plugins:uast-kotlin"))
|
|
||||||
testRuntime(project(":plugins:uast-kotlin-idea"))
|
|
||||||
testRuntime(intellijPluginDep("smali"))
|
|
||||||
|
|
||||||
if (intellijUltimateEnabled) {
|
|
||||||
testCompile(nodeJSPlugin())
|
|
||||||
testCompile(intellijUltimatePluginDep("CSS"))
|
|
||||||
testCompile(intellijUltimatePluginDep("DatabaseTools"))
|
|
||||||
testCompile(intellijUltimatePluginDep("JavaEE"))
|
|
||||||
testCompile(intellijUltimatePluginDep("jsp"))
|
|
||||||
testCompile(intellijUltimatePluginDep("PersistenceSupport"))
|
|
||||||
testCompile(intellijUltimatePluginDep("Spring"))
|
|
||||||
testCompile(intellijUltimatePluginDep("uml"))
|
|
||||||
testCompile(intellijUltimatePluginDep("JavaScriptLanguage"))
|
|
||||||
testCompile(intellijUltimatePluginDep("JavaScriptDebugger"))
|
|
||||||
testCompile(intellijUltimatePluginDep("properties"))
|
|
||||||
testCompile(intellijUltimatePluginDep("java-i18n"))
|
|
||||||
testCompile(intellijUltimatePluginDep("gradle"))
|
|
||||||
testCompile(intellijUltimatePluginDep("Groovy"))
|
|
||||||
testCompile(intellijUltimatePluginDep("junit"))
|
|
||||||
testRuntime(intellijUltimatePluginDep("coverage"))
|
|
||||||
testRuntime(intellijUltimatePluginDep("maven"))
|
|
||||||
testRuntime(intellijUltimatePluginDep("android"))
|
|
||||||
testRuntime(intellijUltimatePluginDep("testng"))
|
|
||||||
testRuntime(intellijUltimatePluginDep("IntelliLang"))
|
|
||||||
testRuntime(intellijUltimatePluginDep("copyright"))
|
|
||||||
testRuntime(intellijUltimatePluginDep("java-decompiler"))
|
|
||||||
}
|
|
||||||
|
|
||||||
testRuntime(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
|
||||||
|
|
||||||
springClasspath(commonDep("org.springframework", "spring-core"))
|
|
||||||
springClasspath(commonDep("org.springframework", "spring-beans"))
|
|
||||||
springClasspath(commonDep("org.springframework", "spring-context"))
|
|
||||||
springClasspath(commonDep("org.springframework", "spring-tx"))
|
|
||||||
springClasspath(commonDep("org.springframework", "spring-web"))
|
|
||||||
|
|
||||||
ideaPlugin(project(":prepare:idea-plugin", configuration = "runtimeJar"))
|
|
||||||
}
|
|
||||||
|
|
||||||
val preparedResources = File(buildDir, "prepResources")
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
"main" { projectDefault() }
|
|
||||||
"test" {
|
|
||||||
projectDefault()
|
|
||||||
resources.srcDir(preparedResources)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val ultimatePluginXmlContent: String by lazy {
|
|
||||||
val sectRex = Regex("""^\s*</?idea-plugin>\s*$""")
|
|
||||||
File(projectDir, "resources/META-INF/ultimate-plugin.xml")
|
|
||||||
.readLines()
|
|
||||||
.filterNot { it.matches(sectRex) }
|
|
||||||
.joinToString("\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
val prepareResources by task<Copy> {
|
|
||||||
dependsOn(":idea:assemble")
|
|
||||||
from(ideaProjectResources, {
|
|
||||||
exclude("META-INF/plugin.xml")
|
|
||||||
})
|
|
||||||
into(preparedResources)
|
|
||||||
}
|
|
||||||
|
|
||||||
val preparePluginXml by task<Copy> {
|
|
||||||
dependsOn(":idea:assemble")
|
|
||||||
from(ideaProjectResources, { include("META-INF/plugin.xml") })
|
|
||||||
into(preparedResources)
|
|
||||||
filter {
|
|
||||||
it?.replace("<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->", ultimatePluginXmlContent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val jar = runtimeJar {
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
||||||
dependsOn(preparePluginXml)
|
|
||||||
dependsOn(ideaPlugin)
|
|
||||||
|
|
||||||
from(provider { zipTree(ideaPlugin.singleFile) }) {
|
|
||||||
exclude("META-INF/plugin.xml")
|
|
||||||
}
|
|
||||||
|
|
||||||
from(preparedResources, { include("META-INF/plugin.xml") })
|
|
||||||
from(mainSourceSet.output)
|
|
||||||
archiveName = "kotlin-plugin.jar"
|
|
||||||
}
|
|
||||||
|
|
||||||
val ideaPluginDir: File by rootProject.extra
|
|
||||||
val ideaUltimatePluginDir: File by rootProject.extra
|
|
||||||
|
|
||||||
task<Copy>("ideaUltimatePlugin") {
|
|
||||||
dependsOn(":ideaPlugin")
|
|
||||||
into(ideaUltimatePluginDir)
|
|
||||||
from(ideaPluginDir) { exclude("lib/kotlin-plugin.jar") }
|
|
||||||
from(jar, { into("lib") })
|
|
||||||
}
|
|
||||||
|
|
||||||
task("idea-ultimate-plugin") {
|
|
||||||
dependsOn("ideaUltimatePlugin")
|
|
||||||
doFirst { logger.warn("'$name' task is deprecated, use '${dependsOn.last()}' instead") }
|
|
||||||
}
|
|
||||||
|
|
||||||
task("ideaUltimatePluginTest") {
|
|
||||||
dependsOn("check")
|
|
||||||
}
|
|
||||||
|
|
||||||
projectTest {
|
|
||||||
dependsOn(prepareResources)
|
|
||||||
dependsOn(preparePluginXml)
|
|
||||||
workingDir = rootDir
|
|
||||||
doFirst {
|
|
||||||
if (intellijUltimateEnabled) {
|
|
||||||
systemProperty("idea.home.path", intellijUltimateRootDir().canonicalPath)
|
|
||||||
}
|
|
||||||
systemProperty("spring.classpath", springClasspath.asPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val generateTests by generator("org.jetbrains.kotlin.tests.GenerateUltimateTestsKt")
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<?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$/tests" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/dependencies" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="main-project-production" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="main-project-tests" level="project" />
|
|
||||||
<orderEntry type="library" name="kotlin-runtime" level="project" />
|
|
||||||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
|
||||||
<orderEntry type="library" name="kotlin-script-runtime" level="project" />
|
|
||||||
<orderEntry type="library" name="javax.inject" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="css-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="database-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="javaee-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="jsp-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="persistence-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="spring-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="properties" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="java-i18n" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="gradle-and-groovy-plugin" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="junit-plugin" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="diagram-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="javascript-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="nodejs-support" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="javascript-debugger" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="intellij-core" level="project" />
|
|
||||||
<orderEntry type="library" name="idea-full" level="project" />
|
|
||||||
<orderEntry type="library" name="protobuf" level="project" />
|
|
||||||
<orderEntry type="library" name="javaslang" level="project" />
|
|
||||||
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<idea-plugin>
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
|
||||||
<configurationType implementation="org.jetbrains.kotlin.idea.nodejs.protractor.KotlinProtractorConfigurationType"/>
|
|
||||||
|
|
||||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.nodejs.mocha.KotlinMochaRunConfigurationProducer"/>
|
|
||||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.nodejs.protractor.KotlinProtractorRunConfigurationProducer"/>
|
|
||||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.nodejs.jest.KotlinJestRunConfigurationProducer"/>
|
|
||||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.nodejs.cli.KotlinNodeJsRunConfigurationProducer"/>
|
|
||||||
</extensions>
|
|
||||||
</idea-plugin>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<idea-plugin>
|
|
||||||
<extensions defaultExtensionNs="org.intellij.intelliLang">
|
|
||||||
<injectionConfig config="injection/kotlinUltimateInjections.xml"/>
|
|
||||||
</extensions>
|
|
||||||
</idea-plugin>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<idea-plugin>
|
|
||||||
<depends optional="true" config-file="kotlin-nodejs.xml">NodeJS</depends>
|
|
||||||
</idea-plugin>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<html>
|
|
||||||
<body>
|
|
||||||
This inspection reports final Kotlin classes and functions annotated with Spring @Component, @Configuration or @Bean annotations.
|
|
||||||
<!-- tooltip end -->
|
|
||||||
<p>
|
|
||||||
<b>Deprecated</b>. This inspection is deprecated in favour of more robust <b>"Final declaration can't be overridden at runtime"</b> inspection.
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<html>
|
|
||||||
<body>
|
|
||||||
Checks @ComponentScan (and similar annotations) for setup errors.
|
|
||||||
<!-- tooltip end -->
|
|
||||||
<p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Checks Spring code configuration files setup in Spring facet.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Checks that autowired members are defined in valid Spring bean (@Component|@Service|...).
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Checks autowiring problems in a bean class.
|
|
||||||
-85
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.cli
|
|
||||||
|
|
||||||
import com.intellij.execution.actions.ConfigurationContext
|
|
||||||
import com.intellij.execution.actions.RunConfigurationProducer
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.util.Ref
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.jetbrains.nodejs.run.NodeJsRunConfiguration
|
|
||||||
import com.jetbrains.nodejs.run.NodeJsRunConfigurationType
|
|
||||||
import org.jetbrains.kotlin.idea.MainFunctionDetector
|
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationData
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationDataProvider
|
|
||||||
import org.jetbrains.kotlin.idea.js.asJsModule
|
|
||||||
import org.jetbrains.kotlin.idea.js.jsProductionOutputFilePath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.TestElementPath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.getNodeJsEnvironmentVars
|
|
||||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
|
||||||
import org.jetbrains.kotlin.idea.run.addBuildTask
|
|
||||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
|
||||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
|
||||||
|
|
||||||
class NodeJsConfigData(
|
|
||||||
override val element: PsiElement,
|
|
||||||
override val module: Module,
|
|
||||||
override val jsOutputFilePath: String
|
|
||||||
) : KotlinJSRunConfigurationData
|
|
||||||
|
|
||||||
private class KotlinNodeJsRunConfigurationProducer :
|
|
||||||
RunConfigurationProducer<NodeJsRunConfiguration>(NodeJsRunConfigurationType.getInstance()),
|
|
||||||
KotlinJSRunConfigurationDataProvider<NodeJsConfigData> {
|
|
||||||
private val ConfigurationContext?.isAcceptable: Boolean
|
|
||||||
get() {
|
|
||||||
val original = this?.getOriginalConfiguration(null)
|
|
||||||
return original == null || original is NodeJsRunConfiguration
|
|
||||||
}
|
|
||||||
|
|
||||||
override val isForTests: Boolean
|
|
||||||
get() = false
|
|
||||||
|
|
||||||
override fun getConfigurationData(context: ConfigurationContext): NodeJsConfigData? {
|
|
||||||
if (!context.isAcceptable) return null
|
|
||||||
val element = context.psiLocation ?: return null
|
|
||||||
val module = context.module?.asJsModule() ?: return null
|
|
||||||
|
|
||||||
val jsFilePath = module.jsProductionOutputFilePath ?: return null
|
|
||||||
val declaration = element.getNonStrictParentOfType<KtNamedDeclaration>()
|
|
||||||
if (declaration is KtNamedFunction) {
|
|
||||||
val detector = MainFunctionDetector(declaration.languageVersionSettings) { it.resolveToDescriptorIfAny() }
|
|
||||||
if (!detector.isMain(declaration, false)) return null
|
|
||||||
} else if (!TestElementPath.isModuleAssociatedDir(element, module)) return null
|
|
||||||
return NodeJsConfigData(element, module, jsFilePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setupConfigurationFromContext(
|
|
||||||
configuration: NodeJsRunConfiguration,
|
|
||||||
context: ConfigurationContext,
|
|
||||||
sourceElement: Ref<PsiElement>
|
|
||||||
): Boolean {
|
|
||||||
val psiElement = sourceElement.get() ?: return false
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
|
|
||||||
if (configuration.workingDirectory.isNullOrBlank()) {
|
|
||||||
configuration.workingDirectory = FileUtil.toSystemDependentName(psiElement.project.baseDir.path)
|
|
||||||
}
|
|
||||||
configuration.inputPath = configData.jsOutputFilePath
|
|
||||||
configuration.envs = configData.module.getNodeJsEnvironmentVars(false).envs
|
|
||||||
configuration.setGeneratedName()
|
|
||||||
configuration.addBuildTask()
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isConfigurationFromContext(configuration: NodeJsRunConfiguration, context: ConfigurationContext): Boolean {
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
return configuration.inputPath == configData.jsOutputFilePath
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-120
@@ -1,120 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.jest
|
|
||||||
|
|
||||||
import com.intellij.execution.actions.ConfigurationContext
|
|
||||||
import com.intellij.javascript.jest.JestRunConfiguration
|
|
||||||
import com.intellij.javascript.jest.JestRunConfigurationProducer
|
|
||||||
import com.intellij.javascript.jest.JestRunSettings
|
|
||||||
import com.intellij.javascript.jest.scope.JestScopeKind
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.util.Ref
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationData
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationDataProvider
|
|
||||||
import org.jetbrains.kotlin.idea.js.asJsModule
|
|
||||||
import org.jetbrains.kotlin.idea.js.jsTestOutputFilePath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.TestElementInfo
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.TestElementPath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.getNodeJsEnvironmentVars
|
|
||||||
import org.jetbrains.kotlin.idea.run.addBuildTask
|
|
||||||
import org.jetbrains.kotlin.idea.util.sourceRoots
|
|
||||||
|
|
||||||
typealias JestTestElementInfo = TestElementInfo<JestRunSettings>
|
|
||||||
|
|
||||||
class JestConfigData(
|
|
||||||
override val element: PsiElement,
|
|
||||||
override val module: Module,
|
|
||||||
override val jsOutputFilePath: String,
|
|
||||||
val testElementPath: TestElementPath
|
|
||||||
) : KotlinJSRunConfigurationData
|
|
||||||
|
|
||||||
class KotlinJestRunConfigurationProducer :
|
|
||||||
JestRunConfigurationProducer(),
|
|
||||||
KotlinJSRunConfigurationDataProvider<JestConfigData> {
|
|
||||||
private fun createTestElementRunInfo(
|
|
||||||
configData: JestConfigData,
|
|
||||||
originalSettings: JestRunSettings
|
|
||||||
): JestTestElementInfo {
|
|
||||||
val project = configData.module.project
|
|
||||||
|
|
||||||
val settings = if (originalSettings.workingDirSystemDependentPath.isBlank()) {
|
|
||||||
val workingDir = FileUtil.toSystemDependentName(project.baseDir.path)
|
|
||||||
originalSettings.toBuilder().setWorkingDir(workingDir).build()
|
|
||||||
} else originalSettings
|
|
||||||
|
|
||||||
val builder = settings.toBuilder()
|
|
||||||
builder.setTestFilePath(configData.jsOutputFilePath)
|
|
||||||
when (configData.testElementPath) {
|
|
||||||
is TestElementPath.BySuite -> {
|
|
||||||
val (suiteNames, testName) = configData.testElementPath
|
|
||||||
if (testName == null) {
|
|
||||||
builder.setScopeKind(JestScopeKind.SUITE)
|
|
||||||
builder.setTestNames(suiteNames)
|
|
||||||
} else {
|
|
||||||
builder.setScopeKind(JestScopeKind.TEST)
|
|
||||||
builder.setTestNames(suiteNames + testName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
is TestElementPath.BySingleFile -> {
|
|
||||||
builder.setScopeKind(JestScopeKind.TEST_FILE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
builder.setEnvData(configData.module.getNodeJsEnvironmentVars(true))
|
|
||||||
|
|
||||||
return JestTestElementInfo(builder.build(), configData.element)
|
|
||||||
}
|
|
||||||
|
|
||||||
override val isForTests: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
override fun getConfigurationData(
|
|
||||||
context: ConfigurationContext
|
|
||||||
): JestConfigData? {
|
|
||||||
val element = context.psiLocation ?: return null
|
|
||||||
val module = context.module?.asJsModule() ?: return null
|
|
||||||
|
|
||||||
if (module.sourceRoots.none { isTestRunnerPackageAvailableFor(module.project, it) }) return null
|
|
||||||
|
|
||||||
val testFilePath = module.jsTestOutputFilePath ?: return null
|
|
||||||
val testElementPath = TestElementPath.forElement(element, module) ?: return null
|
|
||||||
|
|
||||||
return JestConfigData(element, module, testFilePath, testElementPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isConfigurationFromCompatibleContext(configuration: JestRunConfiguration, context: ConfigurationContext): Boolean {
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
val (thisRunSettings, _) = createTestElementRunInfo(configData, configuration.runSettings)
|
|
||||||
val thatRunSettings = configuration.runSettings
|
|
||||||
|
|
||||||
if (thisRunSettings.configFileSystemDependentPath != thatRunSettings.configFileSystemDependentPath) return false
|
|
||||||
if (thatRunSettings.scopeKind != thisRunSettings.scopeKind) return false
|
|
||||||
return when (thisRunSettings.scopeKind) {
|
|
||||||
JestScopeKind.ALL -> true
|
|
||||||
JestScopeKind.TEST_FILE -> thisRunSettings.testFileSystemDependentPath == thatRunSettings.testFileSystemDependentPath
|
|
||||||
JestScopeKind.SUITE, JestScopeKind.TEST ->
|
|
||||||
thisRunSettings.testFileSystemDependentPath == thatRunSettings.testFileSystemDependentPath &&
|
|
||||||
thisRunSettings.testNames == thatRunSettings.testNames
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setupConfigurationFromCompatibleContext(
|
|
||||||
configuration: JestRunConfiguration,
|
|
||||||
context: ConfigurationContext,
|
|
||||||
sourceElement: Ref<PsiElement>
|
|
||||||
): Boolean {
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
val (runSettings, enclosingTestElement) = createTestElementRunInfo(configData, configuration.runSettings)
|
|
||||||
configuration.runSettings = runSettings
|
|
||||||
sourceElement.set(enclosingTestElement)
|
|
||||||
configuration.setGeneratedName()
|
|
||||||
configuration.addBuildTask()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs
|
|
||||||
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.roots.ModuleRootManager
|
|
||||||
import com.intellij.psi.PsiDirectory
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import org.jetbrains.kotlin.idea.util.projectStructure.getModuleDir
|
|
||||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
|
||||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
|
||||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
|
|
||||||
|
|
||||||
data class TestElementInfo<out Settings>(val runSettings: Settings, val enclosingTestElement: PsiElement)
|
|
||||||
|
|
||||||
sealed class TestElementPath {
|
|
||||||
data class BySuite(val suiteNames: List<String>, val testName: String?) : TestElementPath()
|
|
||||||
object BySingleFile : TestElementPath()
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun isModuleAssociatedDir(element: PsiElement, module: Module): Boolean {
|
|
||||||
if (element !is PsiDirectory) return false
|
|
||||||
val virtualFile = element.virtualFile
|
|
||||||
return (module.getModuleDir() == virtualFile.path
|
|
||||||
|| virtualFile == ModuleRootManager.getInstance(module).contentRoots.singleOrNull())
|
|
||||||
}
|
|
||||||
|
|
||||||
fun forElement(element: PsiElement, module: Module): TestElementPath? {
|
|
||||||
if (isModuleAssociatedDir(element, module)) return TestElementPath.BySingleFile
|
|
||||||
|
|
||||||
val declaration = element.getNonStrictParentOfType<KtNamedDeclaration>() ?: return null
|
|
||||||
val klass = when (declaration) {
|
|
||||||
is KtClassOrObject -> declaration
|
|
||||||
is KtNamedFunction -> declaration.containingClassOrObject ?: return null
|
|
||||||
else -> return null
|
|
||||||
}
|
|
||||||
val suiteNames = klass.parentsWithSelf
|
|
||||||
.filterIsInstance<KtClassOrObject>()
|
|
||||||
.mapNotNull { it.name }
|
|
||||||
.toList()
|
|
||||||
.asReversed()
|
|
||||||
val testName = (declaration as? KtNamedFunction)?.name
|
|
||||||
return TestElementPath.BySuite(suiteNames, testName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-167
@@ -1,167 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.mocha
|
|
||||||
|
|
||||||
import com.intellij.execution.RunManager
|
|
||||||
import com.intellij.execution.actions.ConfigurationContext
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.openapi.util.Ref
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.openapi.vfs.LocalFileSystem
|
|
||||||
import com.intellij.openapi.vfs.VfsUtilCore
|
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.util.SmartList
|
|
||||||
import com.intellij.util.containers.SmartHashSet
|
|
||||||
import com.jetbrains.nodejs.mocha.MochaUtil
|
|
||||||
import com.jetbrains.nodejs.mocha.execution.*
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationData
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationDataProvider
|
|
||||||
import org.jetbrains.kotlin.idea.js.asJsModule
|
|
||||||
import org.jetbrains.kotlin.idea.js.jsTestOutputFilePath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.TestElementInfo
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.TestElementPath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.getNodeJsEnvironmentVars
|
|
||||||
import org.jetbrains.kotlin.idea.run.addBuildTask
|
|
||||||
import org.jetbrains.kotlin.idea.util.sourceRoots
|
|
||||||
|
|
||||||
private typealias MochaTestElementInfo = TestElementInfo<MochaRunSettings>
|
|
||||||
|
|
||||||
class MochaConfigData(
|
|
||||||
override val element: PsiElement,
|
|
||||||
override val module: Module,
|
|
||||||
override val jsOutputFilePath: String,
|
|
||||||
val testElementPath: TestElementPath
|
|
||||||
) : KotlinJSRunConfigurationData
|
|
||||||
|
|
||||||
class KotlinMochaRunConfigurationProducer : MochaRunConfigurationProducer(), KotlinJSRunConfigurationDataProvider<MochaConfigData> {
|
|
||||||
// Copied from MochaRunConfigurationProducer.collectMochaTestRoots()
|
|
||||||
private fun collectMochaTestRoots(project: Project): List<VirtualFile> {
|
|
||||||
return RunManager
|
|
||||||
.getInstance(project)
|
|
||||||
.getConfigurationsList(MochaConfigurationType.getInstance())
|
|
||||||
.filterIsInstance<MochaRunConfiguration>()
|
|
||||||
.mapNotNullTo(SmartList<VirtualFile>()) { configuration ->
|
|
||||||
val settings = configuration.runSettings
|
|
||||||
val path = when (settings.testKind) {
|
|
||||||
MochaTestKind.DIRECTORY -> settings.testDirPath
|
|
||||||
MochaTestKind.TEST_FILE,
|
|
||||||
MochaTestKind.SUITE,
|
|
||||||
MochaTestKind.TEST -> settings.testFilePath
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
if (path.isNullOrBlank()) return@mapNotNullTo null
|
|
||||||
LocalFileSystem.getInstance().findFileByPath(path!!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createTestElementRunInfo(configData: MochaConfigData, originalSettings: MochaRunSettings): MochaTestElementInfo {
|
|
||||||
val project = configData.module.project
|
|
||||||
val settings = if (originalSettings.workingDir.isBlank()) {
|
|
||||||
val workingDir = FileUtil.toSystemDependentName(project.baseDir.path)
|
|
||||||
originalSettings.builder().setWorkingDir(workingDir).build()
|
|
||||||
} else originalSettings
|
|
||||||
val builder = settings.builder()
|
|
||||||
builder.setTestFilePath(configData.jsOutputFilePath)
|
|
||||||
if (settings.ui.isEmpty()) {
|
|
||||||
builder.setUi(MochaUtil.UI_BDD)
|
|
||||||
}
|
|
||||||
when (configData.testElementPath) {
|
|
||||||
is TestElementPath.BySuite -> {
|
|
||||||
val (suiteNames, testName) = configData.testElementPath
|
|
||||||
if (testName == null) {
|
|
||||||
builder.setTestKind(MochaTestKind.SUITE)
|
|
||||||
builder.setSuiteNames(suiteNames)
|
|
||||||
} else {
|
|
||||||
builder.setTestKind(MochaTestKind.TEST)
|
|
||||||
builder.setTestNames(suiteNames + testName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
is TestElementPath.BySingleFile -> {
|
|
||||||
builder.setTestKind(MochaTestKind.TEST_FILE)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.setEnvData(configData.module.getNodeJsEnvironmentVars(true))
|
|
||||||
|
|
||||||
return MochaTestElementInfo(builder.build(), configData.element)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getConfigurationData(context: ConfigurationContext): MochaConfigData? {
|
|
||||||
val module = context.module?.asJsModule() ?: return null
|
|
||||||
val element = context.psiLocation ?: return null
|
|
||||||
val file = module.moduleFile ?: return null
|
|
||||||
val project = module.project
|
|
||||||
|
|
||||||
val testFilePath = module.jsTestOutputFilePath ?: return null
|
|
||||||
val testElementPath = TestElementPath.forElement(element, module) ?: return null
|
|
||||||
|
|
||||||
val configData = MochaConfigData(element, module, testFilePath, testElementPath)
|
|
||||||
|
|
||||||
if (context.getOriginalConfiguration(MochaConfigurationType.getInstance()) is MochaRunConfiguration) return configData
|
|
||||||
|
|
||||||
if (module.sourceRoots.any { isTestRunnerPackageAvailableFor(project, it) }) return configData
|
|
||||||
|
|
||||||
val roots = collectMochaTestRoots(project)
|
|
||||||
if (roots.isEmpty()) return null
|
|
||||||
|
|
||||||
val dirs = SmartHashSet<VirtualFile>()
|
|
||||||
for (root in roots) {
|
|
||||||
when {
|
|
||||||
root.isDirectory -> dirs.add(root)
|
|
||||||
root == file -> return configData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return if (VfsUtilCore.isUnder(file, dirs)) configData else null
|
|
||||||
}
|
|
||||||
|
|
||||||
override val isForTests: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
override fun isConfigurationFromCompatibleContext(configuration: MochaRunConfiguration, context: ConfigurationContext): Boolean {
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
val (thisRunSettings, _) = createTestElementRunInfo(configData, configuration.runSettings)
|
|
||||||
val thatRunSettings = configuration.runSettings
|
|
||||||
val thisTestKind = thisRunSettings.testKind
|
|
||||||
if (thisTestKind != thatRunSettings.testKind) return false
|
|
||||||
return when {
|
|
||||||
thisTestKind == MochaTestKind.DIRECTORY -> thisRunSettings.testDirPath == thatRunSettings.testDirPath
|
|
||||||
thisTestKind == MochaTestKind.PATTERN -> thisRunSettings.testFilePattern == thatRunSettings.testFilePattern
|
|
||||||
thisTestKind == MochaTestKind.TEST_FILE -> thisRunSettings.testFilePath == thatRunSettings.testFilePath
|
|
||||||
thisTestKind == MochaTestKind.SUITE -> thisRunSettings.testFilePath == thatRunSettings.testFilePath && thisRunSettings.suiteNames == thatRunSettings.suiteNames
|
|
||||||
thisTestKind != MochaTestKind.TEST -> false
|
|
||||||
else -> thisRunSettings.testFilePath == thatRunSettings.testFilePath && thisRunSettings.testNames == thatRunSettings.testNames
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setupConfigurationFromCompatibleContext(
|
|
||||||
configuration: MochaRunConfiguration,
|
|
||||||
context: ConfigurationContext,
|
|
||||||
sourceElement: Ref<PsiElement>
|
|
||||||
): Boolean {
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
val (runSettings, enclosingTestElement) = createTestElementRunInfo(configData, configuration.runSettings)
|
|
||||||
if (runSettings.testKind == MochaTestKind.DIRECTORY) return false
|
|
||||||
configuration.runSettings = runSettings
|
|
||||||
sourceElement.set(enclosingTestElement)
|
|
||||||
configuration.setGeneratedName()
|
|
||||||
configuration.addBuildTask()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs
|
|
||||||
|
|
||||||
import com.intellij.execution.configuration.EnvironmentVariablesData
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.roots.CompilerModuleExtension
|
|
||||||
import com.intellij.openapi.roots.ModuleRootManager
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import org.jetbrains.kotlin.idea.js.shouldUseJpsOutput
|
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
|
||||||
import java.io.File
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
const val NODE_PATH_VAR = "NODE_PATH"
|
|
||||||
|
|
||||||
fun Module.getNodeJsEnvironmentVars(isForTests: Boolean): EnvironmentVariablesData {
|
|
||||||
val nodeJsClasspath = getNodeJsClasspath(this, isForTests).joinToString(File.pathSeparator) {
|
|
||||||
val basePath = project.basePath ?: return@joinToString it
|
|
||||||
FileUtil.getRelativePath(basePath, it, '/') ?: it
|
|
||||||
}
|
|
||||||
return EnvironmentVariablesData.create(mapOf(NODE_PATH_VAR to nodeJsClasspath), true)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun addSingleModulePaths(
|
|
||||||
target: Module,
|
|
||||||
isForTests: Boolean,
|
|
||||||
result: MutableList<String>
|
|
||||||
) {
|
|
||||||
val compilerExtension = CompilerModuleExtension.getInstance(target) ?: return
|
|
||||||
if (isForTests) {
|
|
||||||
result.addIfNotNull(compilerExtension.compilerOutputPath?.path)
|
|
||||||
result.addIfNotNull(compilerExtension.compilerOutputPathForTests?.let { "${it.path}/lib" })
|
|
||||||
} else {
|
|
||||||
result.addIfNotNull(compilerExtension.compilerOutputPath?.let { "${it.path}/lib" })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getNodeJsClasspath(module: Module, isForTests: Boolean): List<String> {
|
|
||||||
if (!module.shouldUseJpsOutput) return emptyList()
|
|
||||||
|
|
||||||
val result = ArrayList<String>()
|
|
||||||
ModuleRootManager.getInstance(module).orderEntries().recursively().forEachModule {
|
|
||||||
addSingleModulePaths(it, isForTests, result)
|
|
||||||
true
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.protractor
|
|
||||||
|
|
||||||
import com.intellij.execution.configuration.ConfigurationFactoryEx
|
|
||||||
import com.intellij.execution.configurations.ConfigurationFactory
|
|
||||||
import com.intellij.execution.configurations.ConfigurationTypeBase
|
|
||||||
import com.intellij.execution.configurations.ConfigurationTypeUtil
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import icons.JavaScriptLanguageIcons
|
|
||||||
|
|
||||||
class KotlinProtractorConfigurationType : ConfigurationTypeBase(
|
|
||||||
"KotlinJavaScriptTestRunnerProtractor",
|
|
||||||
"Protractor (Kotlin)",
|
|
||||||
NAME,
|
|
||||||
JavaScriptLanguageIcons.Protractor.Protractor
|
|
||||||
) {
|
|
||||||
init {
|
|
||||||
addFactory(object : ConfigurationFactoryEx<KotlinProtractorRunConfiguration>(this) {
|
|
||||||
override fun createTemplateConfiguration(project: Project) = KotlinProtractorRunConfiguration(project, this, NAME)
|
|
||||||
|
|
||||||
override fun isConfigurationSingletonByDefault() = true
|
|
||||||
|
|
||||||
override fun canConfigurationBeSingleton() = false
|
|
||||||
|
|
||||||
override fun onNewConfigurationCreated(configuration: KotlinProtractorRunConfiguration) = configuration.initialize()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val NAME = "Protractor"
|
|
||||||
|
|
||||||
fun getInstance() = ConfigurationTypeUtil.findConfigurationType(KotlinProtractorConfigurationType::class.java)
|
|
||||||
|
|
||||||
val factory: ConfigurationFactory
|
|
||||||
get() = getInstance().configurationFactories.first()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-104
@@ -1,104 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.protractor
|
|
||||||
|
|
||||||
import com.intellij.execution.Executor
|
|
||||||
import com.intellij.execution.configurations.ConfigurationFactory
|
|
||||||
import com.intellij.execution.configurations.LocatableConfigurationBase
|
|
||||||
import com.intellij.execution.configurations.RuntimeConfigurationError
|
|
||||||
import com.intellij.execution.runners.ExecutionEnvironment
|
|
||||||
import com.intellij.javascript.nodejs.interpreter.local.NodeJsLocalInterpreter
|
|
||||||
import com.intellij.javascript.nodejs.util.NodePackage
|
|
||||||
import com.intellij.javascript.protractor.ProtractorUtil
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.util.PathUtil
|
|
||||||
import org.jdom.Element
|
|
||||||
import org.jetbrains.kotlin.idea.run.LocatableConfigurationBaseAny
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
// Based on com.intellij.javascript.protractor.ProtractorRunConfiguration
|
|
||||||
class KotlinProtractorRunConfiguration(
|
|
||||||
project: Project,
|
|
||||||
factory: ConfigurationFactory,
|
|
||||||
name: String
|
|
||||||
) : LocatableConfigurationBaseAny(project, factory, name) {
|
|
||||||
var runSettings = KotlinProtractorRunSettings()
|
|
||||||
|
|
||||||
val protractorPackage: NodePackage
|
|
||||||
get() {
|
|
||||||
val project = project
|
|
||||||
val interpreter = runSettings.interpreterRef.resolve(project)
|
|
||||||
return ProtractorUtil.getProtractorPackage(project, null, interpreter, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getState(executor: Executor, environment: ExecutionEnvironment) =
|
|
||||||
KotlinProtractorRunState(this, environment, protractorPackage)
|
|
||||||
|
|
||||||
override fun getConfigurationEditor() = KotlinProtractorRunConfigurationEditor(project)
|
|
||||||
|
|
||||||
override fun readExternal(element: Element) {
|
|
||||||
super.readExternal(element)
|
|
||||||
runSettings = KotlinProtractorRunSettings.readFromXML(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun writeExternal(element: Element) {
|
|
||||||
super.writeExternal(element)
|
|
||||||
runSettings.writeToXML(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun initialize() {
|
|
||||||
setNameChangedByUser(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun checkConfiguration() {
|
|
||||||
val isOptionalConfig = runSettings.testFileSystemDependentPath.isNotBlank() || runSettings.seleniumAddress.isNotBlank()
|
|
||||||
if (isOptionalConfig) {
|
|
||||||
validatePath("test file", runSettings.testFileSystemDependentPath, true, false)
|
|
||||||
if (runSettings.seleniumAddress.isBlank()) {
|
|
||||||
throw RuntimeConfigurationError("Unspecified Selenium address")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isOptionalConfig || runSettings.configFileSystemDependentPath.isNotBlank()) {
|
|
||||||
validatePath("configuration file", runSettings.configFileSystemDependentPath, true, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
val interpreter = runSettings.interpreterRef.resolve(project)
|
|
||||||
NodeJsLocalInterpreter.checkForRunConfiguration(interpreter)
|
|
||||||
|
|
||||||
validatePath("protractor package", protractorPackage.systemDependentPath, true, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun suggestedName(): String? {
|
|
||||||
val name = PathUtil.getFileName(runSettings.testFileSystemDependentPath)
|
|
||||||
return if (name.isNotBlank()) name else null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun validatePath(name: String,
|
|
||||||
path: String?,
|
|
||||||
shouldBeAbsolute: Boolean,
|
|
||||||
shouldBeDirectory: Boolean
|
|
||||||
) {
|
|
||||||
if (path.isNullOrBlank()) throw RuntimeConfigurationError("Unspecified " + name)
|
|
||||||
|
|
||||||
val file = File(path!!)
|
|
||||||
|
|
||||||
if (shouldBeAbsolute && !file.isAbsolute) throw RuntimeConfigurationError("No such " + name)
|
|
||||||
|
|
||||||
val exists = if (shouldBeDirectory) file.isDirectory else file.isFile
|
|
||||||
if (!exists) throw RuntimeConfigurationError("No such " + name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-144
@@ -1,144 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.protractor
|
|
||||||
|
|
||||||
import com.intellij.execution.configuration.EnvironmentVariablesTextFieldWithBrowseButton
|
|
||||||
import com.intellij.javascript.nodejs.interpreter.NodeJsInterpreterField
|
|
||||||
import com.intellij.javascript.nodejs.util.NodePackageField
|
|
||||||
import com.intellij.javascript.protractor.ProtractorUtil
|
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
|
||||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
|
|
||||||
import com.intellij.openapi.options.SettingsEditor
|
|
||||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor
|
|
||||||
import com.intellij.openapi.project.Project
|
|
||||||
import com.intellij.openapi.ui.DialogWrapper
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.ui.RawCommandLineEditor
|
|
||||||
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton
|
|
||||||
import com.intellij.util.containers.ContainerUtil
|
|
||||||
import com.intellij.util.ui.FormBuilder
|
|
||||||
import com.intellij.util.ui.JBUI
|
|
||||||
import com.intellij.util.ui.SwingHelper
|
|
||||||
|
|
||||||
import javax.swing.*
|
|
||||||
import java.util.Collections
|
|
||||||
|
|
||||||
// Based com.intellij.javascript.protractor.ProtractorRunConfigurationEditor
|
|
||||||
class KotlinProtractorRunConfigurationEditor(private val myProject: Project) : SettingsEditor<KotlinProtractorRunConfiguration>() {
|
|
||||||
private val testFilePathTextFieldWithBrowseButton: TextFieldWithHistoryWithBrowseButton
|
|
||||||
private val seleniumAddressTextField: JTextField
|
|
||||||
private val extraOptionsEditor: RawCommandLineEditor
|
|
||||||
private val configPathTextFieldWithBrowseButton: TextFieldWithHistoryWithBrowseButton
|
|
||||||
private val interpreterField: NodeJsInterpreterField
|
|
||||||
private val protractorPackageField: NodePackageField
|
|
||||||
private val envVarsComponent: EnvironmentVariablesTextFieldWithBrowseButton
|
|
||||||
private val panel: JPanel
|
|
||||||
|
|
||||||
init {
|
|
||||||
testFilePathTextFieldWithBrowseButton = createTestFileTextField(myProject)
|
|
||||||
seleniumAddressTextField = JTextField()
|
|
||||||
extraOptionsEditor = RawCommandLineEditor().apply { dialogCaption = "Extra Protractor Options" }
|
|
||||||
configPathTextFieldWithBrowseButton = createConfigurationFileTextField(myProject)
|
|
||||||
interpreterField = NodeJsInterpreterField(myProject, false)
|
|
||||||
protractorPackageField = NodePackageField(myProject, ProtractorUtil.PACKAGE_NAME) { interpreterField.interpreter }
|
|
||||||
envVarsComponent = EnvironmentVariablesTextFieldWithBrowseButton()
|
|
||||||
panel = FormBuilder()
|
|
||||||
.setAlignLabelOnRight(false)
|
|
||||||
.addLabeledComponent("&Test file:", testFilePathTextFieldWithBrowseButton)
|
|
||||||
.addLabeledComponent("&Selenium address:", seleniumAddressTextField)
|
|
||||||
.addLabeledComponent("E&xtra Protractor options:", extraOptionsEditor)
|
|
||||||
.addComponent(JSeparator(), JBUI.scale(8))
|
|
||||||
.addLabeledComponent("&Configuration file:", configPathTextFieldWithBrowseButton)
|
|
||||||
.addComponent(JSeparator(), JBUI.scale(8))
|
|
||||||
.addLabeledComponent("Node &interpreter:", interpreterField, JBUI.scale(8))
|
|
||||||
.addLabeledComponent("&Protractor package:", protractorPackageField)
|
|
||||||
.addLabeledComponent("&Environment variables:", envVarsComponent)
|
|
||||||
.panel
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createConfigurationFileTextField(project: Project) = TextFieldWithHistoryWithBrowseButton().apply {
|
|
||||||
val textFieldWithHistory = childComponent
|
|
||||||
textFieldWithHistory.setHistorySize(-1)
|
|
||||||
textFieldWithHistory.setMinimumAndPreferredWidth(0)
|
|
||||||
SwingHelper.addHistoryOnExpansion(textFieldWithHistory) {
|
|
||||||
val newFiles = ProtractorUtil.listPossibleConfigFilesInProject(project)
|
|
||||||
val newFilePaths = ContainerUtil.map(newFiles) { file -> FileUtil.toSystemDependentName(file.path) }
|
|
||||||
Collections.sort(newFilePaths)
|
|
||||||
newFilePaths
|
|
||||||
}
|
|
||||||
|
|
||||||
SwingHelper.installFileCompletionAndBrowseDialog(
|
|
||||||
project,
|
|
||||||
this,
|
|
||||||
"Select Protractor Configuration File",
|
|
||||||
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createTestFileTextField(project: Project) = TextFieldWithHistoryWithBrowseButton().apply {
|
|
||||||
val textFieldWithHistory = childComponent
|
|
||||||
textFieldWithHistory.setHistorySize(-1)
|
|
||||||
textFieldWithHistory.setMinimumAndPreferredWidth(0)
|
|
||||||
|
|
||||||
SwingHelper.installFileCompletionAndBrowseDialog(
|
|
||||||
project,
|
|
||||||
this,
|
|
||||||
"Select Protractor Configuration File",
|
|
||||||
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun resetEditorFrom(runConfiguration: KotlinProtractorRunConfiguration) {
|
|
||||||
with(runConfiguration.runSettings) {
|
|
||||||
testFilePathTextFieldWithBrowseButton.setTextAndAddToHistory(testFileSystemDependentPath)
|
|
||||||
seleniumAddressTextField.text = seleniumAddress
|
|
||||||
extraOptionsEditor.text = extraOptions
|
|
||||||
configPathTextFieldWithBrowseButton.setTextAndAddToHistory(configFileSystemDependentPath)
|
|
||||||
interpreterField.interpreterRef = interpreterRef
|
|
||||||
protractorPackageField.selected = runConfiguration.protractorPackage
|
|
||||||
envVarsComponent.data = envData
|
|
||||||
}
|
|
||||||
updatePreferredWidth()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updatePreferredWidth() {
|
|
||||||
val dialogWrapper = DialogWrapper.findInstance(panel)
|
|
||||||
if (dialogWrapper is SingleConfigurableEditor) {
|
|
||||||
// dialog for single run configuration
|
|
||||||
interpreterField.setPreferredWidthToFitText()
|
|
||||||
protractorPackageField.setPreferredWidthToFitText()
|
|
||||||
SwingHelper.setPreferredWidthToFitText(testFilePathTextFieldWithBrowseButton)
|
|
||||||
SwingHelper.setPreferredWidthToFitText(seleniumAddressTextField)
|
|
||||||
SwingHelper.setPreferredWidthToFitText(configPathTextFieldWithBrowseButton)
|
|
||||||
ApplicationManager.getApplication().invokeLater { SwingHelper.adjustDialogSizeToFitPreferredSize(dialogWrapper) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun applyEditorTo(runConfiguration: KotlinProtractorRunConfiguration) {
|
|
||||||
ProtractorUtil.setProtractorPackage(myProject, protractorPackageField.selected)
|
|
||||||
runConfiguration.runSettings = runConfiguration.runSettings.copy(
|
|
||||||
interpreterRef = interpreterField.interpreterRef,
|
|
||||||
configFilePath = configPathTextFieldWithBrowseButton.text,
|
|
||||||
testFilePath = testFilePathTextFieldWithBrowseButton.text,
|
|
||||||
seleniumAddress = seleniumAddressTextField.text,
|
|
||||||
extraOptions = extraOptionsEditor.text,
|
|
||||||
envData = envVarsComponent.data
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createEditor() = panel
|
|
||||||
}
|
|
||||||
-79
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.protractor
|
|
||||||
|
|
||||||
import com.intellij.execution.actions.CompatibleRunConfigurationProducer
|
|
||||||
import com.intellij.execution.actions.ConfigurationContext
|
|
||||||
import com.intellij.openapi.module.Module
|
|
||||||
import com.intellij.openapi.util.Ref
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationData
|
|
||||||
import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationDataProvider
|
|
||||||
import org.jetbrains.kotlin.idea.js.asJsModule
|
|
||||||
import org.jetbrains.kotlin.idea.js.jsTestOutputFilePath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.TestElementPath
|
|
||||||
import org.jetbrains.kotlin.idea.nodejs.getNodeJsEnvironmentVars
|
|
||||||
import org.jetbrains.kotlin.idea.run.addBuildTask
|
|
||||||
|
|
||||||
class ProtractorConfigData(
|
|
||||||
override val element: PsiElement,
|
|
||||||
override val module: Module,
|
|
||||||
override val jsOutputFilePath: String
|
|
||||||
) : KotlinJSRunConfigurationData
|
|
||||||
|
|
||||||
class KotlinProtractorRunConfigurationProducer :
|
|
||||||
CompatibleRunConfigurationProducer<KotlinProtractorRunConfiguration>(KotlinProtractorConfigurationType.getInstance()),
|
|
||||||
KotlinJSRunConfigurationDataProvider<ProtractorConfigData> {
|
|
||||||
override val isForTests: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
override fun getConfigurationData(
|
|
||||||
context: ConfigurationContext
|
|
||||||
): ProtractorConfigData? {
|
|
||||||
val module = context.module?.asJsModule() ?: return null
|
|
||||||
val element = context.psiLocation ?: return null
|
|
||||||
if (!TestElementPath.isModuleAssociatedDir(element, module)) return null
|
|
||||||
val testFilePath = module.jsTestOutputFilePath ?: return null
|
|
||||||
return ProtractorConfigData(element, module, testFilePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isConfigurationFromCompatibleContext(
|
|
||||||
configuration: KotlinProtractorRunConfiguration,
|
|
||||||
context: ConfigurationContext
|
|
||||||
): Boolean {
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
return configuration.runSettings.testFileSystemDependentPath == FileUtil.toSystemDependentName(configData.jsOutputFilePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setupConfigurationFromCompatibleContext(
|
|
||||||
configuration: KotlinProtractorRunConfiguration,
|
|
||||||
context: ConfigurationContext,
|
|
||||||
sourceElement: Ref<PsiElement>
|
|
||||||
): Boolean {
|
|
||||||
val element = context.psiLocation ?: return false
|
|
||||||
val configData = getConfigurationData(context) ?: return false
|
|
||||||
sourceElement.set(element)
|
|
||||||
configuration.runSettings = configuration.runSettings.copy(
|
|
||||||
testFilePath = configData.jsOutputFilePath,
|
|
||||||
envData = configData.module.getNodeJsEnvironmentVars(true)
|
|
||||||
)
|
|
||||||
configuration.name = configuration.suggestedName() ?: "Unknown"
|
|
||||||
configuration.addBuildTask()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-63
@@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.protractor
|
|
||||||
|
|
||||||
import com.intellij.execution.configuration.EnvironmentVariablesData
|
|
||||||
import com.intellij.javascript.nodejs.interpreter.NodeJsInterpreterRef
|
|
||||||
import com.intellij.openapi.util.JDOMExternalizerUtil.*
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
|
||||||
import org.jdom.Element
|
|
||||||
|
|
||||||
data class KotlinProtractorRunSettings(
|
|
||||||
val interpreterRef: NodeJsInterpreterRef = NodeJsInterpreterRef.createProjectRef(),
|
|
||||||
private val configFilePath: String = "",
|
|
||||||
private val testFilePath: String = "",
|
|
||||||
val seleniumAddress: String = "",
|
|
||||||
val extraOptions: String = "",
|
|
||||||
val envData: EnvironmentVariablesData = EnvironmentVariablesData.DEFAULT
|
|
||||||
) {
|
|
||||||
val configFileSystemDependentPath get() = FileUtil.toSystemDependentName(configFilePath)
|
|
||||||
val testFileSystemDependentPath get() = FileUtil.toSystemDependentName(testFilePath)
|
|
||||||
|
|
||||||
fun writeToXML(element: Element) {
|
|
||||||
addElementWithValueAttribute(element, "config-file", FileUtil.toSystemIndependentName(configFileSystemDependentPath))
|
|
||||||
addElementWithValueAttribute(element, "test-file", FileUtil.toSystemIndependentName(testFileSystemDependentPath))
|
|
||||||
addElementWithValueAttribute(element, "selenium-address", seleniumAddress)
|
|
||||||
addElementWithValueAttribute(element, "extra-protractor-options", extraOptions)
|
|
||||||
addElementWithValueAttribute(element, "node-interpreter", interpreterRef.referenceName)
|
|
||||||
envData.writeExternal(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun readFromXML(element: Element): KotlinProtractorRunSettings {
|
|
||||||
val configFilePath = getFirstChildValueAttribute(element, "config-file")
|
|
||||||
val testFilePath = getFirstChildValueAttribute(element, "test-file")
|
|
||||||
val seleniumAddress = getFirstChildValueAttribute(element, "selenium-address")
|
|
||||||
val extraOptions = getFirstChildValueAttribute(element, "extra-protractor-options")
|
|
||||||
val interpreterRefName = getFirstChildValueAttribute(element, "node-interpreter")
|
|
||||||
val envData = EnvironmentVariablesData.readExternal(element)
|
|
||||||
return KotlinProtractorRunSettings(
|
|
||||||
NodeJsInterpreterRef.create(interpreterRefName ?: "project"),
|
|
||||||
configFilePath ?: "",
|
|
||||||
testFilePath ?: "",
|
|
||||||
seleniumAddress ?: "",
|
|
||||||
extraOptions ?: "",
|
|
||||||
envData
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.nodejs.protractor
|
|
||||||
|
|
||||||
import com.intellij.execution.DefaultExecutionResult
|
|
||||||
import com.intellij.execution.ExecutionException
|
|
||||||
import com.intellij.execution.ExecutionResult
|
|
||||||
import com.intellij.execution.Executor
|
|
||||||
import com.intellij.execution.configurations.GeneralCommandLine
|
|
||||||
import com.intellij.execution.configurations.RunProfileState
|
|
||||||
import com.intellij.execution.process.ProcessHandler
|
|
||||||
import com.intellij.execution.process.ProcessTerminatedListener
|
|
||||||
import com.intellij.execution.runners.ExecutionEnvironment
|
|
||||||
import com.intellij.execution.testframework.TestConsoleProperties
|
|
||||||
import com.intellij.execution.testframework.autotest.ToggleAutoTestAction
|
|
||||||
import com.intellij.execution.testframework.sm.SMCustomMessagesParsing
|
|
||||||
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil
|
|
||||||
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties
|
|
||||||
import com.intellij.execution.testframework.sm.runner.SMTestLocator
|
|
||||||
import com.intellij.execution.ui.ConsoleView
|
|
||||||
import com.intellij.javascript.HelperFilesLocator
|
|
||||||
import com.intellij.javascript.nodejs.NodeCommandLineUtil
|
|
||||||
import com.intellij.javascript.nodejs.debug.NodeLocalDebugRunProfileState
|
|
||||||
import com.intellij.javascript.nodejs.interpreter.local.NodeJsLocalInterpreter
|
|
||||||
import com.intellij.javascript.nodejs.util.NodePackage
|
|
||||||
import com.intellij.javascript.protractor.ProtractorConsoleFilter
|
|
||||||
import com.intellij.javascript.protractor.ProtractorOutputToGeneralTestEventsConverter
|
|
||||||
import com.intellij.javascript.protractor.ProtractorUtil
|
|
||||||
import com.intellij.javascript.testFramework.navigation.JSTestLocationProvider
|
|
||||||
import com.intellij.lang.javascript.buildTools.base.JsbtUtil
|
|
||||||
import com.intellij.openapi.util.Disposer
|
|
||||||
import com.intellij.util.PathUtil
|
|
||||||
import com.intellij.util.execution.ParametersListUtil
|
|
||||||
import java.io.File
|
|
||||||
import java.io.IOException
|
|
||||||
import java.nio.charset.StandardCharsets
|
|
||||||
|
|
||||||
class KotlinProtractorRunState(
|
|
||||||
private val runConfiguration: KotlinProtractorRunConfiguration,
|
|
||||||
private val environment: ExecutionEnvironment,
|
|
||||||
private val protractorPackage: NodePackage
|
|
||||||
) : RunProfileState, NodeLocalDebugRunProfileState {
|
|
||||||
companion object {
|
|
||||||
val FRAMEWORK_NAME = "KotlinProtractorJavaScriptTestRunner"
|
|
||||||
private val INTELLIJ_CONFIG_FILE_PATH = "protractor-intellij/lib/protractor-intellij-config.js"
|
|
||||||
}
|
|
||||||
|
|
||||||
private val project = runConfiguration.project
|
|
||||||
private val runSettings = runConfiguration.runSettings
|
|
||||||
|
|
||||||
override fun execute(debugPort: Int): ExecutionResult {
|
|
||||||
val interpreter = runSettings.interpreterRef.resolveAsLocal(project)
|
|
||||||
val commandLine = createCommandLine(interpreter, debugPort)
|
|
||||||
val processHandler = NodeCommandLineUtil.createProcessHandler(commandLine, false)
|
|
||||||
val consoleView = createSmtRunnerConsoleView(commandLine.workDirectory)
|
|
||||||
ProcessTerminatedListener.attach(processHandler)
|
|
||||||
consoleView.attachToProcess(processHandler)
|
|
||||||
foldCommandLine(consoleView, processHandler)
|
|
||||||
val executionResult = DefaultExecutionResult(consoleView, processHandler)
|
|
||||||
executionResult.setRestartActions(ToggleAutoTestAction())
|
|
||||||
return executionResult
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createSmtRunnerConsoleView(workingDirectory: File?): ConsoleView {
|
|
||||||
val testConsoleProperties = ProtractorConsoleProperties(runConfiguration, environment.executor, JSTestLocationProvider())
|
|
||||||
val consoleView = SMTestRunnerConnectionUtil.createConsole(FRAMEWORK_NAME, testConsoleProperties)
|
|
||||||
consoleView.addMessageFilter(ProtractorConsoleFilter(project, workingDirectory))
|
|
||||||
Disposer.register(environment, consoleView)
|
|
||||||
return consoleView
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun foldCommandLine(consoleView: ConsoleView, processHandler: ProcessHandler) {
|
|
||||||
val configFileName = PathUtil.getFileName(runSettings.configFileSystemDependentPath)
|
|
||||||
val testFileName = PathUtil.getFileName(runSettings.testFileSystemDependentPath)
|
|
||||||
val seleniumAddress = runSettings.seleniumAddress
|
|
||||||
val parameters = ArrayList<String>().apply {
|
|
||||||
add("protractor")
|
|
||||||
if (configFileName.isNotBlank()) {
|
|
||||||
add(configFileName)
|
|
||||||
}
|
|
||||||
if (testFileName.isNotBlank()) {
|
|
||||||
add("--specs=$testFileName")
|
|
||||||
}
|
|
||||||
if (seleniumAddress.isNotBlank()) {
|
|
||||||
add("--seleniumAddress=$seleniumAddress")
|
|
||||||
}
|
|
||||||
addAll(ParametersListUtil.parse(runSettings.extraOptions.trim()))
|
|
||||||
}
|
|
||||||
val foldedCommandLine = ParametersListUtil.join(parameters)
|
|
||||||
JsbtUtil.foldCommandLine(consoleView, processHandler, foldedCommandLine)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createCommandLine(interpreter: NodeJsLocalInterpreter, debugPort: Int): GeneralCommandLine {
|
|
||||||
val commandLine = GeneralCommandLine().apply { charset = StandardCharsets.UTF_8 }
|
|
||||||
|
|
||||||
runSettings.envData.configureCommandLine(commandLine, true)
|
|
||||||
|
|
||||||
val originalConfigFilePath = runSettings.configFileSystemDependentPath
|
|
||||||
val testFilePath = runSettings.testFileSystemDependentPath
|
|
||||||
val seleniumAddress = runSettings.seleniumAddress
|
|
||||||
val withConfigFile = originalConfigFilePath.isNotBlank()
|
|
||||||
commandLine.setWorkDirectory(project.basePath)
|
|
||||||
|
|
||||||
commandLine.exePath = interpreter.interpreterSystemDependentPath
|
|
||||||
NodeCommandLineUtil.addNodeOptionsForDebugging(commandLine, emptyList(), debugPort, true, interpreter, true)
|
|
||||||
NodeCommandLineUtil.configureUsefulEnvironment(commandLine)
|
|
||||||
commandLine.addParameter(ProtractorUtil.getProtractorMainJsFile(protractorPackage).absolutePath)
|
|
||||||
|
|
||||||
val intellijConfigFile = try {
|
|
||||||
HelperFilesLocator.getFileRelativeToHelpersDir(INTELLIJ_CONFIG_FILE_PATH)
|
|
||||||
}
|
|
||||||
catch (e: IOException) {
|
|
||||||
throw ExecutionException("Cannot locate wrapper config file", e)
|
|
||||||
}
|
|
||||||
|
|
||||||
commandLine.addParameter(intellijConfigFile.absolutePath)
|
|
||||||
|
|
||||||
val actualConfigFilePath = if (withConfigFile) {
|
|
||||||
originalConfigFilePath
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
val tempConfigFile = File.createTempFile("protractor", "conf.js")
|
|
||||||
tempConfigFile.writeText("exports.config = {}")
|
|
||||||
tempConfigFile.absolutePath
|
|
||||||
}
|
|
||||||
|
|
||||||
commandLine.addParameter("--intellijOriginalConfigFile=$actualConfigFilePath")
|
|
||||||
|
|
||||||
if (testFilePath.isNotBlank()) {
|
|
||||||
commandLine.addParameter("--specs=$testFilePath")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seleniumAddress.isNotBlank()) {
|
|
||||||
commandLine.addParameter("--seleniumAddress=$seleniumAddress")
|
|
||||||
}
|
|
||||||
|
|
||||||
commandLine.addParameters(ParametersListUtil.parse(runSettings.extraOptions.trim()))
|
|
||||||
|
|
||||||
commandLine.addParameter("--disableChecks")
|
|
||||||
|
|
||||||
return commandLine
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ProtractorConsoleProperties(
|
|
||||||
configuration: KotlinProtractorRunConfiguration,
|
|
||||||
executor: Executor,
|
|
||||||
private val myLocator: SMTestLocator
|
|
||||||
) : SMTRunnerConsoleProperties(configuration, FRAMEWORK_NAME, executor), SMCustomMessagesParsing {
|
|
||||||
init {
|
|
||||||
isUsePredefinedMessageFilter = false
|
|
||||||
setIfUndefined(TestConsoleProperties.HIDE_PASSED_TESTS, false)
|
|
||||||
setIfUndefined(TestConsoleProperties.HIDE_IGNORED_TEST, true)
|
|
||||||
setIfUndefined(TestConsoleProperties.SCROLL_TO_SOURCE, true)
|
|
||||||
setIfUndefined(TestConsoleProperties.SELECT_FIRST_DEFECT, true)
|
|
||||||
isIdBasedTestTree = true
|
|
||||||
isPrintTestingStartedTime = false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getTestLocator() = myLocator
|
|
||||||
|
|
||||||
override fun createTestEventsConverter(testFrameworkName: String, consoleProperties: TestConsoleProperties) =
|
|
||||||
ProtractorOutputToGeneralTestEventsConverter(testFrameworkName, consoleProperties.isEditable)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-10
@@ -1,10 +0,0 @@
|
|||||||
<problems>
|
|
||||||
<problem>
|
|
||||||
<file>test.kt</file>
|
|
||||||
<line>9</line>
|
|
||||||
<module>light_idea_test_case</module>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowired members defined in invalid Spring bean (Kotlin)</problem_class>
|
|
||||||
<description>Autowired members must be defined in valid Spring bean (@Component|@Service|...)</description>
|
|
||||||
</problem>
|
|
||||||
</problems>
|
|
||||||
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
// INSPECTION_CLASS: com.intellij.spring.model.highlighting.autowire.SpringUastAutowiredMembersInspection
|
|
||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.web.context.support.SpringBeanAutowiringSupport
|
|
||||||
|
|
||||||
open class KtBean1 {
|
|
||||||
@Autowired var foo: Int = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class KtBean2 {
|
|
||||||
@Autowired var foo: Int = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
open class KtBean3 : SpringBeanAutowiringSupport() {
|
|
||||||
@Autowired var foo: Int = 1
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
open class InvalidAutowiredByTypeQualifiers
|
|
||||||
|
|
||||||
abstract class AbstractBarBean
|
|
||||||
@Component
|
|
||||||
open class BarBean1 : AbstractBarBean()
|
|
||||||
@Component
|
|
||||||
open class BarBean2 : AbstractBarBean()
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class IncompleteClassAutowiring() {
|
|
||||||
@Autowired
|
|
||||||
lateinit var : String
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<problems>
|
|
||||||
<problem>
|
|
||||||
<file>invalidAutowiredResource.kt</file>
|
|
||||||
<line>24</line>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/mismatchedType/mismatchedType.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description>Could not autowire. Bean should be of 'invalidAutowiredResource.BarBean' type</description>
|
|
||||||
</problem>
|
|
||||||
<problem>
|
|
||||||
<file>invalidAutowiredResource.kt</file>
|
|
||||||
<line>31</line>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/invalidAutowiredResource/invalidAutowiredResource.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description>Cannot resolve bean 'fooBeannn'</description>
|
|
||||||
</problem>
|
|
||||||
|
|
||||||
<problem>
|
|
||||||
<file>invalidAutowiredQualifier.kt</file>
|
|
||||||
<line>23</line>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/invalidAutowiredQualifier/invalidAutowiredQualifier.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description>Could not autowire. Qualified bean must be of 'BarBean' type.</description>
|
|
||||||
</problem>
|
|
||||||
<problem>
|
|
||||||
<file>invalidAutowiredQualifier.kt</file>
|
|
||||||
<line>30</line>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/invalidAutowiredQualifier/invalidAutowiredQualifier.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description>Cannot find bean with qualifier 'fooBeannn'</description>
|
|
||||||
</problem>
|
|
||||||
<problem>
|
|
||||||
<file>invalidAutowiredQualifier.kt</file>
|
|
||||||
<line>37</line>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/invalidAutowiredQualifier/invalidAutowiredQualifier.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description>Cannot find bean qualified with @Qualifier</description>
|
|
||||||
</problem>
|
|
||||||
|
|
||||||
<problem>
|
|
||||||
<file>invalidAutowiredByType.kt</file>
|
|
||||||
<line>23</line>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/invalidAutowiredByType/invalidAutowiredByType.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description>Could not autowire. No beans of 'String' type found.</description>
|
|
||||||
</problem>
|
|
||||||
<problem>
|
|
||||||
<file>invalidAutowiredByType.kt</file>
|
|
||||||
<line>29</line>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/invalidAutowiredByType/invalidAutowiredByType.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Autowiring for Bean Class (Kotlin)</problem_class>
|
|
||||||
<description><html><table><tr><td>Could not autowire. There is more than one bean of 'AbstractBarBean' type.</td></tr><tr><td><table><tr><td valign='top'>Beans:</td><td>abstractBarBean&nbsp;&nbsp; (invalidAutowiredByType.kt)<br>barBean1&nbsp;&nbsp; (invalidAutowiredByType.kt)<br>barBean2&nbsp;&nbsp; (invalidAutowiredByType.kt)<br></td></tr></table></td></tr></table></html></description>
|
|
||||||
</problem>
|
|
||||||
</problems>
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
// INSPECTION_CLASS: com.intellij.spring.model.highlighting.autowire.SpringUastInjectionPointsAutowiringInspection
|
|
||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// CONFIGURE_SPRING_FILE_SET
|
|
||||||
// RUNTIME_WITH_FULL_JDK
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
open class InvalidAutowiredByTypeQualifiers
|
|
||||||
|
|
||||||
abstract class AbstractBarBean
|
|
||||||
@Component
|
|
||||||
open class BarBean1 : AbstractBarBean()
|
|
||||||
@Component
|
|
||||||
open class BarBean2 : AbstractBarBean()
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class NoAutowiredCandidates() {
|
|
||||||
@Autowired
|
|
||||||
lateinit var bean: String
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class MultipleAutowiredCandidates() {
|
|
||||||
@Autowired
|
|
||||||
lateinit var bean: AbstractBarBean
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
open class MismatchedTypes
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class FooBean
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class BarBean
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class MismatchedType() {
|
|
||||||
@Autowired
|
|
||||||
@Qualifier("fooBean")
|
|
||||||
lateinit var bean1: BarBean
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class UnresolvedBeanRef() {
|
|
||||||
@Autowired
|
|
||||||
@Qualifier("fooBeannn")
|
|
||||||
lateinit var bean1: FooBean
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class NamelessQualifier() {
|
|
||||||
@Autowired
|
|
||||||
@Qualifier
|
|
||||||
lateinit var bean1: FooBean
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
// FULL_JDK
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import javax.annotation.Resource
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
open class MismatchedTypes
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class FooBean
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class BarBean
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class MismatchedType() {
|
|
||||||
@Autowired
|
|
||||||
@Resource(name = "fooBean")
|
|
||||||
lateinit var bean1: BarBean
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class UnresolvedBeanRef() {
|
|
||||||
@Autowired
|
|
||||||
@Resource(name = "fooBeannn")
|
|
||||||
lateinit var bean1: FooBean
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
open class ParameterlessFunctions
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class ParameterlessFunction {
|
|
||||||
@Autowired fun foo() = 1
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package foo
|
|
||||||
|
|
||||||
// Make PsiPackage not empty
|
|
||||||
fun dummyFun() {
|
|
||||||
|
|
||||||
}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
<problems>
|
|
||||||
<problem>
|
|
||||||
<file>test.kt</file>
|
|
||||||
<line>14</line>
|
|
||||||
<package><default></package>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/test/test.kt" />
|
|
||||||
<problem_class severity="ERROR" attribute_key="WRONG_REFERENCES_ATTRIBUTES">@ComponentScan setup</problem_class>
|
|
||||||
<description>Cannot resolve symbol 'bar'</description>
|
|
||||||
</problem>
|
|
||||||
<problem>
|
|
||||||
<file>test.kt</file>
|
|
||||||
<line>18</line>
|
|
||||||
<package><default></package>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/test/test.kt" />
|
|
||||||
<problem_class severity="ERROR" attribute_key="WRONG_REFERENCES_ATTRIBUTES">@ComponentScan setup</problem_class>
|
|
||||||
<description>Cannot resolve symbol 'bar'</description>
|
|
||||||
</problem>
|
|
||||||
</problems>
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
// INSPECTION_CLASS: com.intellij.spring.model.highlighting.jam.SpringComponentScanInspection
|
|
||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// CONFIGURE_SPRING_FILE_SET
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("foo"))
|
|
||||||
open class App1
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("foo", "bar"))
|
|
||||||
open class App2
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("bar"))
|
|
||||||
open class App3
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
<problems>
|
|
||||||
<problem>
|
|
||||||
<file>test.kt</file>
|
|
||||||
<line>12</line>
|
|
||||||
<module>light_idea_test_case</module>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Spring Facet Code Configuration (Kotlin)</problem_class>
|
|
||||||
<description>Application context not configured for this file</description>
|
|
||||||
</problem>
|
|
||||||
<problem>
|
|
||||||
<file>test.kt</file>
|
|
||||||
<line>15</line>
|
|
||||||
<module>light_idea_test_case</module>
|
|
||||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
|
||||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Spring Facet Code Configuration (Kotlin)</problem_class>
|
|
||||||
<description>Application context not configured for this file</description>
|
|
||||||
</problem>
|
|
||||||
</problems>
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
// INSPECTION_CLASS: com.intellij.spring.model.highlighting.config.SpringFacetUastInspection
|
|
||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// FORBID_SPRING_FILE_SET_AUTOCONFIGURE
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
// WITH_RUNTIME
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
annotation class MyConfiguration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
class Application1
|
|
||||||
|
|
||||||
@MyConfiguration
|
|
||||||
class Application2
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
com.intellij.spring.model.highlighting.autowire.SpringUastInjectionPointsAutowiringInspection
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
// "Add qualifier" "true"
|
|
||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// CONFIGURE_SPRING_FILE_SET
|
|
||||||
// WITH_RUNTIME
|
|
||||||
// DISABLE-ERRORS
|
|
||||||
// FORCE_PACKAGE_FOLDER
|
|
||||||
|
|
||||||
package pkg
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
open class InvalidAutowiredByTypeQualifiers
|
|
||||||
|
|
||||||
abstract class BaseBarBean
|
|
||||||
@Component
|
|
||||||
open class BarBean1 : BaseBarBean()
|
|
||||||
@Component
|
|
||||||
open class BarBean2 : BaseBarBean()
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class MultipleAutowiredCandidates() {
|
|
||||||
@Autowired
|
|
||||||
lateinit var <caret>bean: BaseBarBean
|
|
||||||
}
|
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
// "Add qualifier" "true"
|
|
||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// CONFIGURE_SPRING_FILE_SET
|
|
||||||
// WITH_RUNTIME
|
|
||||||
// DISABLE-ERRORS
|
|
||||||
// FORCE_PACKAGE_FOLDER
|
|
||||||
|
|
||||||
package pkg
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.stereotype.Component
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan
|
|
||||||
open class InvalidAutowiredByTypeQualifiers
|
|
||||||
|
|
||||||
abstract class BaseBarBean
|
|
||||||
@Component
|
|
||||||
open class BarBean1 : BaseBarBean()
|
|
||||||
@Component
|
|
||||||
open class BarBean2 : BaseBarBean()
|
|
||||||
|
|
||||||
@Component
|
|
||||||
open class MultipleAutowiredCandidates() {
|
|
||||||
@Qualifier("barBean1")
|
|
||||||
@Autowired
|
|
||||||
lateinit var bean: BaseBarBean
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
<bean class="a.KotlinSpringBean" name="xmlKotlinBean"/>
|
|
||||||
</beans>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtClass
|
|
||||||
// OPTIONS: usages
|
|
||||||
package a
|
|
||||||
|
|
||||||
class <caret>KotlinSpringBean
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Usage in XML descriptor 5 <bean class="a.KotlinSpringBean" name="xmlKotlinBean"/>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
<bean class="a.KotlinSpringBean" name="xmlKotlinBean">
|
|
||||||
<constructor-arg name="value" value="2"/>
|
|
||||||
<property name="value"/>
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
|
|
||||||
// OPTIONS: usages
|
|
||||||
package a
|
|
||||||
|
|
||||||
class KotlinSpringBean(var <caret>value: Int)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
Usage in XML descriptor 6 <constructor-arg name="value" value="2"/>
|
|
||||||
Usage in XML descriptor 7 <property name="value"/>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
<bean class="a.KotlinSpringBean" name="xmlKotlinBean">
|
|
||||||
<property name="foo"/>
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtProperty
|
|
||||||
// OPTIONS: usages
|
|
||||||
package a
|
|
||||||
|
|
||||||
class KotlinSpringBean {
|
|
||||||
var <caret>foo: Int = 1
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Usage in XML descriptor 6 <property name="foo"/>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
<bean class="a.KotlinSpringBean" name="xmlKotlinBean">
|
|
||||||
<property name="bar"/>
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
|
||||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
|
|
||||||
// OPTIONS: usages
|
|
||||||
package a
|
|
||||||
|
|
||||||
class KotlinSpringBean {
|
|
||||||
fun <caret>setBar(value: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Usage in XML descriptor 6 <property name="bar"/>
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
// ELEMENT: lang
|
|
||||||
// CHAR: \n
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("java.la<caret>ng"))
|
|
||||||
open class App {
|
|
||||||
|
|
||||||
}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
// ELEMENT: lang
|
|
||||||
// CHAR: \n
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("java.langng"))
|
|
||||||
open class App {
|
|
||||||
|
|
||||||
}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
// ELEMENT: lang
|
|
||||||
// CHAR: \t
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("java.la<caret>ng"))
|
|
||||||
open class App {
|
|
||||||
|
|
||||||
}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
// ELEMENT: lang
|
|
||||||
// CHAR: \t
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("java.lang"))
|
|
||||||
open class App {
|
|
||||||
|
|
||||||
}
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
// ELEMENT: existingBean1
|
|
||||||
// CHAR: \n
|
|
||||||
package bean
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
class MultiHolder(var thing: String)
|
|
||||||
|
|
||||||
class AutoMultiUser() {
|
|
||||||
@Qualifier("exist<caret>ing") @Autowired lateinit var multi1: MultiHolder
|
|
||||||
}
|
|
||||||
Vendored
-12
@@ -1,12 +0,0 @@
|
|||||||
// ELEMENT: existingBean1
|
|
||||||
// CHAR: \n
|
|
||||||
package bean
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
class MultiHolder(var thing: String)
|
|
||||||
|
|
||||||
class AutoMultiUser() {
|
|
||||||
@Qualifier("existingBean1ing") @Autowired lateinit var multi1: MultiHolder
|
|
||||||
}
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
// ELEMENT: existingBean1
|
|
||||||
// CHAR: \t
|
|
||||||
package bean
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
class MultiHolder(var thing: String)
|
|
||||||
|
|
||||||
class AutoMultiUser() {
|
|
||||||
@Qualifier("exist<caret>ing") @Autowired lateinit var multi1: MultiHolder
|
|
||||||
}
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
// ELEMENT: existingBean1
|
|
||||||
// CHAR: \t
|
|
||||||
package bean
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
class MultiHolder(var thing: String)
|
|
||||||
|
|
||||||
class AutoMultiUser() {
|
|
||||||
@Qualifier("existingBean1") @Autowired lateinit var multi1: MultiHolder
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// ELEMENT: singleton
|
|
||||||
package test
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Scope
|
|
||||||
|
|
||||||
@Scope("<caret>")
|
|
||||||
class ScopedBean
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
// ELEMENT: singleton
|
|
||||||
package test
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Scope
|
|
||||||
|
|
||||||
@Scope("singleton")
|
|
||||||
class ScopedBean
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="java.lang.String"/>
|
|
||||||
<bean id="barBean" class="java.lang.String"/>
|
|
||||||
<bean id="scopedBean" class="test.ScopedBean"/>
|
|
||||||
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean1">
|
|
||||||
<constructor-arg name="thing" value="1"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean2">
|
|
||||||
<constructor-arg name="thing" value="2"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="anotherBean">
|
|
||||||
<constructor-arg name="thing" value="0"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.AutoMultiUser" name="existingBean3">
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
// ELEMENT: fooBean
|
|
||||||
// CHAR: \n
|
|
||||||
import org.springframework.beans.factory.BeanFactory
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory
|
|
||||||
import org.springframework.core.io.FileSystemResource
|
|
||||||
import org.springframework.core.io.Resource
|
|
||||||
|
|
||||||
class FooBeanClass {
|
|
||||||
init {
|
|
||||||
val configFile = FileSystemResource("spring-config.xml")
|
|
||||||
val factory = XmlBeanFactory(configFile)
|
|
||||||
factory.getBean("fo<caret>o")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-14
@@ -1,14 +0,0 @@
|
|||||||
// ELEMENT: fooBean
|
|
||||||
// CHAR: \n
|
|
||||||
import org.springframework.beans.factory.BeanFactory
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory
|
|
||||||
import org.springframework.core.io.FileSystemResource
|
|
||||||
import org.springframework.core.io.Resource
|
|
||||||
|
|
||||||
class FooBeanClass {
|
|
||||||
init {
|
|
||||||
val configFile = FileSystemResource("spring-config.xml")
|
|
||||||
val factory = XmlBeanFactory(configFile)
|
|
||||||
factory.getBean("fooBeano")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
// ELEMENT: fooBean
|
|
||||||
// CHAR: \t
|
|
||||||
import org.springframework.beans.factory.BeanFactory
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory
|
|
||||||
import org.springframework.core.io.FileSystemResource
|
|
||||||
import org.springframework.core.io.Resource
|
|
||||||
|
|
||||||
class FooBeanClass {
|
|
||||||
init {
|
|
||||||
val configFile = FileSystemResource("spring-config.xml")
|
|
||||||
val factory = XmlBeanFactory(configFile)
|
|
||||||
factory.getBean("fo<caret>o")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-14
@@ -1,14 +0,0 @@
|
|||||||
// ELEMENT: fooBean
|
|
||||||
// CHAR: \t
|
|
||||||
import org.springframework.beans.factory.BeanFactory
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory
|
|
||||||
import org.springframework.core.io.FileSystemResource
|
|
||||||
import org.springframework.core.io.Resource
|
|
||||||
|
|
||||||
class FooBeanClass {
|
|
||||||
init {
|
|
||||||
val configFile = FileSystemResource("spring-config.xml")
|
|
||||||
val factory = XmlBeanFactory(configFile)
|
|
||||||
factory.getBean("fooBean")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
// NUMBER: 1
|
|
||||||
// EXIST: { lookupString:"buildBar" }
|
|
||||||
|
|
||||||
package a
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.context.annotation.Bean
|
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
|
||||||
|
|
||||||
class FooBean
|
|
||||||
class BarBean
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
open class KotlinAnnotated {
|
|
||||||
@Bean(name=arrayOf("annFooBean")) open fun buildFoo(): FooBean = FooBean()
|
|
||||||
@Bean open fun buildBar(): BarBean = BarBean()
|
|
||||||
}
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
fun test() {
|
|
||||||
val context = AnnotationConfigApplicationContext("a");
|
|
||||||
context.getBean("build<caret>")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
// NUMBER: 2
|
|
||||||
// EXIST: { lookupString:"annFooBean" }
|
|
||||||
// EXIST: { lookupString:"kotlinAnnotated" }
|
|
||||||
|
|
||||||
package a
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
import org.springframework.context.annotation.Bean
|
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
|
||||||
|
|
||||||
class FooBean
|
|
||||||
class BarBean
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
open class KotlinAnnotated {
|
|
||||||
@Bean(name=arrayOf("annFooBean")) open fun buildFoo(): FooBean = FooBean()
|
|
||||||
@Bean open fun buildBar(): BarBean = BarBean()
|
|
||||||
}
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
fun test() {
|
|
||||||
val context = AnnotationConfigApplicationContext("a");
|
|
||||||
context.getBean("ann<caret>")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
// NUMBER: 3
|
|
||||||
// EXIST: { lookupString:"lang" }
|
|
||||||
// EXIST: { lookupString:"util" }
|
|
||||||
// EXIST: { lookupString:"sql" }
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("java.l<caret>ang"))
|
|
||||||
open class App {
|
|
||||||
|
|
||||||
}
|
|
||||||
Vendored
-16
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean1">
|
|
||||||
<constructor-arg name="thing" value="1"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean2">
|
|
||||||
<constructor-arg name="thing" value="2"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="anotherBean">
|
|
||||||
<constructor-arg name="thing" value="0"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.AutoMultiUser" name="existingBean3">
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
// NUMBER: 3
|
|
||||||
// EXIST: { lookupString:"anotherBean" }
|
|
||||||
// EXIST: { lookupString:"existingBean1" }
|
|
||||||
// EXIST: { lookupString:"existingBean2" }
|
|
||||||
|
|
||||||
package bean
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
class MultiHolder(var thing: String)
|
|
||||||
|
|
||||||
class AutoMultiUser() {
|
|
||||||
@Qualifier("<caret>existingBean1") @Autowired lateinit var multi1: MultiHolder
|
|
||||||
}
|
|
||||||
Vendored
-16
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean1">
|
|
||||||
<constructor-arg name="thing" value="1"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean2">
|
|
||||||
<constructor-arg name="thing" value="2"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="anotherBean">
|
|
||||||
<constructor-arg name="thing" value="0"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.AutoMultiUser" name="existingBean3">
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
// NUMBER: 2
|
|
||||||
// EXIST: { lookupString:"existingBean1" }
|
|
||||||
// EXIST: { lookupString:"existingBean2" }
|
|
||||||
|
|
||||||
package bean
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
class MultiHolder(var thing: String)
|
|
||||||
|
|
||||||
class AutoMultiUser() {
|
|
||||||
@Qualifier("existing<caret>Bean2") @Autowired lateinit var multi2: MultiHolder
|
|
||||||
}
|
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="java.lang.String"/>
|
|
||||||
<bean id="fooBean2" class="java.lang.String"/>
|
|
||||||
<bean id="barBean" class="java.lang.String"/>
|
|
||||||
<bean id="scopedBean" class="test.ScopedBean"/>
|
|
||||||
</beans>
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
// NUMBER: 2
|
|
||||||
// EXIST: { lookupString:"singleton" }
|
|
||||||
// EXIST: { lookupString:"prototype" }
|
|
||||||
package test
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Scope
|
|
||||||
|
|
||||||
@Scope("<caret>")
|
|
||||||
class ScopedBean
|
|
||||||
Vendored
-8
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="java.lang.String"/>
|
|
||||||
<bean id="fooBean2" class="java.lang.String"/>
|
|
||||||
<bean id="barBean" class="java.lang.String"/>
|
|
||||||
<bean id="scopedBean" class="test.ScopedBean"/>
|
|
||||||
</beans>
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
// NUMBER: 2
|
|
||||||
// EXIST: { lookupString:"fooBean" }
|
|
||||||
// EXIST: { lookupString:"fooBean2" }
|
|
||||||
import org.springframework.beans.factory.BeanFactory
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory
|
|
||||||
import org.springframework.core.io.FileSystemResource
|
|
||||||
import org.springframework.core.io.Resource
|
|
||||||
|
|
||||||
class FooBeanClass {
|
|
||||||
init {
|
|
||||||
val configFile = FileSystemResource("spring-config.xml")
|
|
||||||
val factory = XmlBeanFactory(configFile)
|
|
||||||
factory.getBean("fo<caret>o")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
// NO_XML_CONFIG
|
|
||||||
// REF: /src.fileReferenceInClasspathResource.test.xml
|
|
||||||
import org.springframework.core.io.ClassPathResource
|
|
||||||
|
|
||||||
class Bean {
|
|
||||||
init {
|
|
||||||
ClassPathResource("<caret>fileReferenceInClasspathResource.test.xml")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
<test>
|
|
||||||
<foo/>
|
|
||||||
</test>
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
// NO_XML_CONFIG
|
|
||||||
// REF: /src.fileReferenceInClasspathXmlContext.test.xml
|
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext
|
|
||||||
|
|
||||||
class Bean {
|
|
||||||
init {
|
|
||||||
ClassPathXmlApplicationContext("<caret>fileReferenceInClasspathXmlContext.test.xml")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
<test>
|
|
||||||
<foo/>
|
|
||||||
</test>
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
// NO_XML_CONFIG
|
|
||||||
// REF: java
|
|
||||||
// REF: java.java
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan
|
|
||||||
import org.springframework.context.annotation.Configuration
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ComponentScan(basePackages = arrayOf("<caret>java"))
|
|
||||||
open class App {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// REF: <bean class="bean.MultiHolder" name="existingBean1">\n <constructor-arg name="thing" value="1"/>\n </bean>
|
|
||||||
package bean
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier
|
|
||||||
|
|
||||||
class MultiHolder(var thing: String)
|
|
||||||
|
|
||||||
class AutoMultiUser() {
|
|
||||||
@Qualifier("<caret>existingBean1") @Autowired lateinit var multi1: MultiHolder
|
|
||||||
}
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean1">
|
|
||||||
<constructor-arg name="thing" value="1"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="existingBean2">
|
|
||||||
<constructor-arg name="thing" value="2"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.MultiHolder" name="anotherBean">
|
|
||||||
<constructor-arg name="thing" value="0"/>
|
|
||||||
</bean>
|
|
||||||
<bean class="bean.AutoMultiUser" name="existingBean3">
|
|
||||||
</bean>
|
|
||||||
</beans>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// REF: singleton
|
|
||||||
package test
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Scope
|
|
||||||
|
|
||||||
@Scope("<caret>singleton")
|
|
||||||
class Bean
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="test.Bean"/>
|
|
||||||
</beans>
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
// REF: <bean id="fooBean" class="java.lang.String"/>
|
|
||||||
import org.springframework.beans.factory.BeanFactory
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory
|
|
||||||
import org.springframework.core.io.FileSystemResource
|
|
||||||
import org.springframework.core.io.Resource
|
|
||||||
|
|
||||||
class FooBeanClass {
|
|
||||||
init {
|
|
||||||
val configFile = FileSystemResource("spring-config.xml")
|
|
||||||
val factory = XmlBeanFactory(configFile)
|
|
||||||
if (factory.containsBean("<caret>fooBean")) println("FooBean")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="java.lang.String"/>
|
|
||||||
</beans>
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
// REF: <bean id="fooBean" class="java.lang.String"/>
|
|
||||||
import org.springframework.beans.factory.BeanFactory
|
|
||||||
import org.springframework.beans.factory.xml.XmlBeanFactory
|
|
||||||
import org.springframework.core.io.FileSystemResource
|
|
||||||
import org.springframework.core.io.Resource
|
|
||||||
|
|
||||||
class FooBeanClass {
|
|
||||||
init {
|
|
||||||
val configFile = FileSystemResource("spring-config.xml")
|
|
||||||
val factory = XmlBeanFactory(configFile)
|
|
||||||
factory.getBean("<caret>fooBean")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="java.lang.String"/>
|
|
||||||
</beans>
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
// JAVAX_ANNOTATION_RESOURCE
|
|
||||||
// REF: <bean id="fooBean" class="test.Bean"/>
|
|
||||||
package test
|
|
||||||
|
|
||||||
import javax.annotation.Resource
|
|
||||||
|
|
||||||
class Bean
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
@Resource(name= "<caret>fooBean") lateinit var name: String
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="test.Bean"/>
|
|
||||||
</beans>
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
// JAVAX_ANNOTATION_RESOURCE
|
|
||||||
// REF: <bean id="fooBean" class="test.Bean"/>
|
|
||||||
package test
|
|
||||||
|
|
||||||
import javax.annotation.Resource
|
|
||||||
|
|
||||||
class Bean
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
@Resource(name= "<caret>&fooBean") lateinit var name: String
|
|
||||||
}
|
|
||||||
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
||||||
<beans>
|
|
||||||
<bean id="fooBean" class="test.Bean"/>
|
|
||||||
</beans>
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
package bean;
|
|
||||||
|
|
||||||
public class BeanA {
|
|
||||||
}
|
|
||||||
Vendored
-8
@@ -1,8 +0,0 @@
|
|||||||
package bean;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
|
|
||||||
public class JavaRef {
|
|
||||||
@Value("#{ nameJ }") private BeanA valueA;
|
|
||||||
@Value("#{ nameK2 }") private BeanA valueK;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user