1+ import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
2+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
3+ import org.jetbrains.intellij.platform.gradle.models.ProductRelease
4+
5+ plugins {
6+ id(" java" ) // Java support
7+ alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
8+ id(" jacoco" ) // Code coverage
9+ id(" maven-publish" )
10+ }
11+
12+ group = " com.redhat.devtools.intellij"
13+ version = providers.gradleProperty(" projectVersion" ).get() // Plugin version
14+ val platformVersion = providers.gradleProperty(" ideaVersion" ).get()
15+ val exhortRepoUser: String? = findProperty(" gpr.username" ) as String?
16+ ? : System .getenv(" GITHUB_USERNAME" )
17+ val exhortRepoToken: String? = findProperty(" gpr.token" ) as String?
18+ ? : System .getenv(" GITHUB_TOKEN" )
19+
20+ // Set the JVM language level used to build the project.
21+ java {
22+ sourceCompatibility = JavaVersion .VERSION_17
23+ targetCompatibility = JavaVersion .VERSION_17
24+ withSourcesJar()
25+ withJavadocJar()
26+ }
27+
28+ repositories {
29+ mavenLocal()
30+ mavenCentral()
31+ intellijPlatform {
32+ defaultRepositories()
33+ }
34+ maven { url = uri(" https://jitpack.io" ) }
35+ maven {
36+ url = uri(" https://maven.pkg.github.com/trustification/exhort-java-api" )
37+ credentials {
38+ username = exhortRepoUser
39+ password = exhortRepoToken
40+ }
41+ }
42+ maven {
43+ url = uri(" https://maven.pkg.github.com/trustification/exhort-api-spec" )
44+ credentials {
45+ username = exhortRepoUser
46+ password = exhortRepoToken
47+ }
48+ }
49+ }
50+
51+ sourceSets {
52+ named(" main" ) {
53+ java.srcDir(" src/main/gen" )
54+ }
55+ }
56+
57+ dependencies {
58+ intellijPlatform {
59+ intellijIdeaCommunity(platformVersion)
60+
61+ // Bundled Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
62+ val platformBundledPlugins = ArrayList <String >()
63+ platformBundledPlugins.addAll(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ).map(String ::trim).filter(String ::isNotEmpty) }.get())
64+ /*
65+ * starting from 2024.3, all json related code is know on its own plugin
66+ */
67+ if (platformVersion.startsWith(" 2024.3" ) || platformVersion.startsWith(" 2025." ) || platformVersion.startsWith(" 25" )) {
68+ platformBundledPlugins.add(" com.intellij.modules.json" )
69+ }
70+ println (" use bundled Plugins: $platformBundledPlugins " )
71+ bundledPlugins(platformBundledPlugins)
72+
73+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
74+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
75+
76+ pluginVerifier()
77+ testFramework(TestFrameworkType .Platform )
78+ }
79+
80+ implementation(libs.github.api)
81+ implementation(libs.commons.compress)
82+ implementation(libs.exhort.api.spec)
83+ implementation(libs.exhort.java.api)
84+ implementation(libs.caffeine)
85+ implementation(libs.packageurl.java)
86+ implementation(libs.commons.io)
87+
88+ // for tests
89+ testImplementation(libs.junit)
90+ }
91+
92+ tasks {
93+ wrapper {
94+ gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
95+ }
96+
97+ runIde {
98+ systemProperties[" com.redhat.devtools.intellij.telemetry.mode" ] = " debug"
99+ }
100+ }
101+
102+ // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-tasks.html#runIdeForUiTests
103+ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
104+ task {
105+ systemProperties[" com.redhat.devtools.intellij.telemetry.mode" ] = " debug"
106+ }
107+ plugins {
108+ robotServerPlugin()
109+ }
110+ }
111+
112+ intellijPlatform {
113+ buildSearchableOptions = false // no custom settings, see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#how-to-disable-building-the-searchable-options
114+ }
0 commit comments