From 8aa6b7440d677c9d5dff83906a2d4a7d27b844a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Tue, 29 Apr 2025 17:19:01 +0200 Subject: [PATCH] custom language tutorial: update refs to the Gradle build script to 2.x --- .../custom_language_support/annotator.md | 25 ++++++------------- .../grammar_and_parser.md | 23 ++++++----------- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/topics/tutorials/custom_language_support/annotator.md b/topics/tutorials/custom_language_support/annotator.md index c7aaf4e88..16039e9d4 100644 --- a/topics/tutorials/custom_language_support/annotator.md +++ b/topics/tutorials/custom_language_support/annotator.md @@ -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: - - - ```kotlin -intellij { - plugins.set(listOf("com.intellij.java")) +dependencies { + intellijPlatform { + // ... + bundledPlugin("com.intellij.java") + } } ``` - - - -```groovy -intellij { - plugins = ['com.intellij.java'] -} -``` - - - +See [build.gradle.kts](%gh-sdk-samples-master%/simple_language_plugin/build.gradle.kts) for the reference. Then, declare the dependency in [plugin.xml](plugin_configuration_file.md) (use code insight) diff --git a/topics/tutorials/custom_language_support/grammar_and_parser.md b/topics/tutorials/custom_language_support/grammar_and_parser.md index b3250e7aa..64b264ece 100644 --- a/topics/tutorials/custom_language_support/grammar_and_parser.md +++ b/topics/tutorials/custom_language_support/grammar_and_parser.md @@ -81,25 +81,18 @@ This step generates a parser and PSI elements in the /src/main/gen ## Add Generated Sources Root -To include the sources generated into /src/main/gen, the project's `sourceSets` must be expanded by inserting the following line in the project's Gradle build script: - - - +To include the sources generated into /src/main/gen, 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") + } + } +} ``` - - - -```groovy -sourceSets.main.java.srcDirs 'src/main/gen' -``` - - - - See [build.gradle.kts](%gh-sdk-samples-master%/simple_language_plugin/build.gradle.kts) for the reference. Reload the Gradle project for changes to take effect and build the project.