1# Copyright 2018 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5 6"""Build Skia for various platforms.""" 7 8 9from recipe_engine import recipe_api 10 11from . import android 12from . import canvaskit 13from . import chromebook 14from . import chromecast 15from . import cmake 16from . import default 17from . import flutter 18from . import pathkit 19from . import skqp 20from . import util 21 22 23class BuildApi(recipe_api.RecipeApi): 24 def __init__(self, buildername, *args, **kwargs): 25 b = buildername 26 if 'SKQP' in b and not 'Test' in b: 27 self.compile_fn = skqp.compile_fn 28 self.copy_fn = skqp.copy_extra_build_products 29 elif 'Android' in b and not 'Flutter' in b: 30 self.compile_fn = android.compile_fn 31 self.copy_fn = android.copy_extra_build_products 32 elif 'Chromebook' in b: 33 self.compile_fn = chromebook.compile_fn 34 self.copy_fn = chromebook.copy_extra_build_products 35 elif 'Chromecast' in b: 36 self.compile_fn = chromecast.compile_fn 37 self.copy_fn = chromecast.copy_extra_build_products 38 elif 'Flutter' in b: 39 self.compile_fn = flutter.compile_fn 40 self.copy_fn = flutter.copy_extra_build_products 41 elif 'EMCC' in b: 42 if 'PathKit' in b: 43 self.compile_fn = pathkit.compile_fn 44 self.copy_fn = pathkit.copy_extra_build_products 45 else: 46 self.compile_fn = canvaskit.compile_fn 47 self.copy_fn = canvaskit.copy_extra_build_products 48 elif 'CMake' in b: 49 self.compile_fn = cmake.compile_fn 50 self.copy_fn = cmake.copy_extra_build_products 51 else: 52 self.compile_fn = default.compile_fn 53 self.copy_fn = default.copy_extra_build_products 54 super(BuildApi, self).__init__(*args, **kwargs) 55 56 def __call__(self, checkout_root, out_dir): 57 """Compile the code.""" 58 self.compile_fn(self.m, checkout_root, out_dir) 59 60 def copy_build_products(self, out_dir, dst): 61 """Copy whitelisted build products to dst.""" 62 util.copy_whitelisted_build_products(self.m, out_dir, dst) 63 self.copy_fn(self.m, out_dir, dst) 64