From 71a4e6ed2acc10630a4f33d371ce1cdc9a4a2312 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Mon, 7 Apr 2025 02:49:18 +0300 Subject: [PATCH] Add local.properties to gitignore and register runCustomIde task using customIdePath property. (#973) Co-authored-by: a.iudin --- .gitignore | 1 + build.gradle.kts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.gitignore b/.gitignore index bd27c381..8a8efd1a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ build/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ +local.properties ### IntelliJ IDEA ### .idea/* diff --git a/build.gradle.kts b/build.gradle.kts index 6c570e3c..00df55fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,15 +1,25 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML +import org.jetbrains.intellij.tasks.RunIdeTask import java.io.FileInputStream import java.util.* +val localPropertiesFile = file("local.properties") val env = environment("env").getOrNull() fun loadProperties(filename: String): Properties = Properties().apply { load(FileInputStream(filename)) } +val localProperties: Properties? = if (localPropertiesFile.exists()) { + loadProperties("local.properties") +} else { + null +} + +val customIdePath: String? = localProperties?.getProperty("customIdePath") + fun properties(key: String): Provider { if ("win-arm64" == env) { val property = loadProperties("gradle-win-arm64.properties").getProperty(key) @@ -79,6 +89,29 @@ tasks.register("updateSubmodules") { commandLine("git", "submodule", "update", "--init", "--recursive") } +/** + * Task to run a custom IntelliJ IDEA sandbox. + * + * This task launches a custom IntelliJ IDEA installation using the path specified in the + * 'customIdePath' property from local.properties. + * + * IMPORTANT: + * - On macOS, the path must include the 'Contents' directory (e.g., /Applications/IntelliJ IDEA.app/Contents). + * - For Windows or Linux, specify the appropriate path to the IntelliJ IDEA installation. + * + * Usage: + * ./gradlew runCustomIde + */ +if (customIdePath != null) { + tasks.register("runCustomIde") { + group = "intellij" + description = "Start custom idea sandbox" + ideDir.set(file(customIdePath)) + environment("ENVIRONMENT", "LOCAL") + autoReloadPlugins.set(false) + } +} + tasks { wrapper { gradleVersion = properties("gradleVersion").get()