/*
 * Copyright (C) 2024 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.
 */

/**
 * This file was created using the `create_project.py` script located in the
 * `<AndroidX root>/development/project-creator` directory.
 *
 * Please use that script when creating a new project, rather than copying an existing project and
 * modifying its settings.
 */
import androidx.build.LibraryType

plugins {
    id("AndroidXPlugin")
    id("AndroidXRepackagePlugin")
    id("java-library")
}

repackage {
    addRelocation {
        sourcePackage = "org.antlr"
        targetPackage = "androidx.room.jarjarred.org.antlr"
    }
    addRelocation {
        sourcePackage = "org.stringtemplate"
        targetPackage =  "androidx.room.jarjarred.org.stringtemplate"
    }
    artifactId = "room-external-antlr"
}

dependencies {
    repackage(libs.antlr4) {
        // antlr has dependencies on unrelated projects for its gui stuff, do not include them
        exclude group: "org.abego.treelayout"
        exclude group: "com.ibm.icu"
        exclude group: "org.glassfish"
    }
}

androidx {
    type = LibraryType.PUBLISHED_LIBRARY
    name = "Room External Antlr"
    inceptionYear = "2024"
    description =  "Repackaged antlr dependency for use by Room"
    doNotDocumentReason = "Repackaging only"
    license.name = "BSD-3-Clause"
    license.url = "https://opensource.org/licenses/BSD-3-Clause"
}
