blob: 8e5dec2191037fa5207e270c8d57b2492863f6d7 [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Recipe for downloading and packaging Vulkan SDK."""
from PB.recipes.fuchsia.contrib.vulkan_sdk import InputProperties
DEPS = [
"fuchsia/cipd_util",
"recipe_engine/archive",
"recipe_engine/path",
"recipe_engine/properties",
"recipe_engine/step",
"recipe_engine/url",
]
PROPERTIES = InputProperties
# These target spellings are used by Vulkan SDK.
PLATFORMS_TO_TARGETS = {
"linux-amd64": "linux-x86_64",
"mac-amd64": "macos",
}
PLATFORMS = PLATFORMS_TO_TARGETS.keys()
URL_TEMPLATE = "https://sdk.lunarg.com/sdk/download/{0}/{1}/vulkansdk-{2}-{0}.tar.gz"
def RunSteps(api, props):
for platform in PLATFORMS:
with api.step.nest(platform):
url = URL_TEMPLATE.format(
props.version, platform.split("-")[0], PLATFORMS_TO_TARGETS[platform]
)
sdk_tarball = api.path.start_dir.join(f"vulkansdk-{platform}.tar.gz")
api.url.get_file(url, sdk_tarball, step_name="fetch sdk")
sdk_path = api.path.start_dir.join(f"vulkansdk-{platform}")
api.archive.extract("extract sdk", sdk_tarball, sdk_path)
pkg_dir = sdk_path.join(
{
"linux-amd64": props.version,
"mac-amd64": "vulkansdk-macos-" + props.version,
}[platform]
)
api.cipd_util.upload_package(
f"fuchsia/third_party/vulkansdk/{platform}",
pkg_dir,
search_tag={"version": props.version},
)
def GenTests(api):
yield api.test("basic") + api.properties(version="1.1.92.1")