/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'com.android.lint'
apply plugin: 'maven-publish'

lintOptions {
    htmlReport true
    htmlOutput file("lint-report.html")
    textReport true
    absolutePaths false
    ignoreTestSources true
}

java {
    withSourcesJar()
    withJavadocJar()

    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

dependencies {
    // For a description of the below dependencies, see the main project README
    compileOnly "com.android.tools.lint:lint-api:$lintVersion"
    // You typically don't need this one:
    compileOnly "com.android.tools.lint:lint-checks:$lintVersion"
    compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

    testImplementation "junit:junit:4.13.2"
    testImplementation "com.android.tools.lint:lint:$lintVersion"
    testImplementation "com.android.tools.lint:lint-tests:$lintVersion"
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId = 'com.android.security.lint'
            artifactId = 'lint'
            version = '1.0.3'

            from components.kotlin

            artifact sourcesJar
            artifact javadocJar

            pom {
                name = 'Android Security Lints'
                description = 'Custom security-focused experimental lint checks for Android development'
                url = 'https://github.com/google/android-security-lints'
                licenses {
                    license {
                        name = 'The Apache Software License, Version 2.0'
                        url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                        distribution = 'repo'
                    }
                }

                developers {
                    developer {
                        id = 'com.android.security.lint'
                        name = 'Android Security Lint Contributors'
                        url = 'https://github.com/google/android-security-lints'
                        organization = 'Google - Android 3P Vulnerability Research'
                        organizationUrl = 'https://www.google.com'
                    }
                }

                scm {
                    connection = 'scm:git:https://github.com/google/android-security-lints.git'
                    developerConnection = 'scm:git:git@github.com:google/android-security-lints.git'
                    url = 'https://github.com/google/android-security-lints'
                }
            }
        }
    }

    repositories {
        maven {
            url = layout.buildDirectory.dir('androidsecuritylints_m2repo')
        }
    }
}