mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
add missing Kotlin/Groovy snippets for Gradle build scripts
This commit is contained in:
parent
e8eb655752
commit
60fd4e8b09
@ -93,12 +93,29 @@ These JAR files are not available in plugin project dependencies, so the Intelli
|
||||
It's done by setting the `idea.home.path` system property to the absolute path of the checked out sources.
|
||||
In projects using Gradle it can be done by providing system property in the `test` task configuration:
|
||||
|
||||
|
||||
<tabs>
|
||||
<tab title="Kotlin">
|
||||
|
||||
```kotlin
|
||||
test {
|
||||
systemProperty("idea.home.path", "/path/to/intellij-community-sources")
|
||||
}
|
||||
```
|
||||
|
||||
</tab>
|
||||
<tab title="Groovy">
|
||||
|
||||
```groovy
|
||||
test {
|
||||
systemProperty "idea.home.path", "/path/to/intellij-community-sources"
|
||||
}
|
||||
```
|
||||
|
||||
</tab>
|
||||
</tabs>
|
||||
|
||||
|
||||
The default JDK version used by the test framework depends on the target platform version and is the latest supported version.
|
||||
The easiest way to change the JDK version to the custom is overriding the `LightJavaCodeInsightFixtureTestCase.getProjectDescriptor()` method and using one of the project descriptors predefined in `LightJavaCodeInsightFixtureTestCase`.
|
||||
If a project descriptor requires more customizations, its `getSdk()` method can use one of the [`IdeaTestUtil.getMockJdk*()`](upsource:///java/testFramework/src/com/intellij/testFramework/IdeaTestUtil.java) methods.
|
||||
@ -107,13 +124,15 @@ Sometimes testing a JVM language requires adding standard or other libraries to
|
||||
If a required library is available in the Maven repository, use [`MavenDependencyUtil`](upsource:///java/testFramework/src/com/intellij/testFramework/fixtures/MavenDependencyUtil.java), e.g.:
|
||||
|
||||
```java
|
||||
MavenDependencyUtil.addFromMaven(model,"org.jetbrains.kotlin:kotlin-stdlib:1.6.10");
|
||||
MavenDependencyUtil.addFromMaven(model,
|
||||
"org.jetbrains.kotlin:kotlin-stdlib:1.6.10");
|
||||
```
|
||||
|
||||
If a required library is an unpublished JAR file, use [`PsiTestUtil.addLibrary()`](upsource:///platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java) or `addProjectLibrary()` method and the JAR file path, e.g.:
|
||||
|
||||
```java
|
||||
PsiTestUtil.addLibrary(model,"kotlin-stdlib",getTestDataPath(),"kotlin-stdlib.jar");
|
||||
PsiTestUtil.addLibrary(model,
|
||||
"kotlin-stdlib", getTestDataPath(), "kotlin-stdlib.jar");
|
||||
```
|
||||
|
||||
> If a topic you are interested in is not covered in the above sections, let us know via the "**Was this page helpful?**" feedback form below or [other channels](getting_help.md#problems-with-the-guide).
|
||||
|
@ -19,6 +19,18 @@ The configuration of targeting GoLand IDE follows the methods described in [Conf
|
||||
|
||||
Starting with 2020.2, it's possible to configure `GO` for `intellij.type` in the Gradle build script.
|
||||
|
||||
<tabs>
|
||||
<tab title="Kotlin">
|
||||
|
||||
```kotlin
|
||||
intellij {
|
||||
version.set("2020.3")
|
||||
type.set("GO")
|
||||
}
|
||||
```
|
||||
|
||||
</tab>
|
||||
<tab title="Groovy">
|
||||
|
||||
```groovy
|
||||
intellij {
|
||||
@ -27,6 +39,10 @@ intellij {
|
||||
}
|
||||
```
|
||||
|
||||
</tab>
|
||||
</tabs>
|
||||
|
||||
|
||||
</tab>
|
||||
|
||||
<tab title="Using Plugin">
|
||||
|
@ -29,7 +29,7 @@ intellij {
|
||||
</tab>
|
||||
<tab title="Groovy">
|
||||
|
||||
```kotlin
|
||||
```groovy
|
||||
intellij {
|
||||
plugins = ['com.intellij.java']
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user