Add local.properties to gitignore and register runCustomIde task using customIdePath property. (#973)

Co-authored-by: a.iudin <a.iudin@vk.team>
This commit is contained in:
Aleksandr 2025-04-07 02:49:18 +03:00 committed by Carl-Robert Linnupuu
parent 6608005931
commit 71a4e6ed2a
2 changed files with 34 additions and 0 deletions

1
.gitignore vendored
View file

@ -11,6 +11,7 @@ build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
local.properties
### IntelliJ IDEA ###
.idea/*

View file

@ -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<String> {
if ("win-arm64" == env) {
val property = loadProperties("gradle-win-arm64.properties").getProperty(key)
@ -79,6 +89,29 @@ tasks.register<Exec>("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<RunIdeTask>("runCustomIde") {
group = "intellij"
description = "Start custom idea sandbox"
ideDir.set(file(customIdePath))
environment("ENVIRONMENT", "LOCAL")
autoReloadPlugins.set(false)
}
}
tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()