/*
 * 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 = "com.google.protobuf"
        targetPackage = "androidx.glance.appwidget.protobuf"
    }
    artifactId = "glance-appwidget-external-protobuf"
}

dependencies {
    repackage(libs.protobufLite)
}

androidx {
    name = "Glance AppWidget External Protobuf"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2024"
    description =  "Repackaged proto-lite dependency for use by galnce"
    doNotDocumentReason = "Repackaging only"
    license.name = "BSD-3-Clause"
    license.url = "https://opensource.org/licenses/BSD-3-Clause"
}
