mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
[IntelliJ Platform Gradle Plugin] Recipes: task awares example
This commit is contained in:
parent
d02559f237
commit
70d3b0861a
2
ijs.tree
2
ijs.tree
@ -432,7 +432,7 @@
|
|||||||
<toc-element topic="tools_intellij_platform_gradle_plugin_gradle_properties.md"/>
|
<toc-element topic="tools_intellij_platform_gradle_plugin_gradle_properties.md"/>
|
||||||
<toc-element topic="tools_intellij_platform_gradle_plugin_jetbrains_runtime.md"/>
|
<toc-element topic="tools_intellij_platform_gradle_plugin_jetbrains_runtime.md"/>
|
||||||
<toc-element topic="tools_intellij_platform_gradle_plugin_migration.md"/>
|
<toc-element topic="tools_intellij_platform_gradle_plugin_migration.md"/>
|
||||||
<toc-element topic="tools_intellij_platform_gradle_plugin_recipies.md"/>
|
<toc-element topic="tools_intellij_platform_gradle_plugin_recipes.md"/>
|
||||||
<toc-element topic="tools_intellij_platform_gradle_plugin_faq.md" toc-title="Frequently Asked Questions"/>
|
<toc-element topic="tools_intellij_platform_gradle_plugin_faq.md" toc-title="Frequently Asked Questions"/>
|
||||||
</toc-element>
|
</toc-element>
|
||||||
<toc-element topic="tools_gradle_grammar_kit_plugin.md"/>
|
<toc-element topic="tools_gradle_grammar_kit_plugin.md"/>
|
||||||
|
@ -294,7 +294,7 @@ intellijPlatform { ... }
|
|||||||
```
|
```
|
||||||
|
|
||||||
The plugin also introduces a task listener which allows for creating custom tasks decorated with [](tools_intellij_platform_gradle_plugin_task_awares.md).
|
The plugin also introduces a task listener which allows for creating custom tasks decorated with [](tools_intellij_platform_gradle_plugin_task_awares.md).
|
||||||
See [](tools_intellij_platform_gradle_plugin_recipies.md) for more details.
|
See [](tools_intellij_platform_gradle_plugin_recipes.md) for more details.
|
||||||
|
|
||||||
### Available tasks
|
### Available tasks
|
||||||
{#base-available-tasks}
|
{#base-available-tasks}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<link-summary>Recipes for solving particular tasks with IntelliJ Platform Gradle Plugin</link-summary>
|
<link-summary>Recipes for solving particular tasks with IntelliJ Platform Gradle Plugin</link-summary>
|
||||||
|
|
||||||
## Run custom task with customized sandbox location
|
## Run a custom task with customized sandbox location
|
||||||
|
|
||||||
To create a custom task with the sandbox directory specified outside of the default <path>build/idea-sandbox/[TYPE]-[VERSION]/</path> location, pass the new location to its `prepareSandboxTask` sandbox producer configuration:
|
To create a custom task with the sandbox directory specified outside of the default <path>build/idea-sandbox/[TYPE]-[VERSION]/</path> location, pass the new location to its `prepareSandboxTask` sandbox producer configuration:
|
||||||
|
|
||||||
@ -30,3 +30,20 @@ build/
|
|||||||
│ └── system
|
│ └── system
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Access IntelliJ Platform from any Gradle task
|
||||||
|
|
||||||
|
With [](tools_intellij_platform_gradle_plugin_task_awares.md) it is possible to enhance any Gradle task with features provided with the IntelliJ Platform Gradle Plugin.
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
abstract class MyTask : DefaultTask(), IntelliJPlatformVersionAware
|
||||||
|
|
||||||
|
val myTask by tasks.registering(MyTask::class) {
|
||||||
|
doLast {
|
||||||
|
println("platformPath = \n${platformPath}")
|
||||||
|
println("productInfo.buildNumber = ${productInfo.buildNumber}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
As soon as the registered task inherits from the `*Aware` interface, such as [`IntelliJPlatformVersionAware`](tools_intellij_platform_gradle_plugin_task_awares.md#IntelliJPlatformVersionAware), all the related information will be injected during the configuration phase.
|
Loading…
x
Reference in New Issue
Block a user