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

apply plugin: 'AndroidXPlugin'
apply plugin: 'com.android.library'

ext {
    yuvSourceDir = "${project.rootDir.absolutePath}/../../external/libyuv"
}

android {
    defaultConfig {
        externalNativeBuild {
            cmake {
                arguments "-DCMAKE_VERBOSE_MAKEFILE=ON"
                // Build only the static library target
                targets "yuv"
            }
        }
    }

    externalNativeBuild {
        cmake {
            version = libs.versions.cmake.get()
            path "${yuvSourceDir}/CMakeLists.txt"
        }
    }

    // Enable generation of Prefab packages and include them in the library's AAR.
    buildFeatures {
        prefabPublishing = true
    }

    // Include the "libyuv" module from the native build system in the AAR,
    // and export the headers in include to its consumers
    prefab {
        libyuv {
            headers = "${yuvSourceDir}/include"
            name = "yuv"
        }
    }
    namespace = "com.google.libyuv"
}

androidx {
    name = "libyuv"
    // Only intended to be used as snapshots, do not change to PUBLISHED.
    type = SoftwareType.SNAPSHOT_ONLY_LIBRARY
    inceptionYear = "2021"
    description = "libyuv is an open source project that includes YUV scaling and conversion functionality."
}
