[Deprecated] Migrate bunch of imports with detekt
Jun 5, 2017
1 minute read

Lately I had to migrate a ton of imports because of the dependency change from just kotlin-compiler to the embedabble-kotlin-compiler. Actually your idea can search-replace within your project but only one import after the other. Detekt allows to us to write down the migration list inside a yaml file and do the migration for us. Less typing!

Thats the migration yaml part:

# Migration rules can be defined in the same config file or a new one
migration:
  active: true
  imports:
    com.intellij.lang.ASTNode: org.jetbrains.kotlin.com.intellij.lang.ASTNode
    com.intellij.psi.PsiElement: org.jetbrains.kotlin.com.intellij.psi.PsiElement
    com.intellij.openapi.util.TextRange: org.jetbrains.kotlin.com.intellij.openapi.util.TextRange
    com.intellij.testFramework.LightVirtualFile: org.jetbrains.kotlin.com.intellij.testFramework.LightVirtualFile
    com.intellij.mock.MockProject: org.jetbrains.kotlin.com.intellij.mock.MockProject
    com.intellij.openapi.extensions.ExtensionPoint: org.jetbrains.kotlin.com.intellij.openapi.extensions.ExtensionPoint
    com.intellij.openapi.extensions.Extensions: org.jetbrains.kotlin.com.intellij.openapi.extensions.Extensions
    com.intellij.openapi.util.Disposer: org.jetbrains.kotlin.com.intellij.openapi.util.Disposer
    com.intellij.openapi.util.UserDataHolderBase: org.jetbrains.kotlin.com.intellij.openapi.util.UserDataHolderBase
    com.intellij.pom.PomModel: org.jetbrains.kotlin.com.intellij.pom.PomModel
    com.intellij.pom.PomModelAspect: org.jetbrains.kotlin.com.intellij.pom.PomModelAspect
    com.intellij.pom.PomTransaction: org.jetbrains.kotlin.com.intellij.pom.PomTransaction
    com.intellij.pom.impl.PomTransactionBase: org.jetbrains.kotlin.com.intellij.pom.impl.PomTransactionBase
    com.intellij.pom.tree.TreeAspect: org.jetbrains.kotlin.com.intellij.pom.tree.TreeAspect
    com.intellij.psi.impl.source.tree.TreeCopyHandler: org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeCopyHandler
    com.intellij.psi.util.PsiTreeUtil: org.jetbrains.kotlin.com.intellij.psi.util.PsiTreeUtil
    com.intellij.psi.PsiWhiteSpace: org.jetbrains.kotlin.com.intellij.psi.PsiWhiteSpace
    com.intellij.psi.impl.source.tree.LeafPsiElement: org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafPsiElement
    com.intellij.openapi.util.Key: org.jetbrains.kotlin.com.intellij.openapi.util.Key
    com.intellij.util.keyFMap.KeyFMap: org.jetbrains.kotlin.com.intellij.util.keyFMap.KeyFMap
    com.intellij.psi.PsiFileFactory: org.jetbrains.kotlin.com.intellij.psi.PsiFileFactory
    com.intellij.psi.PsiFile: org.jetbrains.kotlin.com.intellij.psi.PsiFile
    com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl: org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl
    com.intellij.psi.PsiComment: org.jetbrains.kotlin.com.intellij.psi.PsiComment
    com.intellij.psi.impl.source.tree.TreeElement: org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement
    com.intellij.psi.tree.TokenSet: org.jetbrains.kotlin.com.intellij.psi.tree.TokenSet
    com.intellij.psi.impl.source.codeStyle.CodeEditUtil: org.jetbrains.kotlin.com.intellij.psi.impl.source.codeStyle.CodeEditUtil
    com.intellij.psi.impl.source.tree.CompositeElement: org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.CompositeElement