mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
custom language tutorial: update refs to the Gradle build script to 2.x
This commit is contained in:
parent
388002204c
commit
8aa6b7440d
@ -21,31 +21,20 @@ This section adds annotation functionality to support the Simple Language in the
|
||||
## Required Project Configuration Changes
|
||||
|
||||
Classes defined in this step of the tutorial depend on `com.intellij.psi.PsiLiteralExpression` (the PSI representation for String literals in Java code) at runtime.
|
||||
Using `PsiLiteralExpression` [introduces a dependency](plugin_compatibility.md#modules-specific-to-functionality) on `com.intellij.java`.
|
||||
|
||||
A dependency on the Java plugin [must be declared explicitly](plugin_compatibility.md#java).
|
||||
A dependency on the [Java plugin](idea.md#java) must be [declared explicitly](plugin_dependencies.md).
|
||||
First, add a dependency on the Java plugin in the Gradle build script:
|
||||
|
||||
<tabs>
|
||||
<tab title="Kotlin">
|
||||
|
||||
```kotlin
|
||||
intellij {
|
||||
plugins.set(listOf("com.intellij.java"))
|
||||
dependencies {
|
||||
intellijPlatform {
|
||||
// ...
|
||||
bundledPlugin("com.intellij.java")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</tab>
|
||||
<tab title="Groovy">
|
||||
|
||||
```groovy
|
||||
intellij {
|
||||
plugins = ['com.intellij.java']
|
||||
}
|
||||
```
|
||||
|
||||
</tab>
|
||||
</tabs>
|
||||
See <path>[build.gradle.kts](%gh-sdk-samples-master%/simple_language_plugin/build.gradle.kts)</path> for the reference.
|
||||
|
||||
Then, declare the dependency in <path>[plugin.xml](plugin_configuration_file.md)</path> (use code insight)
|
||||
|
||||
|
@ -81,25 +81,18 @@ This step generates a parser and PSI elements in the <path>/src/main/gen</path>
|
||||
|
||||
## Add Generated Sources Root
|
||||
|
||||
To include the sources generated into <path>/src/main/gen</path>, the project's `sourceSets` must be expanded by inserting the following line in the project's Gradle build script:
|
||||
|
||||
<tabs>
|
||||
<tab title="Kotlin">
|
||||
To include the sources generated into <path>/src/main/gen</path>, the project's `sourceSets` must be expanded by inserting the following in the Gradle build script:
|
||||
|
||||
```kotlin
|
||||
sourceSets["main"].java.srcDirs("src/main/gen")
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs("src/main/gen")
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</tab>
|
||||
<tab title="Groovy">
|
||||
|
||||
```groovy
|
||||
sourceSets.main.java.srcDirs 'src/main/gen'
|
||||
```
|
||||
|
||||
</tab>
|
||||
</tabs>
|
||||
|
||||
See <path>[build.gradle.kts](%gh-sdk-samples-master%/simple_language_plugin/build.gradle.kts)</path> for the reference.
|
||||
|
||||
Reload the Gradle project for changes to take effect and build the project.
|
||||
|
Loading…
x
Reference in New Issue
Block a user