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 cmake 15from . import default 16from . import docker 17from . import flutter 18from . import pathkit 19 20 21class BuildApi(recipe_api.RecipeApi): 22 def __init__(self, buildername, *args, **kwargs): 23 b = buildername 24 if 'Android' in b and not 'Flutter' in b: 25 self.compile_fn = android.compile_fn 26 self.copy_fn = android.copy_build_products 27 elif 'Chromebook' in b: 28 self.compile_fn = chromebook.compile_fn 29 self.copy_fn = chromebook.copy_build_products 30 elif 'Flutter' in b: 31 self.compile_fn = flutter.compile_fn 32 self.copy_fn = flutter.copy_build_products 33 elif 'EMCC' in b: 34 if 'PathKit' in b: 35 self.compile_fn = pathkit.compile_fn 36 self.copy_fn = pathkit.copy_build_products 37 else: 38 self.compile_fn = canvaskit.compile_fn 39 self.copy_fn = canvaskit.copy_build_products 40 elif 'CMake' in b: 41 self.compile_fn = cmake.compile_fn 42 self.copy_fn = cmake.copy_build_products 43 elif 'Docker' in b: 44 self.compile_fn = docker.compile_fn 45 self.copy_fn = docker.copy_build_products 46 else: 47 self.compile_fn = default.compile_fn 48 self.copy_fn = default.copy_build_products 49 super(BuildApi, self).__init__(*args, **kwargs) 50 51 def __call__(self, checkout_root, out_dir): 52 """Compile the code.""" 53 self.compile_fn(self.m, checkout_root, out_dir) 54 55 def copy_build_products(self, out_dir, dst): 56 """Copy selected build products to dst.""" 57 self.copy_fn(self.m, out_dir, dst) 58