首页 > 解决方案 > 如何在我的 Gradle 插件上使用 PSI/UAST

问题描述

我正在编写一个 Gradle 插件,它应该检查一些 Kotlin 文件并根据该检查报告一些数据。我计划使用 UAST 来执行检查,遵循 Android 中的 Lint 工具所做的(https://github.com/JetBrains/uasthttps://groups.google.com/forum/#!topic/lint-开发/7nLiXa04baM)。但是,我找不到将 UAST 甚至 PSI 添加到我的 Gradle 插件的方法或任何在线资源。有什么帮助吗?

标签: gradleintellij-ideakotlingradle-plugin

解决方案


我建议将此添加到您的存储库(版本是那些 atm - 在此处查看最新版本):

repositories {
    maven { url "https://dl.bintray.com/kotlin/uast/"}
}

这对您的依赖项:

dependencies {
  implementation "org.jetbrains.uast:uast-kotlin:1.0.10"
}

如果您进入 MPP,您可以添加:

  implementation "org.jetbrains.uast:uast-common:1.0.12"
  implementation "org.jetbrains.uast:uast-java:1.0.12"

但不要忘记 UAST 仍然是基于 jvm 的,AFAIK

对于 Intellij 插件,还有其他用于测试并将其与 Idea 集成的工具。进口的也在这里


推荐阅读