def __GenerateBuildScript(self, config: Config, generatorName: str,
                              package: Package, template: str) -> None:
        strContent = ""
        for depPackage in package.ResolvedBuildOrder:
            if not depPackage.IsVirtual:
                if depPackage.AbsolutePath is None:
                    raise Exception("Invalid package")
                strContent += "pushd " + config.ToBashPath(
                    depPackage.AbsolutePath) + " > /dev/null\n"
                strContent += 'make "$@"\n'
                strContent += "popd > /dev/null\n"
        strContent += 'make "$@"\n'

        build = template
        build = build.replace("##PACKAGE_BUILD_COMMANDS##", strContent)

        if not config.DisableWrite:
            if package.AbsolutePath is None or package.ResolvedBuildPath is None:
                raise Exception("Invalid package")
            buildPath = IOUtil.Join(package.AbsolutePath,
                                    package.ResolvedBuildPath)
            # create folder structure
            IOUtil.SafeMakeDirs(buildPath)

            # This file has been superseded by the 'FslBuild.py' script
            # so for now we just write it inside the build dir to keep it around if needed

            #dstFile = IOUtil.Join(package.AbsolutePath, "build.sh")
            dstFile = IOUtil.Join(buildPath, "build.sh")

            IOUtil.WriteFileIfChanged(dstFile, build)
            IOUtil.SetFileExecutable(dstFile)
    def __GenerateExecutable(
            self, config: Config, package: Package, platformName: str,
            template: CMakeGeneratorUtil.CodeTemplateCMake,
            templateFileRecordManager: TemplateFileRecordManager,
            templateFileProcessor: TemplateFileProcessor,
            appPackageTemplateInfo: AndroidGeneratorUtil.
        AppPackageTemplateInfo, androidProjectDir: str,
            androidProjectCMakeDir: str, exeFileList: List[str],
            androidABIList: List[str], cmakePackageRootVariables: str) -> None:
        # copy files that need to be modified
        dstFilenameModifier = self.__GetDstFilenameModifier(
            config, androidProjectDir, package, appPackageTemplateInfo,
            template, androidProjectCMakeDir, androidABIList,
            templateFileProcessor, cmakePackageRootVariables)

        templateFileProcessor.Process(config, templateFileRecordManager,
                                      androidProjectDir, package,
                                      dstFilenameModifier)

        if not config.DisableWrite:
            # mark files as executable
            for entry in exeFileList:
                IOUtil.SetFileExecutable(IOUtil.Join(androidProjectDir, entry))

        self.__GenerateCMakeFile(config, package, platformName, template,
                                 androidProjectDir, androidProjectCMakeDir)