/**
 * 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

plugins {
    id("AndroidXPlugin")
    id("com.android.library")
}

ext {
    fontDir = project(":noto-emoji-compat-font").projectDir
}

android {
    sourceSets {
        main {
            assets.srcDirs new File(fontDir, "font").getAbsolutePath()
            resources {
                srcDirs += [fontDir.getAbsolutePath()]
                includes += ["LICENSE_UNICODE", "LICENSE_OFL"]
            }
        }

        androidTest {
            assets {
                srcDirs = [new File(fontDir, "supported-emojis").getAbsolutePath()]
            }
        }
    }
    namespace = "androidx.emoji2.bundled"

}

dependencies {
    api(libs.jspecify)
    api(project(":emoji2:emoji2"))

    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.espressoCore)
    androidTestImplementation(libs.mockitoCore)
    androidTestImplementation(libs.dexmakerMockito)
    androidTestImplementation(project(":internal-testutils-runtime"))

    // view tests that use font are in this module as well; for licensing reasons
    androidTestImplementation(project(":emoji2:emoji2-views"))
}

androidx {
    name = "Emoji2 Bundled"
    type = SoftwareType.PUBLISHED_LIBRARY
    inceptionYear = "2017"
    description = "Library bundled with assets to enable emoji compatibility in Kitkat and newer " +
            "devices to avoid the empty emoji characters."

    extraLicense {
        name = "SIL Open Font License, Version 1.1"
        url = "http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web"
    }

    extraLicense {
        name = "Unicode, Inc. License"
        url = "http://www.unicode.org/copyright.html#License"
    }
}
