def GetAndroidProjectDir(package: Package) -> str:
     """ Get the android project dir of the package, this is the dir that the gradle build reside in """
     appPackageTemplateInfo = AndroidGeneratorUtil.AppPackageTemplateInfo(package)
     # The old code used the "config.SDKPathAndroidProjectDir"
     # but now we resolve it from the environment variable name
     environmentVariable = ToolEnvironmentVariableName.FSL_GRAPHICS_SDK_ANDROID_PROJECT_DIR
     environmentVariable = "$({0})".format(environmentVariable)
     return IOUtil.Join(environmentVariable, appPackageTemplateInfo.ProjectPathName)
 def GetAndroidProjectDir(
     self,
     config: Config,
     package: Package,
     appPackageTemplateInfo: Optional[
         AndroidGeneratorUtil.AppPackageTemplateInfo] = None
 ) -> str:
     """ Get the android project dir of the package, this is the dir that the gradle build reside in """
     appPackageTemplateInfo = AndroidGeneratorUtil.AppPackageTemplateInfo(
         package
     ) if appPackageTemplateInfo is None else appPackageTemplateInfo
     return IOUtil.Join(config.SDKPathAndroidProjectDir,
                        appPackageTemplateInfo.ProjectPathName)
    def __init__(self, config: Config, packages: List[Package], platformName: str, androidABIList: List[str]) -> None:
        super().__init__()

        if config.SDKPathAndroidProjectDir is None:
            raise EnvironmentError("Android environment variable {0} not defined".format(ToolEnvironmentVariableName.FSL_GRAPHICS_SDK_ANDROID_PROJECT_DIR))

        strAppTemplatePath = "AndroidGradleCMake"
        templateFilePath = IOUtil.Join(config.SDKConfigTemplatePath, strAppTemplatePath)
        templateFileRecordManager = TemplateFileRecordManager(templateFilePath)
        templateFileProcessor = TemplateFileProcessor(config, platformName)

        strTemplatePath = IOUtil.Join(strAppTemplatePath, "CMake")
        extTemplate = CMakeGeneratorUtil.CodeTemplateCMake(config, strTemplatePath, "Ext", False, None)
        libTemplate = CMakeGeneratorUtil.CodeTemplateCMake(config, strTemplatePath, "Lib", False, None)
        exeTemplate = CMakeGeneratorUtil.CodeTemplateCMake(config, strTemplatePath, "Exe", False, None)

        templatePath = IOUtil.Join(config.SDKConfigTemplatePath, strAppTemplatePath)
        exeFileList = self.__ParseExeFileList(IOUtil.Join(templatePath, "ExeFiles.txt"))

        localSnippets = AndroidGradleCMakeSnippets(templatePath)

        cmakePackageRootVariables = self.__GenerateCmakePackageRootVariables(config, localSnippets)

        totalExeCount = 0
        for mainPackage in packages:
            if mainPackage.Type == PackageType.Executable:
                totalExeCount = totalExeCount + 1
                appPackageTemplateInfo = AndroidGeneratorUtil.AppPackageTemplateInfo(mainPackage)
                androidProjectDir = IOUtil.Join(config.SDKPathAndroidProjectDir, appPackageTemplateInfo.ProjectPathName)
                androidProjectCMakeDir = IOUtil.Join(androidProjectDir, ".FslCMake")

                for package in mainPackage.ResolvedBuildOrder:
                    if not package.ResolvedPlatformNotSupported:
                        if package.Type == PackageType.ExternalLibrary or package.Type == PackageType.HeaderLibrary:
                            self.__GenerateCMakeFile(config, package, platformName, extTemplate, androidProjectDir, androidProjectCMakeDir)
                        elif package.Type == PackageType.Library:
                            self.__GenerateCMakeFile(config, package, platformName, libTemplate, androidProjectDir, androidProjectCMakeDir)
                        elif package.Type == PackageType.Executable:
                            self.__GenerateExecutable(config, package, platformName, exeTemplate, templateFileRecordManager, templateFileProcessor,
                                                      appPackageTemplateInfo, androidProjectDir, androidProjectCMakeDir,
                                                      exeFileList, androidABIList, cmakePackageRootVariables)

        # For now we only support doing 'exe' builds using full source for everything (like the old builder)
        if totalExeCount <= 0:
            config.DoPrint("No executables provided, nothing to build.")