plugins {
    id 'java'
    id 'org.jetbrains.intellij' version '0.4.9'
    id 'org.jetbrains.kotlin.jvm' version '1.3.31'
    id 'jacoco'
    id 'com.github.kt3k.coveralls' version '2.8.2'
}

group 'de.platon42'
version '1.1'

repositories {
    mavenCentral()
}

/*
  To run tests in IntelliJ use these VM Options for run configuration 
  -ea -Didea.system.path=build/idea-sandbox/system-test -Didea.config.path=build/idea-sandbox/config-test -Didea.plugins.path=build/idea-sandbox/plugins-test
 */

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    testCompile "org.assertj:assertj-core:3.12.2"
    testCompile "org.assertj:assertj-guava:3.2.1"
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.0-RC1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.0-RC1'
    testImplementation "org.jetbrains.kotlin:kotlin-test"
//    testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
intellij {
    version '2019.1.2'
//    pluginName 'Concise AssertJ Optimizing Nitpicker (Cajon)'
    updateSinceUntilBuild false
}

patchPluginXml {
    changeNotes """
  <h4>V1.1 (09-Jun-19)</h4>
    <ul>
      <li>Improved JoinAssertThatStatements detection of expressions with side-effects and added pre/post-increment/decrement detection.
      <li>Added Guava Optional opt.orNull() == null case. You know, I'm not making this stuff up, people actually write this kind of code.
      <li>Added Java 8 Optional opt.orElse(null) == null case, too.
      <li>Extended JUnitAssertToAssertJ inspection to convert JUnit assume statements, too.
      <li>Improved JUnitAssertToAssertJ quick fix to swap expected and actual expressions if the actual one is a constant.
      <li>New ImplicitAssertion inspection for implicit isNotNull(), isNotEmpty() and isPresent() assertions that will be covered by chained assertions.
      <li>Fix for multiple JUnit Conversions in batch mode with and without delta creating an exception.
      <li>Added new AssertThatObjectExpression inspection for toString() and hashCode() and moved equals() from AssertThatBinaryExpression there.
    </ul>
  <p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
"""
}

test {
    useJUnitPlatform()
    testLogging {
        events "passed", "skipped", "failed"
    }
}

jacoco {
    toolVersion = '0.8.3'
}

jacocoTestReport {
    reports {
        xml.enabled true
        csv.enabled false
    }
}

publishPlugin {
    token intellijPublishToken
}