blob: 48702e645721b4b3ac063dd6dcdc14cb00ef8a93 [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 recipe_engine.recipe_api import Property
PYTHON_VERSION_COMPATIBILITY = "PY3"
DEPS = [
"fuchsia/cipd_util",
"fuchsia/status_check",
"recipe_engine/archive",
"recipe_engine/path",
"recipe_engine/step",
"recipe_engine/url",
]
PROPERTIES = {"version": Property(kind=str, help="SDK version", default="1.1.92.1")}
# 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, version):
for platform in PLATFORMS:
with api.step.nest(platform):
url = URL_TEMPLATE.format(
version, platform.split("-")[0], PLATFORMS_TO_TARGETS[platform]
)
sdk_tarball = api.path["start_dir"].join("vulkansdk-%s.tar.gz" % platform)
api.url.get_file(url, sdk_tarball, step_name="fetch sdk")
sdk_path = api.path["start_dir"].join("vulkansdk-%s" % platform)
api.archive.extract("extract sdk", sdk_tarball, sdk_path)
pkg_dir = sdk_path.join(
{"linux-amd64": version, "mac-amd64": "vulkansdk-macos-" + version}[
platform
]
)
api.cipd_util.upload_package(
"fuchsia/third_party/vulkansdk/%s" % platform,
pkg_dir,
[pkg_dir],
{"version": version},
)
def GenTests(api):
yield api.status_check.test("basic")