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