idea: cleanup code
This commit is contained in:
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* Copyright 2010-2019 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.maven
|
||||
@@ -127,7 +116,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
private fun scheduleDownloadStdlibSources(mavenProject: MavenProject, module: Module) {
|
||||
// TODO: here we have to process all kotlin libraries but for now we only handle standard libraries
|
||||
val artifacts = mavenProject.dependencyArtifactIndex.data[KOTLIN_PLUGIN_GROUP_ID]?.values?.flatMap { it.filter { it.isResolved } }
|
||||
?: emptyList()
|
||||
?: emptyList()
|
||||
|
||||
val librariesWithNoSources = ArrayList<Library>()
|
||||
OrderEnumerator.orderEntries(module).forEachLibrary { library ->
|
||||
@@ -164,13 +153,16 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
val explicitOutputFile = it.configurationElement?.getChild("outputFile")?.text ?: sharedOutputFile
|
||||
if (PomFile.KotlinGoals.Js in it.goals) {
|
||||
// see org.jetbrains.kotlin.maven.K2JSCompilerMojo
|
||||
val outputFilePath = PathUtil.toSystemDependentName(explicitOutputFile ?: "$buildDirectory/js/${mavenProject.mavenId.artifactId}.js")
|
||||
val outputFilePath =
|
||||
PathUtil.toSystemDependentName(explicitOutputFile ?: "$buildDirectory/js/${mavenProject.mavenId.artifactId}.js")
|
||||
compilerModuleExtension.setCompilerOutputPath(parentPath(outputFilePath))
|
||||
facetSettings.productionOutputPath = outputFilePath
|
||||
}
|
||||
if (PomFile.KotlinGoals.TestJs in it.goals) {
|
||||
// see org.jetbrains.kotlin.maven.KotlinTestJSCompilerMojo
|
||||
val outputFilePath = PathUtil.toSystemDependentName(explicitOutputFile ?: "$buildDirectory/test-js/${mavenProject.mavenId.artifactId}-tests.js")
|
||||
val outputFilePath = PathUtil.toSystemDependentName(
|
||||
explicitOutputFile ?: "$buildDirectory/test-js/${mavenProject.mavenId.artifactId}-tests.js"
|
||||
)
|
||||
compilerModuleExtension.setCompilerOutputPathForTests(parentPath(outputFilePath))
|
||||
facetSettings.testOutputPath = outputFilePath
|
||||
}
|
||||
@@ -184,10 +176,10 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
): List<String> {
|
||||
val arguments = platform.createArguments()
|
||||
|
||||
arguments.apiVersion = configuration?.getChild("apiVersion")?.text ?:
|
||||
mavenProject.properties["kotlin.compiler.apiVersion"]?.toString()
|
||||
arguments.languageVersion = configuration?.getChild("languageVersion")?.text ?:
|
||||
mavenProject.properties["kotlin.compiler.languageVersion"]?.toString()
|
||||
arguments.apiVersion =
|
||||
configuration?.getChild("apiVersion")?.text ?: mavenProject.properties["kotlin.compiler.apiVersion"]?.toString()
|
||||
arguments.languageVersion =
|
||||
configuration?.getChild("languageVersion")?.text ?: mavenProject.properties["kotlin.compiler.languageVersion"]?.toString()
|
||||
arguments.multiPlatform = configuration?.getChild("multiPlatform")?.text?.trim()?.toBoolean() ?: false
|
||||
arguments.suppressWarnings = configuration?.getChild("nowarn")?.text?.trim()?.toBoolean() ?: false
|
||||
|
||||
@@ -199,8 +191,8 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
is K2JVMCompilerArguments -> {
|
||||
arguments.classpath = configuration?.getChild("classpath")?.text
|
||||
arguments.jdkHome = configuration?.getChild("jdkHome")?.text
|
||||
arguments.jvmTarget = configuration?.getChild("jvmTarget")?.text ?:
|
||||
mavenProject.properties["kotlin.compiler.jvmTarget"]?.toString()
|
||||
arguments.jvmTarget =
|
||||
configuration?.getChild("jvmTarget")?.text ?: mavenProject.properties["kotlin.compiler.jvmTarget"]?.toString()
|
||||
arguments.javaParameters = configuration?.getChild("javaParameters")?.text?.toBoolean() ?: false
|
||||
}
|
||||
is K2JSCompilerArguments -> {
|
||||
@@ -266,7 +258,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
val configuration = mavenPlugin.configurationElement
|
||||
val sharedArguments = getCompilerArgumentsByConfigurationElement(mavenProject, configuration, configuredPlatform)
|
||||
val executionArguments = mavenPlugin.executions
|
||||
?.firstOrNull { it.goals.any { it in compilationGoals } }
|
||||
?.firstOrNull { it.goals.any { s -> s in compilationGoals } }
|
||||
?.configurationElement?.let { getCompilerArgumentsByConfigurationElement(mavenProject, it, configuredPlatform) }
|
||||
parseCompilerArgumentsToFacet(sharedArguments, emptyList(), kotlinFacet, modifiableModelsProvider)
|
||||
if (executionArguments != null) {
|
||||
@@ -338,7 +330,8 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
.any { it in PomFile.KotlinGoals.CompileGoals && it !in PomFile.KotlinGoals.JvmGoals }
|
||||
|
||||
val prodSourceRootType: JpsModuleSourceRootType<*> = if (isNonJvmModule) SourceKotlinRootType else JavaSourceRootType.SOURCE
|
||||
val testSourceRootType: JpsModuleSourceRootType<*> = if (isNonJvmModule) TestSourceKotlinRootType else JavaSourceRootType.TEST_SOURCE
|
||||
val testSourceRootType: JpsModuleSourceRootType<*> =
|
||||
if (isNonJvmModule) TestSourceKotlinRootType else JavaSourceRootType.TEST_SOURCE
|
||||
|
||||
for ((type, dir) in directories) {
|
||||
if (rootModel.getSourceFolder(File(dir)) == null) {
|
||||
@@ -392,7 +385,7 @@ private fun MavenPlugin.isKotlinPlugin() =
|
||||
|
||||
private fun Element?.sourceDirectories(): List<String> =
|
||||
this?.getChildren(KotlinMavenImporter.KOTLIN_PLUGIN_SOURCE_DIRS_CONFIG)?.flatMap { it.children ?: emptyList() }?.map { it.textTrim }
|
||||
?: emptyList()
|
||||
?: emptyList()
|
||||
|
||||
private fun MavenPlugin.Execution.sourceType() =
|
||||
goals.map { if (isTestGoalName(it)) SourceType.TEST else SourceType.PROD }
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* Copyright 2010-2019 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.maven
|
||||
@@ -24,11 +13,13 @@ import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
|
||||
class MavenLanguageVersionsCompletionProvider : MavenFixedValueReferenceProvider(
|
||||
LanguageVersion.values().filter { it.isStable || ApplicationManager.getApplication().isInternal }.map { it.versionString }.toTypedArray()
|
||||
LanguageVersion.values().filter { it.isStable || ApplicationManager.getApplication().isInternal }.map { it.versionString }
|
||||
.toTypedArray()
|
||||
)
|
||||
|
||||
class MavenApiVersionsCompletionProvider : MavenFixedValueReferenceProvider(
|
||||
LanguageVersion.values().filter { it.isStable || ApplicationManager.getApplication().isInternal }.map { it.versionString }.toTypedArray()
|
||||
LanguageVersion.values().filter { it.isStable || ApplicationManager.getApplication().isInternal }.map { it.versionString }
|
||||
.toTypedArray()
|
||||
)
|
||||
|
||||
class MavenJvmTargetsCompletionProvider : MavenFixedValueReferenceProvider(
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven
|
||||
@@ -56,7 +45,7 @@ class PomFile private constructor(private val xmlFile: XmlFile, val domModel: Ma
|
||||
constructor(xmlFile: XmlFile) : this(
|
||||
xmlFile,
|
||||
MavenDomUtil.getMavenDomProjectModel(xmlFile.project, xmlFile.virtualFile)
|
||||
?: throw IllegalStateException("No DOM model found for pom ${xmlFile.name}")
|
||||
?: throw IllegalStateException("No DOM model found for pom ${xmlFile.name}")
|
||||
)
|
||||
|
||||
private val nodesByName = HashMap<String, XmlTag>()
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2000-2019 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.
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,8 @@ protected constructor(
|
||||
if (psi == null
|
||||
|| !psi.isValid
|
||||
|| psi !is XmlFile
|
||||
|| psi.virtualFile == null) {
|
||||
|| psi.virtualFile == null
|
||||
) {
|
||||
return ConfigureKotlinStatus.BROKEN
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ protected constructor(
|
||||
|
||||
val kotlinPluginId = kotlinPluginId(null)
|
||||
val kotlinPlugin = mavenProject.plugins.find { it.mavenId.equals(kotlinPluginId.groupId, kotlinPluginId.artifactId) }
|
||||
?: return ConfigureKotlinStatus.CAN_BE_CONFIGURED
|
||||
?: return ConfigureKotlinStatus.CAN_BE_CONFIGURED
|
||||
|
||||
if (kotlinPlugin.executions.any { it.goals.any(this::isRelevantGoal) }) {
|
||||
return ConfigureKotlinStatus.CONFIGURED
|
||||
|
||||
+5
-15
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven.inspections
|
||||
@@ -57,8 +46,9 @@ class DifferentKotlinMavenVersionInspection : DomElementsInspection<MavenDomProj
|
||||
holder.createProblem(
|
||||
plugin.version,
|
||||
HighlightSeverity.WARNING,
|
||||
"Kotlin version that is used for building with Maven (${plugin.version.stringValue}) differs from the one bundled into the IDE plugin (${testVersionMessage
|
||||
?: idePluginVersion})"
|
||||
"Kotlin version that is used for building with Maven (${plugin.version
|
||||
.stringValue}) differs from the one bundled into the IDE plugin (${testVersionMessage
|
||||
?: idePluginVersion})"
|
||||
)
|
||||
}
|
||||
}
|
||||
+4
-14
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven.inspections
|
||||
@@ -44,7 +33,8 @@ class DifferentMavenStdlibVersionInspection : DomElementsInspection<MavenDomProj
|
||||
val manager = MavenProjectsManager.getInstance(module.project) ?: return
|
||||
val project = manager.findProject(module) ?: return
|
||||
|
||||
val stdlibVersion = project.findDependencies(KotlinMavenConfigurator.GROUP_ID, PathUtil.KOTLIN_JAVA_STDLIB_NAME).map { it.version }.distinct()
|
||||
val stdlibVersion =
|
||||
project.findDependencies(KotlinMavenConfigurator.GROUP_ID, PathUtil.KOTLIN_JAVA_STDLIB_NAME).map { it.version }.distinct()
|
||||
val pluginVersion = project.findPlugin(KotlinMavenConfigurator.GROUP_ID, KotlinMavenConfigurator.MAVEN_PLUGIN_ID)?.version
|
||||
|
||||
if (pluginVersion == null || stdlibVersion.isEmpty() || stdlibVersion.singleOrNull() == pluginVersion) {
|
||||
|
||||
+7
-15
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven.inspections
|
||||
@@ -182,8 +171,11 @@ class KotlinMavenPluginPhaseInspection : DomElementsInspection<MavenDomProjectMo
|
||||
}
|
||||
|
||||
pom.findKotlinExecutions().filter {
|
||||
it.goals.goals.any { goal -> goal.rawText == PomFile.KotlinGoals.Compile || goal.rawText == PomFile.KotlinGoals.Js }
|
||||
&& it.goals.goals.any { goal -> goal.rawText == PomFile.KotlinGoals.TestCompile || goal.rawText == PomFile.KotlinGoals.TestJs }
|
||||
it.goals.goals.any { goal ->
|
||||
goal.rawText == PomFile.KotlinGoals.Compile || goal.rawText == PomFile.KotlinGoals.Js
|
||||
} && it.goals.goals.any { goal ->
|
||||
goal.rawText == PomFile.KotlinGoals.TestCompile || goal.rawText == PomFile.KotlinGoals.TestJs
|
||||
}
|
||||
}.forEach { badExecution ->
|
||||
holder.createProblem(
|
||||
badExecution.goals.createStableCopy(),
|
||||
|
||||
+3
-14
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven.inspections
|
||||
@@ -68,7 +57,7 @@ class KotlinMavenUnresolvedReferenceQuickFixProvider : UnresolvedReferenceQuickF
|
||||
.importDirectives
|
||||
.firstOrNull { !it.isAllUnder && it.aliasName == referenced || it.importedFqName?.shortName()?.asString() == referenced }
|
||||
?.let { it.importedFqName?.asString() }
|
||||
?: referenced
|
||||
?: referenced
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
|
||||
+5
-15
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven.inspections
|
||||
@@ -44,8 +33,9 @@ class KotlinTestJUnitInspection : DomElementsInspection<MavenDomProjectModel>(Ma
|
||||
return
|
||||
}
|
||||
|
||||
val kotlinTestDependencies = domFileElement.rootElement.dependencies
|
||||
.dependencies.filter { it.groupId.rawText == KotlinMavenConfigurator.GROUP_ID && it.artifactId.rawText == KotlinJavaMavenConfigurator.TEST_LIB_ID }
|
||||
val kotlinTestDependencies = domFileElement.rootElement.dependencies.dependencies.filter {
|
||||
it.groupId.rawText == KotlinMavenConfigurator.GROUP_ID && it.artifactId.rawText == KotlinJavaMavenConfigurator.TEST_LIB_ID
|
||||
}
|
||||
|
||||
kotlinTestDependencies.forEach {
|
||||
holder.createProblem(
|
||||
|
||||
+6
-19
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven
|
||||
@@ -62,7 +51,7 @@ abstract class AbstractKotlinMavenInspectionTest : MavenImportingTestCase() {
|
||||
}
|
||||
|
||||
val inspectionClassName = "<!--\\s*inspection:\\s*([\\S]+)\\s-->".toRegex().find(pomText)?.groups?.get(1)?.value
|
||||
?: KotlinMavenPluginPhaseInspection::class.qualifiedName!!
|
||||
?: KotlinMavenPluginPhaseInspection::class.qualifiedName!!
|
||||
val inspectionClass = Class.forName(inspectionClassName)
|
||||
|
||||
val matcher = "<!--\\s*problem:\\s*on\\s*([^,]+),\\s*title\\s*(.+)\\s*-->".toRegex()
|
||||
@@ -82,9 +71,7 @@ abstract class AbstractKotlinMavenInspectionTest : MavenImportingTestCase() {
|
||||
.map { SimplifiedProblemDescription(it.descriptionTemplate, it.psiElement.text.replace("\\s+".toRegex(), "")) to it }
|
||||
.sortedBy { it.first.text }
|
||||
|
||||
val actualProblemsText = actual
|
||||
.map { it.first }
|
||||
.joinToString("\n") { "<!-- problem: on ${it.elementText}, title ${it.text} -->"}
|
||||
val actualProblemsText = actual.map { it.first }.joinToString("\n") { "<!-- problem: on ${it.elementText}, title ${it.text} -->" }
|
||||
|
||||
assertEquals(expectedProblemsText, actualProblemsText)
|
||||
|
||||
@@ -180,8 +167,8 @@ abstract class AbstractKotlinMavenInspectionTest : MavenImportingTestCase() {
|
||||
private fun mkJavaFile() {
|
||||
val contentEntry = getContentRoots(myProject.allModules().single().name).single()
|
||||
val sourceFolder =
|
||||
contentEntry.getSourceFolders(JavaSourceRootType.SOURCE).singleOrNull() ?:
|
||||
contentEntry.getSourceFolders(SourceKotlinRootType).singleOrNull()
|
||||
contentEntry.getSourceFolders(JavaSourceRootType.SOURCE).singleOrNull() ?: contentEntry.getSourceFolders(SourceKotlinRootType)
|
||||
.singleOrNull()
|
||||
ApplicationManager.getApplication().runWriteAction {
|
||||
val javaFile = sourceFolder?.file?.toPsiDirectory(myProject)?.createFile("Test.java") ?: throw IllegalStateException()
|
||||
javaFile.viewProvider.document!!.setText("class Test {}\n")
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* Copyright 2010-2019 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.maven
|
||||
@@ -45,15 +34,15 @@ import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinSdkType
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
||||
import org.jetbrains.kotlin.platform.CommonPlatforms
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.oldFashionedDescription
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.oldFashionedDescription
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
||||
import org.junit.Assert
|
||||
import org.junit.runner.RunWith
|
||||
import java.io.File
|
||||
@@ -655,7 +644,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
createProjectSubDirs("src/main/kotlin")
|
||||
|
||||
importProject(
|
||||
"""
|
||||
"""
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<version>1.0.0</version>
|
||||
@@ -858,7 +847,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
fun testJsCustomOutputPaths() {
|
||||
createProjectSubDirs("src/main/kotlin", "src/test/kotlin")
|
||||
importProject(
|
||||
"""
|
||||
"""
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<version>1.0.0</version>
|
||||
@@ -918,7 +907,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
Assert.assertEquals("$projectBasePath/test/test.js", PathUtil.toSystemIndependentName(testOutputPath))
|
||||
}
|
||||
|
||||
with (CompilerModuleExtension.getInstance(getModule("project"))!!) {
|
||||
with(CompilerModuleExtension.getInstance(getModule("project"))!!) {
|
||||
Assert.assertEquals("$projectBasePath/prod", PathUtil.toSystemIndependentName(compilerOutputUrl))
|
||||
Assert.assertEquals("$projectBasePath/test", PathUtil.toSystemIndependentName(compilerOutputUrlForTests))
|
||||
}
|
||||
@@ -2369,8 +2358,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
)
|
||||
|
||||
val commonModule2 = createModulePom(
|
||||
"my-common-module2",
|
||||
"""
|
||||
"my-common-module2",
|
||||
"""
|
||||
|
||||
<parent>
|
||||
<groupId>test</groupId>
|
||||
|
||||
Reference in New Issue
Block a user