Remove as33 support
#KT-33536 Fixed
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8
|
||||
|
||||
cacheRedirectorEnabled=true
|
||||
|
||||
#buildSrc.kotlin.repo=https://jcenter.bintray.com
|
||||
#buildSrc.kotlin.version=1.1.50
|
||||
|
||||
intellijUltimateEnabled=false
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
||||
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8
|
||||
|
||||
cacheRedirectorEnabled=true
|
||||
|
||||
kotlin.compiler.effectSystemEnabled=true
|
||||
kotlin.compiler.newInferenceEnabled=true
|
||||
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
|
||||
#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
|
||||
#bootstrap.kotlin.version=1.1.50-dev-1451
|
||||
#signingRequired=true
|
||||
|
||||
intellijUltimateEnabled=false
|
||||
|
||||
## The following properties can be added to your local.properties file to customize the build:
|
||||
|
||||
#jpsBuild=true
|
||||
#cidrPluginsEnabled=true
|
||||
|
||||
## Used for compare gradle and jps build
|
||||
|
||||
#kotlin.build.postprocessing=false
|
||||
#kotlin.build.java9=false
|
||||
#kotlin.build.useBootstrapStdlib=true
|
||||
@@ -1,18 +0,0 @@
|
||||
versions.intellijSdk=182.4505.22
|
||||
versions.androidBuildTools=r23.0.1
|
||||
versions.idea.NodeJS=181.3494.12
|
||||
versions.androidStudioRelease=3.3.0.16
|
||||
versions.androidStudioBuild=182.5114240
|
||||
versions.jar.guava=23.6-jre
|
||||
versions.jar.groovy-all=2.4.15
|
||||
versions.jar.lombok-ast=0.2.3
|
||||
versions.jar.swingx-core=1.6.2-2
|
||||
versions.jar.kxml2=2.3.0
|
||||
versions.jar.streamex=0.6.5
|
||||
versions.jar.gson=2.8.4
|
||||
versions.jar.oro=2.0.8
|
||||
versions.jar.picocontainer=1.2
|
||||
ignore.jar.snappy-in-java=true
|
||||
ignore.jar.common=true
|
||||
ignore.jar.lombok-ast=true
|
||||
versions.gradle-api=4.4
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
public interface IconExtensionChooser {
|
||||
static String iconExtension() {
|
||||
return "png";
|
||||
}
|
||||
}
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2010-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.caches.project
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.module.ModuleUtilCore
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.idea.LIBRARY_KEY
|
||||
import org.jetbrains.kotlin.idea.MODULE_ROOT_TYPE_KEY
|
||||
import org.jetbrains.kotlin.idea.SDK_KEY
|
||||
import org.jetbrains.kotlin.idea.caches.project.UserDataModuleContainer.ForPsiElement
|
||||
import org.jetbrains.kotlin.idea.caches.project.UserDataModuleContainer.ForVirtualFile
|
||||
import org.jetbrains.kotlin.idea.core.getSourceType
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
|
||||
// This file declares non-exported API for overriding module info with user-data
|
||||
|
||||
|
||||
private sealed class UserDataModuleContainer {
|
||||
abstract fun <T> getUserData(key: Key<T>): T?
|
||||
abstract fun getModule(): Module?
|
||||
|
||||
data class ForVirtualFile(val virtualFile: VirtualFile, val project: Project) : UserDataModuleContainer() {
|
||||
override fun <T> getUserData(key: Key<T>): T? = virtualFile.getUserData(key)
|
||||
override fun getModule(): Module? = ModuleUtilCore.findModuleForFile(virtualFile, project)
|
||||
}
|
||||
|
||||
data class ForPsiElement(val psiElement: PsiElement) : UserDataModuleContainer() {
|
||||
override fun <T> getUserData(key: Key<T>): T? {
|
||||
return psiElement.getUserData(key)
|
||||
?: psiElement.containingFile?.getUserData(key)
|
||||
?: psiElement.containingFile?.originalFile?.virtualFile?.getUserData(key)
|
||||
}
|
||||
|
||||
override fun getModule(): Module? = ModuleUtilCore.findModuleForPsiElement(psiElement)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun collectModuleInfoByUserData(
|
||||
project: Project,
|
||||
container: UserDataModuleContainer
|
||||
): List<IdeaModuleInfo> {
|
||||
fun forModule(): ModuleSourceInfo? {
|
||||
val rootType = container.getUserData(MODULE_ROOT_TYPE_KEY) ?: return null
|
||||
val module = container.getModule() ?: return null
|
||||
|
||||
return when (rootType.getSourceType()) {
|
||||
null -> null
|
||||
SourceType.PRODUCTION -> module.productionSourceInfo()
|
||||
SourceType.TEST -> module.testSourceInfo()
|
||||
}
|
||||
}
|
||||
|
||||
val result = mutableListOf<IdeaModuleInfo>()
|
||||
result.addIfNotNull(forModule())
|
||||
|
||||
val library = container.getUserData(LIBRARY_KEY)
|
||||
if (library != null) {
|
||||
result.addAll(createLibraryInfo(project, library))
|
||||
}
|
||||
|
||||
val sdk = container.getUserData(SDK_KEY)
|
||||
if (sdk != null) {
|
||||
result.add(SdkInfo(project, sdk))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
fun collectModuleInfoByUserData(
|
||||
project: Project,
|
||||
virtualFile: VirtualFile
|
||||
): List<IdeaModuleInfo> = collectModuleInfoByUserData(project, ForVirtualFile(virtualFile, project))
|
||||
|
||||
fun collectModuleInfoByUserData(
|
||||
psiElement: PsiElement
|
||||
): List<IdeaModuleInfo> = collectModuleInfoByUserData(psiElement.project, ForPsiElement(psiElement))
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.util.Key
|
||||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType
|
||||
|
||||
// WARNING, this API is used by AS3.3+
|
||||
|
||||
|
||||
const val LIBRARY_KEY_NAME = "Kt_Library"
|
||||
const val SDK_KEY_NAME = "Kt_Sdk"
|
||||
const val MODULE_ROOT_TYPE_KEY_NAME = "Kt_SourceRootType"
|
||||
|
||||
@JvmField
|
||||
val MODULE_ROOT_TYPE_KEY = getOrCreateKey<JpsModuleSourceRootType<*>>(MODULE_ROOT_TYPE_KEY_NAME)
|
||||
|
||||
@JvmField
|
||||
val SDK_KEY = getOrCreateKey<Sdk>(SDK_KEY_NAME)
|
||||
|
||||
@JvmField
|
||||
val LIBRARY_KEY = getOrCreateKey<Library>(LIBRARY_KEY_NAME)
|
||||
|
||||
|
||||
inline fun <reified T> getOrCreateKey(name: String): Key<T> {
|
||||
@Suppress("DEPRECATION", "UNCHECKED_CAST")
|
||||
val existingKey = Key.findKeyByName(name) as Key<T>?
|
||||
return existingKey ?: Key.create<T>(name)
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. 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.statistics
|
||||
|
||||
open class KotlinFUSLogger {
|
||||
companion object {
|
||||
fun log(group: FUSEventGroups, event: String) {
|
||||
// Not whitelisted for AS
|
||||
}
|
||||
|
||||
fun log(group: FUSEventGroups, event: String, eventData: Map<String, String>) {
|
||||
// Not whitelisted for AS
|
||||
}
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* 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.gradle
|
||||
|
||||
fun KaptImportingTest.isAndroidStudio() = true
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* 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.codeInsight.gradle
|
||||
|
||||
fun isGradleInspectionTestApplicable() = false
|
||||
@@ -1,5 +0,0 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<externalAnnotator language="kotlin" implementationClass="org.jetbrains.android.inspections.lint.AndroidLintExternalAnnotator"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,102 +0,0 @@
|
||||
<idea-plugin>
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.updater" beanClass="com.intellij.openapi.fileTypes.FileTypeExtensionPoint"/>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.projectConfigurator" interface="org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.declarationAttributeAltererExtension"
|
||||
interface="org.jetbrains.kotlin.extensions.DeclarationAttributeAltererExtension"
|
||||
area="IDEA_PROJECT"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.idePlatformKindResolution"
|
||||
interface="org.jetbrains.kotlin.caches.resolve.IdePlatformKindResolution"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.highlighterExtension"
|
||||
interface="org.jetbrains.kotlin.idea.highlighter.HighlighterExtension"/>
|
||||
|
||||
<extensionPoint name="scratchFileLanguageProvider" beanClass="com.intellij.lang.LanguageExtensionPoint">
|
||||
<with attribute="implementationClass" implements="org.jetbrains.kotlin.idea.scratch.ScratchFileLanguageProvider"/>
|
||||
</extensionPoint>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.binaryExtension"
|
||||
interface="org.jetbrains.kotlin.idea.util.KotlinBinaryExtension"/>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.facetValidatorCreator"
|
||||
interface="org.jetbrains.kotlin.idea.facet.KotlinFacetValidatorCreator"/>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.clearBuildState"
|
||||
interface="org.jetbrains.kotlin.idea.compiler.configuration.ClearBuildStateExtension"/>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.newFileHook"
|
||||
interface="org.jetbrains.kotlin.idea.actions.NewKotlinFileHook"/>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.completionExtension"
|
||||
interface="org.jetbrains.kotlin.idea.completion.KotlinCompletionExtension"/>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.buildSystemTypeDetector"
|
||||
interface="org.jetbrains.kotlin.idea.configuration.BuildSystemTypeDetector"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.idePlatformKind"
|
||||
interface="org.jetbrains.kotlin.platform.IdePlatformKind"/>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.idePlatformKindTooling"
|
||||
interface="org.jetbrains.kotlin.idea.platform.IdePlatformKindTooling"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.scriptAdditionalIdeaDependenciesProvider"
|
||||
interface="org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDependenciesProvider"
|
||||
area="IDEA_PROJECT"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.scriptDefinitionsProvider"
|
||||
interface="kotlin.script.experimental.intellij.ScriptDefinitionsProvider"
|
||||
area="IDEA_PROJECT"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.syntheticScopeProviderExtension"
|
||||
interface="org.jetbrains.kotlin.synthetic.SyntheticScopeProviderExtension"
|
||||
area="IDEA_PROJECT"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.resolveScopeEnlarger"
|
||||
interface="org.jetbrains.kotlin.idea.caches.resolve.util.KotlinResolveScopeEnlarger"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.j2kConverterExtension"
|
||||
interface="org.jetbrains.kotlin.j2k.J2kConverterExtension"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.scriptDiagnosticFixProvider"
|
||||
interface="org.jetbrains.kotlin.idea.script.ScriptDiagnosticFixProvider"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJavaModuleConfigurator"/>
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsModuleConfigurator"/>
|
||||
|
||||
<scriptDefinitionContributor
|
||||
id="ScriptTemplatesFromCompilerSettingsProvider"
|
||||
implementation="org.jetbrains.kotlin.idea.script.ScriptTemplatesFromCompilerSettingsProvider"/>
|
||||
|
||||
<scriptDefinitionContributor
|
||||
id="BridgeScriptDefinitionsContributor"
|
||||
implementation="org.jetbrains.kotlin.idea.script.BridgeScriptDefinitionsContributor"/>
|
||||
|
||||
<scriptDefinitionContributor
|
||||
id="ScriptTemplatesFromDependenciesProvider"
|
||||
implementation="org.jetbrains.kotlin.idea.script.ScriptTemplatesFromDependenciesProvider"/>
|
||||
|
||||
<scriptDefinitionContributor id="StandardScriptDefinitionContributor"
|
||||
order="last"
|
||||
implementation="org.jetbrains.kotlin.idea.core.script.StandardScriptDefinitionContributor"/>
|
||||
|
||||
<scriptDefinitionContributor id="ConsoleScriptDefinitionContributor"
|
||||
implementation="org.jetbrains.kotlin.console.ConsoleScriptDefinitionContributor"/>
|
||||
|
||||
<idePlatformKindResolution implementation="org.jetbrains.kotlin.caches.resolve.JvmPlatformKindResolution"/>
|
||||
<idePlatformKindResolution implementation="org.jetbrains.kotlin.caches.resolve.JsPlatformKindResolution"/>
|
||||
<idePlatformKindResolution implementation="org.jetbrains.kotlin.caches.resolve.CommonPlatformKindResolution"/>
|
||||
|
||||
<scratchFileLanguageProvider language="kotlin" implementationClass="org.jetbrains.kotlin.idea.scratch.KtScratchFileLanguageProvider"/>
|
||||
<scriptAdditionalIdeaDependenciesProvider implementation="org.jetbrains.kotlin.idea.scratch.ScratchAdditionalIdeaDependenciesProvider"/>
|
||||
|
||||
<j2kConverterExtension implementation="org.jetbrains.kotlin.idea.j2k.OldJ2kConverterExtension"/>
|
||||
<j2kConverterExtension implementation="org.jetbrains.kotlin.nj2k.NewJ2kConverterExtension"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<registryKey key="kotlin.android.import.mpp.all.transitive"
|
||||
description="Add all transitive dependencies on MPP modules when Android project is imported"
|
||||
defaultValue="true"
|
||||
restartRequired="false"/>
|
||||
<fileEditorProvider implementation="org.jetbrains.kotlin.idea.scratch.ui.KtScratchFileEditorProvider"/>
|
||||
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,4 +0,0 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="Git4Idea">
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,54 +0,0 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="org.jetbrains.plugins.gradle">
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinMPPSourceSetsFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJavaFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJSBrowserFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJSNodeFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinMPPFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinJavaFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinJSBrowserFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinJSNodeFrameworkSupportProvider"/>
|
||||
<pluginDescriptions implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradlePluginDescription"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleProjectResolverExtension" order="first"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.kapt.idea.KaptProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.allopen.ide.AllOpenProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.noarg.ide.NoArgProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverProjectResolverExtension" order="last"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleSourceSetDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleProjectDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleLibraryDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinTargetDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.KotlinJavaMPPSourceSetDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinNativeLibraryDataService"/>
|
||||
<externalSystemTaskNotificationListener implementation="org.jetbrains.kotlin.idea.core.script.ReloadGradleTemplatesOnSync"/>
|
||||
|
||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.run.KotlinTestClassGradleConfigurationProducer"/>
|
||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.run.KotlinTestMethodGradleConfigurationProducer"/>
|
||||
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.allopen.ide.AllOpenGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.scripting.idea.plugin.ScriptingGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.kapt.idea.KaptGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationGradleImportHandler"/>
|
||||
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsGradleModuleConfigurator"/>
|
||||
<gradleModelFacade implementation="org.jetbrains.kotlin.idea.inspections.gradle.DefaultGradleModelFacade"/>
|
||||
|
||||
<scriptDefinitionContributor implementation="org.jetbrains.kotlin.idea.core.script.GradleScriptDefinitionsContributor" order="first"/>
|
||||
<scriptAdditionalIdeaDependenciesProvider implementation="org.jetbrains.kotlin.idea.core.script.GradleScriptAdditionalIdeaDependenciesProvider"/>
|
||||
|
||||
<moduleBuilder implementation="org.jetbrains.kotlin.ide.konan.gradle.KotlinGradleNativeMultiplatformModuleBuilder"/>
|
||||
<moduleBuilder implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleSharedMultiplatformModuleBuilder"/>
|
||||
<moduleBuilder implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleWebMultiplatformModuleBuilder"/>
|
||||
<moduleBuilder implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleMobileMultiplatformModuleBuilder"/>
|
||||
<moduleBuilder implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleMobileSharedMultiplatformModuleBuilder"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,84 +0,0 @@
|
||||
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude" version="2" url="http://kotlinlang.org" allow-bundled-update="true">
|
||||
<id>org.jetbrains.kotlin</id>
|
||||
|
||||
<name>Kotlin</name>
|
||||
<description><![CDATA[
|
||||
The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<br>
|
||||
<a href="http://kotlinlang.org/docs/tutorials/getting-started.html">Getting Started in IntelliJ IDEA</a><br>
|
||||
<a href="http://kotlinlang.org/docs/tutorials/kotlin-android.html">Getting Started in Android Studio</a><br>
|
||||
<a href="http://slack.kotlinlang.org/">Public Slack</a><br>
|
||||
<a href="https://youtrack.jetbrains.com/issues/KT">Issue tracker</a><br>
|
||||
]]></description>
|
||||
<version>@snapshot@</version>
|
||||
<vendor url="http://www.jetbrains.com">JetBrains</vendor>
|
||||
|
||||
<idea-version since-build="182.4323.46" until-build="182.*"/>
|
||||
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
<depends>com.intellij.modules.androidstudio</depends>
|
||||
|
||||
<depends optional="true" config-file="junit.xml">JUnit</depends>
|
||||
<depends optional="true" config-file="gradle.xml">org.jetbrains.plugins.gradle</depends>
|
||||
<depends optional="true" config-file="gradle-java.xml">org.jetbrains.plugins.gradle.java</depends>
|
||||
<depends optional="true" config-file="gradle-groovy.xml">org.intellij.groovy</depends>
|
||||
<depends optional="true" config-file="maven.xml">org.jetbrains.idea.maven</depends>
|
||||
<depends optional="true" config-file="testng-j.xml">TestNG-J</depends>
|
||||
<depends optional="true" config-file="kotlin-copyright.xml">com.intellij.copyright</depends>
|
||||
<depends optional="true" config-file="coverage.xml">Coverage</depends>
|
||||
<depends optional="true" config-file="i18n.xml">com.intellij.java-i18n</depends>
|
||||
<depends optional="true" config-file="decompiler.xml">org.jetbrains.java.decompiler</depends>
|
||||
<depends optional="true" config-file="git4idea.xml">Git4Idea</depends>
|
||||
<depends optional="true" config-file="stream-debugger.xml">org.jetbrains.debugger.streams</depends>
|
||||
|
||||
<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->
|
||||
|
||||
<!-- CIDR-PLUGIN-PLACEHOLDER-START -->
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
<depends optional="true" config-file="javaScriptDebug.xml">JavaScriptDebugger</depends>
|
||||
<depends optional="true" config-file="kotlin-copyright.xml">com.intellij.copyright</depends>
|
||||
<depends optional="true" config-file="injection.xml">org.intellij.intelliLang</depends>
|
||||
<!-- CIDR-PLUGIN-PLACEHOLDER-END -->
|
||||
|
||||
<xi:include href="plugin-common.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<!-- CIDR-PLUGIN-EXCLUDE-START -->
|
||||
<xi:include href="jvm.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<!-- CIDR-PLUGIN-EXCLUDE-END -->
|
||||
|
||||
<xi:include href="native.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
<xi:include href="tipsAndTricks.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<xi:include href="extensions/ide.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<xi:include href="kotlinx-serialization.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<project-components>
|
||||
<component>
|
||||
<!-- This is a workaround for IDEA < 183. For details, see IDEA-200525. -->
|
||||
<implementation-class>org.jetbrains.kotlin.idea.caches.ProjectRootModificationTrackerFixer</implementation-class>
|
||||
</component>
|
||||
</project-components>
|
||||
|
||||
<extensionPoints>
|
||||
<xi:include href="extensions/compiler.xml" xpointer="xpointer(/idea-plugin/extensionPoints/*)"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.pluginUpdateVerifier"
|
||||
interface="org.jetbrains.kotlin.idea.update.PluginUpdateVerifier"/>
|
||||
</extensionPoints>
|
||||
|
||||
<xi:include href="plugin-kotlin-extensions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<pluginUpdateVerifier implementation="org.jetbrains.kotlin.idea.update.GooglePluginUpdateVerifier"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.jvm">
|
||||
<declarationSearcher language="kotlin" implementationClass="org.jetbrains.kotlin.idea.jvm.KotlinDeclarationSearcher"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<projectService serviceInterface="org.jetbrains.kotlin.idea.core.script.ScriptModificationListener"
|
||||
serviceImplementation="org.jetbrains.kotlin.idea.core.script.ScriptModificationListener"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.reporter
|
||||
|
||||
import com.intellij.diagnostic.ITNReporter
|
||||
import com.intellij.openapi.diagnostic.IdeaLoggingEvent
|
||||
import com.intellij.openapi.diagnostic.SubmittedReportInfo
|
||||
import com.intellij.util.Consumer
|
||||
import java.awt.Component
|
||||
|
||||
abstract class ITNReporterCompat : ITNReporter() {
|
||||
final override fun submit(
|
||||
events: Array<IdeaLoggingEvent>,
|
||||
additionalInfo: String?,
|
||||
parentComponent: Component?,
|
||||
consumer: Consumer<SubmittedReportInfo>
|
||||
): Boolean {
|
||||
return submitCompat(events, additionalInfo, parentComponent, consumer)
|
||||
}
|
||||
|
||||
open fun submitCompat(
|
||||
events: Array<IdeaLoggingEvent>,
|
||||
additionalInfo: String?,
|
||||
parentComponent: Component?,
|
||||
consumer: Consumer<SubmittedReportInfo>
|
||||
): Boolean {
|
||||
@Suppress("IncompatibleAPI")
|
||||
return super.submit(events, additionalInfo, parentComponent, consumer)
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package org.jetbrains.kotlin.idea
|
||||
|
||||
import com.intellij.featureStatistics.FeatureStatisticsBundleProvider
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
private const val CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME = "com.jetbrains.cidr.lang.OCFeatureStatisticsBundleProvider"
|
||||
|
||||
// Remove the function, when there's no dependency to cidr during running Kotlin tests.
|
||||
fun registerAdditionalResourceBundleInTests() {
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode) {
|
||||
return
|
||||
}
|
||||
|
||||
val isAlreadyRegistered = FeatureStatisticsBundleProvider.EP_NAME.extensions.any { provider ->
|
||||
provider.javaClass.name == CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME
|
||||
}
|
||||
if (isAlreadyRegistered) {
|
||||
throw IllegalStateException("Remove this registration for the current platform: bundle is already registered.")
|
||||
}
|
||||
|
||||
val cidrFSBundleProviderClass = try {
|
||||
Class.forName(CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME)
|
||||
} catch (_: ClassNotFoundException) {
|
||||
return
|
||||
}
|
||||
|
||||
val cidrFSBundleProvider = cidrFSBundleProviderClass.newInstance() as FeatureStatisticsBundleProvider
|
||||
|
||||
Extensions.getRootArea().getExtensionPoint(FeatureStatisticsBundleProvider.EP_NAME).registerExtension(cidrFSBundleProvider)
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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.update
|
||||
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor
|
||||
import com.intellij.ide.plugins.PluginManagerCore
|
||||
import com.intellij.ide.plugins.PluginNode
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import org.jetbrains.kotlin.idea.util.isDev
|
||||
import org.jetbrains.kotlin.idea.util.isEap
|
||||
import java.io.IOException
|
||||
import java.net.URL
|
||||
import java.util.*
|
||||
import javax.xml.bind.JAXBContext
|
||||
import javax.xml.bind.JAXBException
|
||||
import javax.xml.bind.annotation.*
|
||||
|
||||
class GooglePluginUpdateVerifier : PluginUpdateVerifier() {
|
||||
override val verifierName: String
|
||||
get() = "Android Studio"
|
||||
|
||||
// Verifies if a plugin can be installed in Android Studio 3.2+.
|
||||
// Currently used only by KotlinPluginUpdater.
|
||||
override fun verify(pluginDescriptor: IdeaPluginDescriptor): PluginVerifyResult? {
|
||||
if (pluginDescriptor.pluginId.idString != KOTLIN_PLUGIN_ID) {
|
||||
return null
|
||||
}
|
||||
|
||||
val version = pluginDescriptor.version
|
||||
if (isEap(version) || isDev(version)) {
|
||||
return PluginVerifyResult.accept()
|
||||
}
|
||||
|
||||
try {
|
||||
val url = URL(METADATA_FILE_URL)
|
||||
val stream = url.openStream()
|
||||
val context = JAXBContext.newInstance(PluginCompatibility::class.java)
|
||||
val unmarshaller = context.createUnmarshaller()
|
||||
val pluginCompatibility = unmarshaller.unmarshal(stream) as PluginCompatibility
|
||||
|
||||
val release = getRelease(pluginCompatibility)
|
||||
?: return PluginVerifyResult.decline("No verified versions for this build.")
|
||||
|
||||
return if (release.plugins().any { KOTLIN_PLUGIN_ID == it.id && version == it.version })
|
||||
PluginVerifyResult.accept()
|
||||
else
|
||||
PluginVerifyResult.decline("Version to be verified.")
|
||||
} catch (e: Exception) {
|
||||
LOG.info("Exception when verifying plugin ${pluginDescriptor.pluginId.idString} version $version", e)
|
||||
return when (e) {
|
||||
is IOException ->
|
||||
PluginVerifyResult.decline("unable to connect to compatibility verification repository")
|
||||
is JAXBException -> PluginVerifyResult.decline("unable to parse compatibility verification metadata")
|
||||
else -> PluginVerifyResult.decline("exception during verification ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getRelease(pluginCompatibility: PluginCompatibility): StudioRelease? {
|
||||
for (studioRelease in pluginCompatibility.releases()) {
|
||||
if (buildInRange(studioRelease.name, studioRelease.sinceBuild, studioRelease.untilBuild)) {
|
||||
return studioRelease
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun buildInRange(name: String?, sinceBuild: String?, untilBuild: String?): Boolean {
|
||||
val descriptor = PluginNode()
|
||||
descriptor.name = name
|
||||
descriptor.sinceBuild = sinceBuild
|
||||
descriptor.untilBuild = untilBuild
|
||||
return PluginManagerCore.isCompatible(descriptor)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val KOTLIN_PLUGIN_ID = "org.jetbrains.kotlin"
|
||||
private const val METADATA_FILE_URL = "https://dl.google.com/android/studio/plugins/compatibility.xml"
|
||||
|
||||
private val LOG = Logger.getInstance(GooglePluginUpdateVerifier::class.java)
|
||||
|
||||
private fun PluginCompatibility.releases() = studioRelease ?: emptyArray()
|
||||
private fun StudioRelease.plugins() = ideaPlugin ?: emptyArray()
|
||||
|
||||
@XmlRootElement(name = "plugin-compatibility")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
class PluginCompatibility {
|
||||
@XmlElement(name = "studio-release")
|
||||
var studioRelease: Array<StudioRelease>? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "PluginCompatibility(studioRelease=${Arrays.toString(studioRelease)})"
|
||||
}
|
||||
}
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
class StudioRelease {
|
||||
@XmlAttribute(name = "until-build")
|
||||
var untilBuild: String? = null
|
||||
@XmlAttribute(name = "since-build")
|
||||
var sinceBuild: String? = null
|
||||
@XmlAttribute
|
||||
var name: String? = null
|
||||
@XmlAttribute
|
||||
var channel: String? = null
|
||||
|
||||
@XmlElement(name = "idea-plugin")
|
||||
var ideaPlugin: Array<IdeaPlugin>? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "StudioRelease(" +
|
||||
"untilBuild=$untilBuild, name=$name, ideaPlugin=${Arrays.toString(ideaPlugin)}, " +
|
||||
"sinceBuild=$sinceBuild, channel=$channel" +
|
||||
")"
|
||||
}
|
||||
}
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
class IdeaPlugin {
|
||||
@XmlAttribute
|
||||
var id: String? = null
|
||||
@XmlAttribute
|
||||
var sha256: String? = null
|
||||
@XmlAttribute
|
||||
var channel: String? = null
|
||||
@XmlAttribute
|
||||
var version: String? = null
|
||||
|
||||
@XmlElement(name = "idea-version")
|
||||
var ideaVersion: IdeaVersion? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "IdeaPlugin(id=$id, sha256=$sha256, ideaVersion=$ideaVersion, channel=$channel, version=$version)"
|
||||
}
|
||||
}
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
class IdeaVersion {
|
||||
@XmlAttribute(name = "until-build")
|
||||
var untilBuild: String? = null
|
||||
@XmlAttribute(name = "since-build")
|
||||
var sinceBuild: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "IdeaVersion(untilBuild=$untilBuild, sinceBuild=$sinceBuild)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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.update
|
||||
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import org.jetbrains.kotlin.idea.PluginUpdateStatus
|
||||
|
||||
// Do an additional verification with PluginUpdateVerifier. Enabled only in AS 3.2+
|
||||
fun verify(updateStatus: PluginUpdateStatus.Update): PluginUpdateStatus {
|
||||
@Suppress("InvalidBundleOrProperty")
|
||||
val pluginVerifierEnabled = Registry.`is`("kotlin.plugin.update.verifier.enabled", true)
|
||||
if (!pluginVerifierEnabled) {
|
||||
return updateStatus
|
||||
}
|
||||
|
||||
val pluginDescriptor: IdeaPluginDescriptor = updateStatus.pluginDescriptor
|
||||
val pluginVerifiers = PluginUpdateVerifier.EP_NAME.extensions
|
||||
|
||||
for (pluginVerifier in pluginVerifiers) {
|
||||
val verifyResult = pluginVerifier.verify(pluginDescriptor) ?: continue
|
||||
if (!verifyResult.verified) {
|
||||
return PluginUpdateStatus.Unverified(
|
||||
pluginVerifier.verifierName,
|
||||
verifyResult.declineMessage,
|
||||
updateStatus
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return updateStatus
|
||||
}
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-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.android.model.impl
|
||||
|
||||
import com.android.builder.model.SourceProvider
|
||||
import com.android.tools.idea.gradle.project.GradleProjectInfo
|
||||
import com.android.tools.idea.gradle.project.model.AndroidModuleModel
|
||||
import com.android.tools.idea.res.ResourceRepositoryManager
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.android.facet.AndroidFacet
|
||||
import org.jetbrains.kotlin.android.model.AndroidModuleInfoProvider
|
||||
import java.io.File
|
||||
|
||||
class AndroidModuleInfoProviderImpl(override val module: Module) : AndroidModuleInfoProvider {
|
||||
private val androidFacet: AndroidFacet?
|
||||
get() = AndroidFacet.getInstance(module)
|
||||
|
||||
private val androidModuleModel: AndroidModuleModel?
|
||||
get() = AndroidModuleModel.get(module)
|
||||
|
||||
override fun isAndroidModule() = androidFacet != null
|
||||
override fun isGradleModule() = GradleProjectInfo.getInstance(module.project).isBuildWithGradle
|
||||
|
||||
override fun getAllResourceDirectories(): List<VirtualFile> {
|
||||
return androidFacet?.allResourceDirectories ?: emptyList()
|
||||
}
|
||||
|
||||
override fun getApplicationPackage() = androidFacet?.manifest?.`package`?.toString()
|
||||
|
||||
override fun getMainSourceProvider(): AndroidModuleInfoProvider.SourceProviderMirror? {
|
||||
return androidFacet?.mainSourceProvider?.let(::SourceProviderMirrorImpl)
|
||||
}
|
||||
|
||||
override fun getApplicationResourceDirectories(createIfNecessary: Boolean): Collection<VirtualFile> {
|
||||
return ResourceRepositoryManager.getOrCreateInstance(module)?.getAppResources(createIfNecessary)?.resourceDirs ?: emptyList()
|
||||
}
|
||||
|
||||
override fun getAllSourceProviders(): List<AndroidModuleInfoProvider.SourceProviderMirror> {
|
||||
val androidModuleModel = this.androidModuleModel ?: return emptyList()
|
||||
return androidModuleModel.allSourceProviders.map(::SourceProviderMirrorImpl)
|
||||
}
|
||||
|
||||
override fun getActiveSourceProviders(): List<AndroidModuleInfoProvider.SourceProviderMirror> {
|
||||
val androidModuleModel = this.androidModuleModel ?: return emptyList()
|
||||
return androidModuleModel.activeSourceProviders.map(::SourceProviderMirrorImpl)
|
||||
}
|
||||
|
||||
override fun getFlavorSourceProviders(): List<AndroidModuleInfoProvider.SourceProviderMirror> {
|
||||
val androidModuleModel = this.androidModuleModel ?: return emptyList()
|
||||
|
||||
val getFlavorSourceProvidersMethod = try {
|
||||
AndroidFacet::class.java.getMethod("getFlavorSourceProviders")
|
||||
} catch (e: NoSuchMethodException) {
|
||||
null
|
||||
}
|
||||
|
||||
return if (getFlavorSourceProvidersMethod != null) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val sourceProviders = getFlavorSourceProvidersMethod.invoke(androidFacet) as? List<SourceProvider>
|
||||
sourceProviders?.map(::SourceProviderMirrorImpl) ?: emptyList()
|
||||
} else {
|
||||
androidModuleModel.flavorSourceProviders.map(::SourceProviderMirrorImpl)
|
||||
}
|
||||
}
|
||||
|
||||
private class SourceProviderMirrorImpl(val sourceProvider: SourceProvider) :
|
||||
AndroidModuleInfoProvider.SourceProviderMirror {
|
||||
override val name: String
|
||||
get() = sourceProvider.name
|
||||
|
||||
override val resDirectories: Collection<File>
|
||||
get() = sourceProvider.resDirectories
|
||||
}
|
||||
}
|
||||
-169
@@ -1,169 +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.kapt.idea
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.externalSystem.model.DataNode
|
||||
import com.intellij.openapi.externalSystem.model.ProjectKeys
|
||||
import com.intellij.openapi.externalSystem.model.project.*
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.tooling.model.idea.IdeaModule
|
||||
import org.jetbrains.kotlin.gradle.AbstractKotlinGradleModelBuilder
|
||||
import org.jetbrains.kotlin.idea.framework.GRADLE_SYSTEM_ID
|
||||
import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData
|
||||
import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension
|
||||
import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
import java.lang.Exception
|
||||
import java.lang.reflect.Modifier
|
||||
|
||||
interface KaptSourceSetModel : Serializable {
|
||||
val sourceSetName: String
|
||||
val isTest: Boolean
|
||||
val generatedSourcesDir: String
|
||||
val generatedClassesDir: String
|
||||
val generatedKotlinSourcesDir: String
|
||||
|
||||
val generatedSourcesDirFile get() = generatedSourcesDir.takeIf { it.isNotEmpty() }?.let(::File)
|
||||
val generatedClassesDirFile get() = generatedClassesDir.takeIf { it.isNotEmpty() }?.let(::File)
|
||||
val generatedKotlinSourcesDirFile get() = generatedKotlinSourcesDir.takeIf { it.isNotEmpty() }?.let(::File)
|
||||
}
|
||||
|
||||
class KaptSourceSetModelImpl(
|
||||
override val sourceSetName: String,
|
||||
override val isTest: Boolean,
|
||||
override val generatedSourcesDir: String,
|
||||
override val generatedClassesDir: String,
|
||||
override val generatedKotlinSourcesDir: String
|
||||
) : KaptSourceSetModel
|
||||
|
||||
interface KaptGradleModel : Serializable {
|
||||
val isEnabled: Boolean
|
||||
val buildDirectory: File
|
||||
val sourceSets: List<KaptSourceSetModel>
|
||||
}
|
||||
|
||||
class KaptGradleModelImpl(
|
||||
override val isEnabled: Boolean,
|
||||
override val buildDirectory: File,
|
||||
override val sourceSets: List<KaptSourceSetModel>
|
||||
) : KaptGradleModel
|
||||
|
||||
@Suppress("unused")
|
||||
class KaptProjectResolverExtension : AbstractProjectResolverExtension() {
|
||||
private companion object {
|
||||
private val LOG = Logger.getInstance(KaptProjectResolverExtension::class.java)
|
||||
}
|
||||
|
||||
override fun getExtraProjectModelClasses() = setOf(KaptGradleModel::class.java)
|
||||
override fun getToolingExtensionsClasses() = setOf(KaptModelBuilderService::class.java, Unit::class.java)
|
||||
|
||||
override fun populateModuleExtraModels(gradleModule: IdeaModule, ideModule: DataNode<ModuleData>) {
|
||||
val kaptModel = resolverCtx.getExtraProject(gradleModule, KaptGradleModel::class.java)
|
||||
|
||||
if (kaptModel != null && kaptModel.isEnabled) {
|
||||
for (sourceSet in kaptModel.sourceSets) {
|
||||
val parentDataNode = ideModule.findParentForSourceSetDataNode(sourceSet.sourceSetName) ?: continue
|
||||
|
||||
fun addSourceSet(path: String, type: ExternalSystemSourceType) {
|
||||
val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path)
|
||||
contentRootData.storePath(type, path)
|
||||
parentDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData)
|
||||
}
|
||||
|
||||
val sourceType =
|
||||
if (sourceSet.isTest) ExternalSystemSourceType.TEST_GENERATED else ExternalSystemSourceType.SOURCE_GENERATED
|
||||
sourceSet.generatedSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) }
|
||||
sourceSet.generatedKotlinSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) }
|
||||
|
||||
sourceSet.generatedClassesDirFile?.let { generatedClassesDir ->
|
||||
val libraryData = LibraryData(GRADLE_SYSTEM_ID, "kaptGeneratedClasses")
|
||||
val existingNode =
|
||||
parentDataNode.children.map { (it.data as? LibraryDependencyData)?.target }
|
||||
.firstOrNull { it?.externalName == libraryData.externalName }
|
||||
if (existingNode != null) {
|
||||
existingNode.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath)
|
||||
} else {
|
||||
libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath)
|
||||
val libraryDependencyData = LibraryDependencyData(parentDataNode.data, libraryData, LibraryLevel.MODULE)
|
||||
parentDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.populateModuleExtraModels(gradleModule, ideModule)
|
||||
}
|
||||
|
||||
private fun DataNode<ModuleData>.findParentForSourceSetDataNode(sourceSetName: String): DataNode<ModuleData>? {
|
||||
val moduleName = data.id
|
||||
for (child in children) {
|
||||
val gradleSourceSetData = child.data as? GradleSourceSetData ?: continue
|
||||
if (gradleSourceSetData.id == "$moduleName:$sourceSetName") {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return child as? DataNode<ModuleData>
|
||||
}
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
class KaptModelBuilderService : AbstractKotlinGradleModelBuilder() {
|
||||
override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder {
|
||||
return ErrorMessageBuilder.create(project, e, "Gradle import errors")
|
||||
.withDescription("Unable to build kotlin-kapt plugin configuration")
|
||||
}
|
||||
|
||||
override fun canBuild(modelName: String?): Boolean = modelName == KaptGradleModel::class.java.name
|
||||
|
||||
override fun buildAll(modelName: String?, project: Project): Any {
|
||||
val kaptPlugin: Plugin<*>? = project.plugins.findPlugin("kotlin-kapt")
|
||||
val kaptIsEnabled = kaptPlugin != null
|
||||
|
||||
val sourceSets = mutableListOf<KaptSourceSetModel>()
|
||||
|
||||
if (kaptIsEnabled) {
|
||||
project.getAllTasks(false)[project]?.forEach { compileTask ->
|
||||
if (compileTask.javaClass.name !in kotlinCompileJvmTaskClasses) return@forEach
|
||||
|
||||
val sourceSetName = compileTask.getSourceSetName()
|
||||
val isTest = sourceSetName.toLowerCase().endsWith("test")
|
||||
|
||||
val kaptGeneratedSourcesDir = getKaptDirectory("getKaptGeneratedSourcesDir", project, sourceSetName)
|
||||
val kaptGeneratedClassesDir = getKaptDirectory("getKaptGeneratedClassesDir", project, sourceSetName)
|
||||
val kaptGeneratedKotlinSourcesDir = getKaptDirectory("getKaptGeneratedKotlinSourcesDir", project, sourceSetName)
|
||||
sourceSets += KaptSourceSetModelImpl(
|
||||
sourceSetName, isTest, kaptGeneratedSourcesDir, kaptGeneratedClassesDir, kaptGeneratedKotlinSourcesDir)
|
||||
}
|
||||
}
|
||||
|
||||
return KaptGradleModelImpl(kaptIsEnabled, project.buildDir, sourceSets)
|
||||
}
|
||||
|
||||
private fun getKaptDirectory(funName: String, project: Project, sourceSetName: String): String {
|
||||
val kotlinKaptPlugin = project.plugins.findPlugin("kotlin-kapt") ?: return ""
|
||||
|
||||
val targetMethod = kotlinKaptPlugin::class.java.methods.firstOrNull {
|
||||
Modifier.isStatic(it.modifiers) && it.name == funName && it.parameterCount == 2
|
||||
} ?: return ""
|
||||
|
||||
return (targetMethod(null, project, sourceSetName) as? File)?.absolutePath ?: ""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user