/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

apply plugin: 'java-library'
apply plugin: 'kotlin'

targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17

repositories {
    if (project.hasProperty("centralRepo")) {
        maven {
            name "MavenCentral"
            url project.property("centralRepo")
            allowInsecureProtocol true // Local Nexus in CI uses HTTP
        }
    } else {
        mavenCentral()
    }
}

dependencies {
    // I didn't look thoroughly enough to really know what's going on here but I think
    // the lint API uses jdk8 so if we provide jdk7, the dependency collision system
    // doesn't work and there are duplicate APIs with different versions in the output.
    //
    // The prepareLintJar task fails with "Found more than one jar in the 'lintChecks' configuration"
    // if we include the stdlib (with implementation) so we have to do compileOnly + testImplementation.
    compileOnly libs.kotlin.stdlib.jdk8
    compileOnly libs.kotlin.reflect
    testImplementation libs.kotlin.stdlib.jdk8
    testImplementation libs.kotlin.reflect

    compileOnly libs.lint.api
    compileOnly libs.lint.checks

    testImplementation libs.junit
    testImplementation libs.lint.api
    testImplementation libs.lint.tests
}

jar {
    manifest {
        attributes('Lint-Registry-v2': 'org.midorinext.android.lintrules.LintIssueRegistry')
    }
}
