plugins {
    id 'org.jetbrains.intellij' version '1.13.3'
    id 'org.jetbrains.kotlin.jvm' version "1.9.10"
    id 'java'
}

group 'com.open.xcoder'
version '1.0.0'

repositories {
    maven {
        url 'https://maven.aliyun.com/repository/public/'
    }
    mavenLocal()
    mavenCentral()
    maven { url "https://www.jetbrains.com/intellij-repository/releases" }
    maven { url "https://www.jetbrains.com/intellij-repository/snapshots" }
    maven { url "https://cache-redirector.jetbrains.com/intellij-dependencies" }
}


dependencies {
    implementation('org.eclipse.jgit:org.eclipse.jgit:6.5.0.202303070854-r') {
        exclude group: 'org.slf4j', module: 'slf4j-api'
    }
    implementation group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
    implementation group: 'com.auth0', name: 'java-jwt', version: '4.4.0'
    implementation group: 'com.squareup.okhttp3', name: 'okhttp-sse', version: '4.11.0'
    implementation("com.vladsch.flexmark:flexmark-all:0.64.8") {
        exclude group: "org.jsoup", module: "jsoup"
        exclude group: "com.ibm.icu", module: "icu4j"
    }
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.3")
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2")
    implementation("com.googlecode.java-diff-utils:diffutils:1.3.0")

    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
    testImplementation 'org.mockito:mockito-core:5.2.0'
    testImplementation 'org.mockito:mockito-inline:5.2.0'
    testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0'
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
//goPlugin:org.jetbrains.plugins.go
intellij {
    var pluginType = 'IC'
    type = pluginType
    pluginName = 'Open-XCoder'
    updateSinceUntilBuild = false
//    version = '2021.2.1'
//    var pluginVersion = '212.5080.55'
    version = '2022.2'
    var pluginVersion = '222.3345.118'
    plugins.add("java")
    if (pluginType == 'IC') {
        plugins.add("PythonCore:" + pluginVersion)
        plugins.add("org.jetbrains.plugins.go:" + pluginVersion)
    }
    if (pluginType == 'IU') {
        plugins.add("Pythonid:" + pluginVersion)
        plugins.add("org.jetbrains.plugins.go:" + pluginVersion)
    }
    if (pluginType == 'GO') {
        plugins.add("Pythonid:" + pluginVersion)
    }
    if (pluginType == 'PY') {
        plugins.add("org.jetbrains.plugins.go:" + pluginVersion)
    }
    if (pluginType == 'PC') {
        plugins.add("org.jetbrains.plugins.go:" + pluginVersion)
    }
}
patchPluginXml {
//    sinceBuild = '203'
//    untilBuild = '221.*'
    sinceBuild = '222'
    untilBuild = '241.*'
}
test {
    useJUnitPlatform()
}