コード例 #1
0
def _get_built_in_binary_recipe_from_build_github_repo(
    project_name: str,
    version_hash: str,
    build_version_hash: str,
    platform_suffixes: List[str],
    tools: List[ToolNameAndPath],
) -> List[recipe_wrap.RecipeWrap]:

    result: List[recipe_wrap.RecipeWrap] = []

    for platform_suffix in platform_suffixes:
        tags: List[str] = []
        add_common_tags_from_platform_suffix(tags, platform_suffix)
        binaries = [
            Binary(
                name=binary.name,
                tags=tags,
                path=(
                    f"{project_name}/{(binary.subpath + '.exe') if 'Windows' in tags and binary.add_exe_on_windows else binary.subpath}"
                ),
                version=version_hash,
            )
            for binary in tools
        ]

        result.append(
            recipe_wrap.RecipeWrap(
                f"{BUILT_IN_BINARY_RECIPES_PATH_PREFIX}/{project_name}_{version_hash}_{platform_suffix}",
                Recipe(
                    download_and_extract_archive_set=RecipeDownloadAndExtractArchiveSet(
                        archive_set=ArchiveSet(
                            archives=[
                                Archive(
                                    url=f"https://github.com/paulthomson/build-{project_name}/releases/download/github/paulthomson/build-{project_name}/{build_version_hash}/build-{project_name}-{build_version_hash}-{platform_suffix}.zip",
                                    output_file=f"{project_name}.zip",
                                    output_directory=project_name,
                                )
                            ],
                            binaries=binaries,
                        )
                    )
                ),
            )
        )

    return result
コード例 #2
0
def get_github_release_recipe(  # pylint: disable=too-many-branches,too-many-statements;
    binary: Binary, ) -> recipe_wrap.RecipeWrap:

    project_name = binary_name_to_project_name(binary.name)

    if project_name == "graphicsfuzz":
        # Special case:
        platform = util.get_platform()  # Not used.
        tags = PLATFORMS[:]  # All host platforms.
        repo_name = f"gfbuild-{project_name}"
        version = binary.version
        artifact_name = f"gfbuild-{project_name}-{version}"
    elif project_name == "amber" and binary.name in ("amber_apk",
                                                     "amber_apk_test"):
        # Special case:
        platform = util.get_platform()  # Not used.
        tags = PLATFORMS[:]  # All host platforms.
        tags.append("Debug")
        repo_name = f"gfbuild-{project_name}"
        version = binary.version
        artifact_name = f"gfbuild-{project_name}-{version}-android_apk"
    else:
        # Normal case:
        platform = get_platform_from_binary(binary)
        config = get_config_from_binary(binary)
        arch = "x64"

        tags = [platform, config, arch]

        repo_name = f"gfbuild-{project_name}"
        version = binary.version
        artifact_name = f"gfbuild-{project_name}-{version}-{platform}_{arch}_{config}"

    recipe = recipe_wrap.RecipeWrap(
        path=f"{BUILT_IN_BINARY_RECIPES_PATH_PREFIX}/{artifact_name}",
        recipe=Recipe(
            download_and_extract_archive_set=
            RecipeDownloadAndExtractArchiveSet(archive_set=ArchiveSet(
                archives=[
                    Archive(
                        url=
                        f"https://github.com/google/{repo_name}/releases/download/github/google/{repo_name}/{version}/{artifact_name}.zip",
                        output_file=f"{project_name}.zip",
                        output_directory=f"{project_name}",
                    )
                ],
                binaries=[],
            ))),
    )

    executable_suffix = ".exe" if platform == "Windows" else ""

    if project_name == "glslang":
        binaries = [
            Binary(
                name="glslangValidator",
                tags=tags,
                path=f"{project_name}/bin/glslangValidator{executable_suffix}",
                version=version,
            )
        ]
    elif project_name == "SPIRV-Tools":
        binaries = [
            Binary(
                name="spirv-opt",
                tags=tags,
                path=f"{project_name}/bin/spirv-opt{executable_suffix}",
                version=version,
            ),
            Binary(
                name="spirv-as",
                tags=tags,
                path=f"{project_name}/bin/spirv-as{executable_suffix}",
                version=version,
            ),
            Binary(
                name="spirv-dis",
                tags=tags,
                path=f"{project_name}/bin/spirv-dis{executable_suffix}",
                version=version,
            ),
            Binary(
                name="spirv-val",
                tags=tags,
                path=f"{project_name}/bin/spirv-val{executable_suffix}",
                version=version,
            ),
            Binary(
                name="spirv-fuzz",
                tags=tags,
                path=f"{project_name}/bin/spirv-fuzz{executable_suffix}",
                version=version,
            ),
            Binary(
                name="spirv-reduce",
                tags=tags,
                path=f"{project_name}/bin/spirv-reduce{executable_suffix}",
                version=version,
            ),
        ]
    elif project_name == "swiftshader":
        binaries = [
            Binary(
                name="swift_shader_icd",
                tags=tags,
                path=f"{project_name}/lib/vk_swiftshader_icd.json",
                version=version,
            )
        ]
    elif project_name == "amber":
        if binary.name in ("amber_apk", "amber_apk_test"):
            binaries = [
                Binary(
                    name="amber_apk",
                    tags=tags,
                    path=f"{project_name}/amber.apk",
                    version=version,
                ),
                Binary(
                    name="amber_apk_test",
                    tags=tags,
                    path=f"{project_name}/amber-test.apk",
                    version=version,
                ),
            ]
        else:
            if platform == "Linux":
                vulkan_loader_name = "libvulkan.so.1"
            elif platform == "Mac":
                vulkan_loader_name = "libvulkan.1.dylib"
            elif platform == "Windows":
                vulkan_loader_name = "vulkan-1.dll"
            else:
                raise AssertionError(
                    f"Unknown platform for Amber's Vulkan loader: {platform}")

            binaries = [
                Binary(
                    name="amber",
                    tags=tags,
                    path=f"{project_name}/bin/amber{executable_suffix}",
                    version=version,
                ),
                Binary(
                    name=AMBER_VULKAN_LOADER_NAME,
                    tags=tags,
                    path=f"{project_name}/lib/{vulkan_loader_name}",
                    version=version,
                ),
            ]
    elif project_name == "graphicsfuzz":
        binaries = [
            Binary(
                name="graphicsfuzz-tool",
                tags=tags,
                path=f"{project_name}/python/drivers/graphicsfuzz-tool",
                version=version,
            )
        ]
    elif project_name == "llpc":
        if platform != "Linux":
            raise AssertionError("amdllpc is only available on Linux")
        binaries = [
            Binary(
                name="amdllpc",
                tags=tags,
                path=f"{project_name}/bin/amdllpc{executable_suffix}",
                version=version,
            )
        ]
    else:
        raise AssertionError(f"Unknown project name: {project_name}")

    recipe.recipe.download_and_extract_archive_set.archive_set.binaries.extend(
        binaries)
    return recipe
コード例 #3
0
def get_graphics_fuzz_121() -> List[recipe_wrap.RecipeWrap]:
    return [
        recipe_wrap.RecipeWrap(
            f"{BUILT_IN_BINARY_RECIPES_PATH_PREFIX}/graphicsfuzz_v1.2.1",
            Recipe(
                download_and_extract_archive_set=
                RecipeDownloadAndExtractArchiveSet(archive_set=ArchiveSet(
                    archives=[
                        Archive(
                            url=
                            "https://github.com/google/graphicsfuzz/releases/download/v1.2.1/graphicsfuzz.zip",
                            output_file="graphicsfuzz.zip",
                            output_directory="graphicsfuzz",
                        )
                    ],
                    binaries=[
                        #
                        # glslangValidator
                        Binary(
                            name="glslangValidator",
                            tags=["Linux", "x64", "Release"],
                            path="graphicsfuzz/bin/Linux/glslangValidator",
                            version="40c16ec0b3ad03fc170f1369a58e7bbe662d82cd",
                        ),
                        Binary(
                            name="glslangValidator",
                            tags=["Windows", "x64", "Release"],
                            path=
                            "graphicsfuzz/bin/Windows/glslangValidator.exe",
                            version="40c16ec0b3ad03fc170f1369a58e7bbe662d82cd",
                        ),
                        Binary(
                            name="glslangValidator",
                            tags=["Mac", "x64", "Release"],
                            path="graphicsfuzz/bin/Mac/glslangValidator",
                            version="40c16ec0b3ad03fc170f1369a58e7bbe662d82cd",
                        ),
                        #
                        # spirv-opt
                        Binary(
                            name="spirv-opt",
                            tags=[
                                "Linux",
                                "x64",
                                "Release",
                                SPIRV_OPT_NO_VALIDATE_AFTER_ALL_TAG,
                            ],
                            path="graphicsfuzz/bin/Linux/spirv-opt",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-opt",
                            tags=[
                                "Windows",
                                "x64",
                                "Release",
                                SPIRV_OPT_NO_VALIDATE_AFTER_ALL_TAG,
                            ],
                            path="graphicsfuzz/bin/Windows/spirv-opt.exe",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-opt",
                            tags=[
                                "Mac",
                                "x64",
                                "Release",
                                SPIRV_OPT_NO_VALIDATE_AFTER_ALL_TAG,
                            ],
                            path="graphicsfuzz/bin/Mac/spirv-opt",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        #
                        # spirv-dis
                        Binary(
                            name="spirv-dis",
                            tags=["Linux", "x64", "Release"],
                            path="graphicsfuzz/bin/Linux/spirv-dis",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-dis",
                            tags=["Windows", "x64", "Release"],
                            path="graphicsfuzz/bin/Windows/spirv-dis.exe",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-dis",
                            tags=["Mac", "x64", "Release"],
                            path="graphicsfuzz/bin/Mac/spirv-dis",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        #
                        # spirv-as
                        Binary(
                            name="spirv-as",
                            tags=["Linux", "x64", "Release"],
                            path="graphicsfuzz/bin/Linux/spirv-as",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-as",
                            tags=["Windows", "x64", "Release"],
                            path="graphicsfuzz/bin/Windows/spirv-as.exe",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-as",
                            tags=["Mac", "x64", "Release"],
                            path="graphicsfuzz/bin/Mac/spirv-as",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        #
                        # spirv-val
                        Binary(
                            name="spirv-val",
                            tags=["Linux", "x64", "Release"],
                            path="graphicsfuzz/bin/Linux/spirv-val",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-val",
                            tags=["Windows", "x64", "Release"],
                            path="graphicsfuzz/bin/Windows/spirv-val.exe",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                        Binary(
                            name="spirv-val",
                            tags=["Mac", "x64", "Release"],
                            path="graphicsfuzz/bin/Mac/spirv-val",
                            version="a2ef7be242bcacaa9127a3ce011602ec54b2c9ed",
                        ),
                    ],
                ))),
        )
    ]