| # Copyright 2023 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. |
| |
| from functools import cached_property |
| |
| from recipe_engine import recipe_api |
| |
| |
| # TODO(fxbug.dev/122100): Consider deleting this dedicated module since this is |
| # now only a very thin wrapper around the checkout and cmake.build_with_ninja(). |
| class ZstdApi(recipe_api.RecipeApi): |
| """APIs for building zstd.""" |
| |
| def build(self, cmake_extra_args=(), **kwargs): |
| """ |
| Build zstd. |
| |
| Args: |
| kwargs: Passed through to api.cmake.build_with_ninja(). |
| |
| Returns: |
| Path: zstd install path. |
| """ |
| return self.m.cmake.build_with_ninja( |
| src_dir=self.checkout.join("build", "cmake"), |
| build_type="Release", |
| extra_args=cmake_extra_args, |
| **kwargs, |
| ) |
| |
| @cached_property |
| def checkout(self): |
| """Checkout zstd.""" |
| checkout_dir, _ = self.m.git_checkout( |
| "https://fuchsia.googlesource.com/third_party/zstd", |
| # It's a good idea to keep this matching the revision used in |
| # integration/fuchsia/third_party/flower, which tends to track the |
| # latest stable version. |
| revision="63779c798237346c2b245c546c40b72a5a5913fe", |
| tags=False, |
| ) |
| return checkout_dir |