plugins {
    id "java"
    id "idea"
    id "org.jetbrains.intellij" version "1.9.0"
    id "pl.allegro.tech.build.axion-release" version "1.14.1"
}

group "net.ashald"

scmVersion {
    tag {
        prefix = "v"
        versionSeparator = ""
    }
}

allprojects {
    apply plugin: 'java'
    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories {
        mavenCentral()
    }
    project.version = scmVersion.version

    ext.jetbrains = [
            version : "2022.2",
            pycharm : "PythonCore:222.3345.40",
            rubymine: "org.jetbrains.plugins.ruby:222.3345.16",
            goland  : "org.jetbrains.plugins.go:222.3345.90",
            scala   : "org.intellij.scala:2022.2.3"
    ]
}

intellij {
    version = jetbrains.version
    pluginName = "EnvFile"
    sameSinceUntilBuild = false
    updateSinceUntilBuild = false
    downloadSources = true
    plugins = [
            // This doesn't make any sense as this plugin supposed to be only required on IDEA sub-module
            // but it doesn't build without it. Suspect a validation bug in JetBrains Gradle plugin.
            "java",
    ]
}
buildSearchableOptions.enabled = false

dependencies {
    implementation project(":envfile-products-idea")
    implementation project(":envfile-products-pycharm")
    implementation project(":envfile-products-rubymine")
    implementation project(":envfile-products-goland")
}

wrapper {
    gradleVersion = "7.5.1"
}

runIde.ideDir =  java.util.Optional.ofNullable(System.getenv("IDE")).map(File::new).orElse(null)

tasks {
    patchPluginXml {
        sinceBuild.set("201")
    }

}