Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to IntelliJ Platform V2 #386

Merged
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e06a3ee
Update gradle properties and version
pderakhshanfar Oct 11, 2024
61de6a9
Update root project's build.gradle.kts
pderakhshanfar Oct 11, 2024
efe2804
Update other modules' build.gradle.kts
pderakhshanfar Oct 11, 2024
801196c
Resolve ktlint issues
pderakhshanfar Oct 11, 2024
6d04ca4
Fix parsing default setting value issue in the new version
pderakhshanfar Oct 11, 2024
bae0d45
Update Run IDE for UI test run config based on new tasks
pderakhshanfar Oct 11, 2024
788f78e
Fix plugin versioning on build.gradle.kts
pderakhshanfar Oct 11, 2024
993f68c
Add pluginVerification task
pderakhshanfar Oct 11, 2024
92b75ec
Remove signPlugin ToDo: signPlugging seems working without any change
pderakhshanfar Oct 11, 2024
93c633e
Move signing properties to intellijPlatform block
pderakhshanfar Oct 11, 2024
3438494
Add secrets to build workflow
pderakhshanfar Oct 11, 2024
024ef30
Remove redundant IDE preparation step in build workflow
pderakhshanfar Oct 11, 2024
751b237
Fix testing job failure
pderakhshanfar Oct 11, 2024
81ecae9
Add environment variables for plugin verification tasks
pderakhshanfar Oct 11, 2024
8ac3eda
Changed the Gradle task from `runPluginVerifier` to `verifyPlugin` in…
pderakhshanfar Oct 11, 2024
db7196f
Update run IDE command in CONTRIBUTING.md
pderakhshanfar Oct 11, 2024
28ad61c
Refactor signing configuration to use `signPlugin` block.
pderakhshanfar Oct 11, 2024
6582ffa
Remove redundant environment variables from build.yml
pderakhshanfar Oct 11, 2024
f600741
Add references and comments for repositories and verification section…
pderakhshanfar Oct 11, 2024
321f7e0
Add comments to `get` method to handle DynamicBundle values
pderakhshanfar Oct 11, 2024
033d3c2
Merge branch 'development' into pderakhshanfar/refactoring/gradle-ij-…
pderakhshanfar Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ jobs:
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT

./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier


# Run tests
- name: Run Tests
Expand All @@ -102,7 +100,7 @@ jobs:

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
run: ./gradlew verifyPlugin

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand Down
4 changes: 2 additions & 2 deletions .run/Run IDE for UI Tests.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="scriptParameters" value="--refresh-dependencies --stacktrace" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":runIdeForUiTests" />
<option value=":runIde" />
</list>
</option>
<option name="vmOptions" />
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ to include test generation using Grazie in the build process, you need to pass S

## Run IDE for UI tests
In IDEA, run the `Run IDE for UI Tests` configuration. Alternatively, use the following command:
`gradle runIdeForUiTests`.
`gradle runIde`.

### Including Test generation using Grazie (for JetBrains employees only!)
to include test generation using Grazie in the runIdeForUiTests process, you need to pass Space username and token as properties:
`gradle runIdeForUiTests -Dspace.username=<USERNAME> -Dspace.pass=<TOKEN>`.
`gradle runIde -Dspace.username=<USERNAME> -Dspace.pass=<TOKEN>`.

`<TOKEN>` is generated by Space, which has access to Automatically generating unit tests maven packages.

Expand Down
114 changes: 69 additions & 45 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.tasks.RunIdeTask
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
import org.jetbrains.intellij.platform.gradle.tasks.RunIdeTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileOutputStream
import java.net.URL
Expand All @@ -25,7 +28,9 @@ plugins {
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.9.0"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij") version "1.15.0"
id("org.jetbrains.intellij.platform") version "2.1.0"
// Gradle IntelliJ Plugin Migration Help (uncomment it for migration tips)
// id("org.jetbrains.intellij.platform.migration") version "2.1.0"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "2.1.2"
// Gradle Qodana Plugin
Expand All @@ -37,6 +42,10 @@ version = properties("pluginVersion")
// Configure project's dependencies
repositories {
mavenCentral()
// this part is mandatory for all modules for platform version 2
intellijPlatform {
pderakhshanfar marked this conversation as resolved.
Show resolved Hide resolved
defaultRepositories()
}
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
maven("https://www.jetbrains.com/intellij-repository/snapshots")

Expand Down Expand Up @@ -66,6 +75,13 @@ if (spaceCredentialsProvided()) {
usingSourceSet(hasGrazieAccess)
}

// Add the dependencies for the new source set
dependencies {
add(hasGrazieAccess.implementationConfigurationName, kotlin("stdlib"))
add(hasGrazieAccess.implementationConfigurationName, "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
add(hasGrazieAccess.implementationConfigurationName, "org.jetbrains.research:grazie-test-generation:$grazieTestGenerationVersion")
}

tasks.register("checkCredentials") {
configurations.detachedConfiguration(
dependencies.create("org.jetbrains.research:grazie-test-generation:$grazieTestGenerationVersion"),
Expand All @@ -77,7 +93,7 @@ if (spaceCredentialsProvided()) {
}

// add build of new source set as the part of UI testing
tasks.prepareUiTestingSandbox.configure {
tasks.prepareTestSandbox.configure {
dependsOn(hasGrazieAccess.jarTaskName)
from(tasks.getByName(hasGrazieAccess.jarTaskName).outputs.files.asPath) { into("TestSpark/lib") }

Expand All @@ -99,6 +115,20 @@ if (spaceCredentialsProvided()) {
}

dependencies {
// Check platform V2 documentation for more details: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
// make a custom version of IDEA
create(properties("platformType"), properties("platformVersion"))
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
bundledPlugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

pluginVerifier()
zipSigner()
instrumentationTools()

testFramework(TestFrameworkType.Bundled)
}

implementation(files("lib/evosuite-${properties("evosuiteVersion")}.jar"))
implementation(files("lib/standalone-runtime.jar"))
implementation(files("lib/jacocoagent.jar"))
Expand Down Expand Up @@ -169,23 +199,40 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-test:1.8.0")

implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
}

if (spaceCredentialsProvided()) {
// Dependencies for hasGrazieAccess variant
"hasGrazieAccessImplementation"(kotlin("stdlib"))
"hasGrazieAccessImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
"hasGrazieAccessImplementation"("org.jetbrains.research:grazie-test-generation:$grazieTestGenerationVersion")
// Configure Gradle IntelliJ Plugin - read more: // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellijPlatform {
pluginConfiguration {
name = properties("pluginName")
version = properties("pluginVersion")

ideaVersion {
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
}
}
}

// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
publishing {
token = System.getenv("PUBLISH_TOKEN")
channels = listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first())
}

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
pluginVerification {
ides {
recommended()
pderakhshanfar marked this conversation as resolved.
Show resolved Hide resolved
select {
types = listOf(IntelliJPlatformType.IntellijIdeaUltimate)
channels = listOf(ProductRelease.Channel.RELEASE)
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
}
}
freeArgs = listOf(
"-mute",
"TemplateWordInPluginId,ForbiddenPluginIdPrefix"
)
}
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
Expand Down Expand Up @@ -232,11 +279,13 @@ tasks {
}
}

patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
signPlugin {
certificateChain.set(providers.environmentVariable("CERTIFICATE_CHAIN"))
privateKey.set(providers.environmentVariable("PRIVATE_KEY"))
password.set(providers.environmentVariable("PRIVATE_KEY_PASSWORD"))
}

patchPluginXml {
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription.set(
projectDir.resolve("README.md").readText().lines().run {
Expand All @@ -260,33 +309,8 @@ tasks {
)
}

// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
systemProperty("idea.trust.all.projects", "true")
systemProperty("ide.show.tips.on.startup.default.value", "false")
systemProperty("jb.consents.confirmation.enabled", "false")
systemProperty("ide.mac.file.chooser.native", "false")
systemProperty("apple.laf.useScreenMenuBar", "false")
}

signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN").trimIndent())
privateKey.set(System.getenv("PRIVATE_KEY").trimIndent())
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}

publishPlugin {
dependsOn("patchChangelog")
token.set(System.getenv("PUBLISH_TOKEN"))
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
}
}

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
pderakhshanfar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ evosuiteVersion = 1.0.5
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 241
pluginUntilBuild = 241.*
pluginUntilBuild = 242.*

# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType = IC
platformVersion = 2024.1
platformVersion = 2024.2.3

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = com.intellij.java, org.jetbrains.kotlin, maven, gradle
platformPlugins = com.intellij.java, org.jetbrains.kotlin, org.jetbrains.idea.maven, com.intellij.gradle

# Java language level used to compile sources and to generate the files for - Java 17 is required since 2023.1
javaVersion = 17

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.2.1
gradleVersion = 8.10.2

# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
27 changes: 16 additions & 11 deletions java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
plugins {
kotlin("jvm")
id("org.jetbrains.intellij")
id("org.jetbrains.intellij.platform")
}

repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

dependencies {
intellijPlatform {
create(rootProject.properties["platformType"].toString(), rootProject.properties["platformVersion"].toString())
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
bundledPlugins(listOf("com.intellij.java"))

instrumentationTools()
}
implementation(kotlin("stdlib"))

implementation(project(":langwrappers")) // Interfaces that cover language-specific logic
implementation(project(":core"))
}

intellij {
rootProject.properties["platformVersion"]?.let { version.set(it.toString()) }
plugins.set(listOf("java"))
intellijPlatform {
pluginConfiguration {
rootProject.properties["platformVersion"]?.let { version = it.toString() }
}
}

tasks.named("verifyPlugin") { enabled = false }
tasks.named("runIde") { enabled = false }
tasks.named("runPluginVerifier") { enabled = false }

tasks {
buildSearchableOptions {
enabled = false
}
}
tasks.named("prepareJarSearchableOptions") { enabled = false }

kotlin {
jvmToolchain(rootProject.properties["jvmToolchainVersion"].toString().toInt())
Expand Down
22 changes: 17 additions & 5 deletions kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
plugins {
kotlin("jvm")
id("org.jetbrains.intellij")
id("org.jetbrains.intellij.platform")
}

repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

dependencies {

intellijPlatform {
create(rootProject.properties["platformType"].toString(), rootProject.properties["platformVersion"].toString())
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
bundledPlugins(listOf("com.intellij.java", "org.jetbrains.kotlin"))

instrumentationTools()
}
implementation(kotlin("stdlib"))

implementation(project(":langwrappers")) // Interfaces that cover language-specific logic
implementation(project(":core"))
}

intellij {
rootProject.properties["platformVersion"]?.let { version.set(it.toString()) }
plugins.set(listOf("java", "org.jetbrains.kotlin"))
intellijPlatform {
pluginConfiguration {
rootProject.properties["platformVersion"]?.let { version = it.toString() }
}
}

tasks.named("verifyPlugin") { enabled = false }
tasks.named("runIde") { enabled = false }
tasks.named("runPluginVerifier") { enabled = false }
tasks.named("prepareJarSearchableOptions") { enabled = false }

tasks {
buildSearchableOptions {
Expand Down
Loading
Loading