from os import environ
from dataclasses import dataclass, field

@dataclass
class ModuleConfig:
    dirs: list[str]
    gradlew_location: str = ""
    gradlew_target: str = ""
    excludes: list[str] = field(default_factory=list)

TestModuleMapping: dict[str, ModuleConfig] = {
    "CarrierDefaultAppUnitTests": ModuleConfig(["frameworks/base/packages/CarrierDefaultApp/tests/"]),
    "DynamicSystemInstallationServiceTests": ModuleConfig(["frameworks/base/packages/DynamicSystemInstallationService/tests/"]),
    "ExternalStorageProviderTests": ModuleConfig(["frameworks/base/packages/ExternalStorageProvider/tests/"]),
    "FusedLocationTests": ModuleConfig(["frameworks/base/packages/FusedLocation/test/src/com/android/location/fused/tests/"]),
    "FusedLocationTests": ModuleConfig(["frameworks/base/packages/FusedLocation/test/src/com/android/location/gnss/tests/"]),
    "OverlayTests": ModuleConfig(["frameworks/base/packages/overlays/tests/"]),
    "PrintSpoolerOutOfProcessTests": ModuleConfig(["frameworks/base/packages/PrintSpooler/tests/"]),
    "SettingsLibDataStoreTest": ModuleConfig(["frameworks/base/packages/SettingsLib/DataStore/tests/"]),
    "SpaPrivilegedLibTests": ModuleConfig(["frameworks/base/packages/SettingsLib/SpaPrivileged/tests/"]),
    "SpaScreenshotTests": ModuleConfig(["frameworks/base/packages/SettingsLib/Spa/screenshot/"]),
    "SpaLibTests": ModuleConfig(["frameworks/base/packages/SettingsLib/Spa/tests/"]),
    "SettingsLibTests": ModuleConfig(["frameworks/base/packages/SettingsLib/tests/"]),
    "SettingsLibUnitTests": ModuleConfig(["frameworks/base/packages/SettingsLib/tests/"]),
    "SettingsProviderTest": ModuleConfig(["frameworks/base/packages/SettingsProvider/test/"]),
    "ShellTests": ModuleConfig(["frameworks/base/packages/Shell/tests/"]),
    "AccessibilityMenuServiceTests": ModuleConfig(["frameworks/base/packages/SystemUI/accessibility/accessibilitymenu/tests/"]),
    "SystemUILintCheckerTest": ModuleConfig(["frameworks/base/packages/SystemUI/checks/tests/"]),
    "PlatformComposeCoreTests": ModuleConfig(["frameworks/base/packages/SystemUI/compose/core/tests/"]),
    "PlatformComposeSceneTransitionLayoutTests": ModuleConfig(["frameworks/base/packages/SystemUI/compose/scene/tests/"]),
    "SystemUITests": ModuleConfig(["frameworks/base/packages/SystemUI/tests/"]),
    "VpnDialogsTests": ModuleConfig(["frameworks/base/packages/VpnDialogs/tests/"]),
    "WallpaperBackupAgentTests": ModuleConfig(["frameworks/base/packages/WallpaperBackup/test/"]),
    "AvatarPickerUITests": ModuleConfig(["packages/apps/AvatarPicker/src/tests/"]),
    "AvatarPickerUnitTests": ModuleConfig(["packages/apps/AvatarPicker/src/tests/"]),
    "CarLauncherTests": ModuleConfig(["packages/apps/Car/Launcher/app/tests/"]),
    "CarDockLibTests": ModuleConfig(["packages/apps/Car/Launcher/docklib/tests/"]),
    "CarDockUtilLibTests": ModuleConfig(["packages/apps/Car/Launcher/docklib-util/tests/"]),
    "CarAppGridTests": ModuleConfig(["packages/apps/Car/Launcher/libs/appgrid/lib/tests/"]),
    "CarLauncherCommonTests": ModuleConfig(["packages/apps/Car/Launcher/libs/car-launcher-common/tests/"]),
    "CarNotificationUnitTests": ModuleConfig(["packages/apps/Car/Notification/tests/"]),
    "CarRotaryControllerUnitTests": ModuleConfig(["packages/apps/Car/RotaryController/tests/"]),
    "CarSettingsUnitTests": ModuleConfig(["packages/apps/Car/Settings/tests/"]),
    "CarBroadcastRadioSupportTests": ModuleConfig(["packages/apps/Car/systemlibs/car-broadcastradio-support/tests/"]),
    "CarQCLibUnitTests": ModuleConfig(["packages/apps/Car/systemlibs/car-qc-lib/tests/"]),
    "CarSystemUITests": ModuleConfig(["packages/apps/Car/SystemUI/tests/"]),
    "CellBroadcastReceiverComplianceTests": ModuleConfig(["packages/apps/CellBroadcastReceiver/tests/"]),
    "CellBroadcastReceiverUnitTests": ModuleConfig(["packages/apps/CellBroadcastReceiver/tests/"]),
    "ContactsTests": ModuleConfig(["packages/apps/Contacts/tests/"]),
    "DeskClockTests": ModuleConfig(["packages/apps/DeskClock/tests/"]),
    "DocumentsUITests": ModuleConfig(["packages/apps/DocumentsUI/app-perf-tests/"]),
    "DocumentsUITests": ModuleConfig(["packages/apps/DocumentsUI/tests/"]),
    "EmergencyInfoUnitTests": ModuleConfig(["packages/apps/EmergencyInfo/tests/"]),
    "ImsServiceEntitlementUnitTests": ModuleConfig(["packages/apps/ImsServiceEntitlement/tests/"]),
    "KeyChainTests": ModuleConfig(["packages/apps/KeyChain/tests/"]),
    "Launcher3Tests": ModuleConfig(dirs=["packages/apps/Launcher3/tests/",
                                         "packages/apps/Launcher3/quickstep/tests/",
                                         "vendor/unbundled_google/packages/NexusLauncher/tests/"
                                         ],
                                   gradlew_location="vendor/unbundled_google/packages/SystemUIGoogle/studio-dev/SysUIGradleProject",
                                   gradlew_target=":NexusLauncher:testGoogleWithQuickstepDebugUnitTest",
                                   excludes=["Tapl", "ImageTest", "AbstractDeviceProfileTest", "SearchSessionLifecycleTest"]),
    "ManagedProvisioningTests": ModuleConfig(["packages/apps/ManagedProvisioning/tests/"]),
    "NfcNciInstrumentationTests": ModuleConfig(["packages/apps/Nfc/tests/"]),
    "NfcNciUnitTests": ModuleConfig(["packages/apps/Nfc/tests/"]),
    "DevPluginTests": ModuleConfig(["packages/apps/OMA-DM/plugins/tests/"]),
    "AnomalyTester": ModuleConfig(["packages/apps/Settings/tests/"]),
    "SettingsComponentTests": ModuleConfig(["packages/apps/Settings/tests/"]),
    "SettingsPerfTests": ModuleConfig(["packages/apps/Settings/tests/"]),
    "SettingsSpaUnitTests": ModuleConfig(["packages/apps/Settings/tests/"]),
    "SettingsUITests": ModuleConfig(["packages/apps/Settings/tests/"]),
    "SettingsUnitTests": ModuleConfig(["packages/apps/Settings/tests/"]),
    "StorageManagerAppTests": ModuleConfig(["packages/apps/StorageManager/tests/"]),
    "StorageManagerUnitTests": ModuleConfig(["packages/apps/StorageManager/tests/"]),
    "TraceurUiTests": ModuleConfig(["packages/apps/Traceur/uitests/"]),
    "TvSystemUITests": ModuleConfig(["packages/apps/TvSystemUI/tests/"]),
    "TVFuncTests": ModuleConfig(["packages/apps/TV/tests/"]),
    "TVUnitTests": ModuleConfig(["packages/apps/TV/tests/"]),
    "WallpaperPicker2Tests": ModuleConfig(["packages/apps/WallpaperPicker2/tests/"]),
    "AvatarPickerGoogleUnitTests": ModuleConfig(["vendor/unbundled_google/packages/AvatarPickerGoogle/src/tests/"]),
    "CarrierSetupTests": ModuleConfig(["vendor/unbundled_google/packages/CarrierEntitlement/CarrierSetup/tests/"]),
    "NexusLauncherTests": ModuleConfig(["vendor/unbundled_google/packages/NexusLauncher/tests/"]),
    "PCLauncherTests": ModuleConfig(["vendor/unbundled_google/packages/PC/Launcher/tests/"]),
    "SettingsGoogleTests": ModuleConfig(["vendor/unbundled_google/packages/SettingsGoogle/tests/"]),
    "SettingsModelTest": ModuleConfig(["vendor/unbundled_google/packages/SettingsGoogle/tests/"]),
    "SettingsOutputTest": ModuleConfig(["vendor/unbundled_google/packages/SettingsGoogle/tests/"]),
    "SettingsGoogleUITests": ModuleConfig(["vendor/unbundled_google/packages/SettingsGoogle/tests/"]),
    "SettingsGoogleUnitTests": ModuleConfig(["vendor/unbundled_google/packages/SettingsGoogle/tests/"]),
    "SystemUIClocksTests": ModuleConfig(["vendor/unbundled_google/packages/SystemUIGoogle/clocks/tests/"]),
    "SystemUIComposeGalleryTests": ModuleConfig(["vendor/unbundled_google/packages/SystemUIGoogle/compose/gallery/tests/"]),
    "SystemUIGoogleTests": ModuleConfig(["vendor/unbundled_google/packages/SystemUIGoogle/tests/"]),
    "AiWallpapersTests": ModuleConfig(["vendor/unbundled_google/packages/WallpaperEffect/AiWallpapers/tests/"]),
    "WallpaperEffectTests": ModuleConfig(["vendor/unbundled_google/packages/WallpaperEffect/CinematicWallpapers/tests/"]),
    "WallpaperEffectTests": ModuleConfig(["vendor/unbundled_google/packages/WallpaperEffect/CinematicWallpapers/unittests/"]),
    "MagicPortraitWallpapersTests": ModuleConfig(["vendor/unbundled_google/packages/WallpaperEffect/MagicPortrait/tests/"]),
    "WallpaperPickerGoogleTests": ModuleConfig(["vendor/unbundled_google/packages/WallpaperPickerGoogle/tests/"]),
    "ContactsProviderTests": ModuleConfig(["packages/providers/ContactsProvider/tests/"]),
    "TelephonyProviderTests": ModuleConfig(["packages/providers/TelephonyProvider/tests/"]),
    "MediaProviderTests": ModuleConfig(["packages/providers/MediaProvider/tests/"]),
    "MediaProviderClientTests": ModuleConfig(["packages/providers/MediaProvider/tests/"]),
    "BlockedNumberProviderTest": ModuleConfig(["packages/providers/BlockedNumberProvider/tests/"]),
    "DownloadPublicApiAccessTests": ModuleConfig(["packages/providers/DownloadProvider/tests/"]),
    "CalendarProviderTests": ModuleConfig(["packages/providers/CalendarProvider/tests/"]),
}

@dataclass
class Config:
    module_configs: list[ModuleConfig]
    build_top: str = environ.get("ANDROID_BUILD_TOP")
    output_dir: str = "~/out"
