2018-05-14 16:50:38 +00:00
|
|
|
# Copyright 2018 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
"""Build Skia for various platforms."""
|
|
|
|
|
|
|
|
|
|
|
|
from recipe_engine import recipe_api
|
|
|
|
|
|
|
|
from . import android
|
|
|
|
from . import chromebook
|
|
|
|
from . import chromecast
|
|
|
|
from . import default
|
|
|
|
from . import flutter
|
|
|
|
from . import util
|
2018-08-03 14:26:00 +00:00
|
|
|
from . import wasm
|
2018-05-14 16:50:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BuildApi(recipe_api.RecipeApi):
|
|
|
|
def __init__(self, buildername, *args, **kwargs):
|
|
|
|
b = buildername
|
|
|
|
if 'Android' in b and not 'Flutter' in b:
|
|
|
|
self.compile_fn = android.compile_fn
|
|
|
|
self.copy_fn = android.copy_extra_build_products
|
|
|
|
elif 'Chromebook' in b:
|
|
|
|
self.compile_fn = chromebook.compile_fn
|
|
|
|
self.copy_fn = chromebook.copy_extra_build_products
|
|
|
|
elif 'Chromecast' in b:
|
|
|
|
self.compile_fn = chromecast.compile_fn
|
|
|
|
self.copy_fn = chromecast.copy_extra_build_products
|
|
|
|
elif 'Flutter' in b:
|
|
|
|
self.compile_fn = flutter.compile_fn
|
|
|
|
self.copy_fn = flutter.copy_extra_build_products
|
2018-08-03 14:26:00 +00:00
|
|
|
elif 'EMCC' in b:
|
|
|
|
self.compile_fn = wasm.compile_fn
|
|
|
|
self.copy_fn = wasm.copy_extra_build_products
|
2018-05-14 16:50:38 +00:00
|
|
|
else:
|
|
|
|
self.compile_fn = default.compile_fn
|
|
|
|
self.copy_fn = default.copy_extra_build_products
|
|
|
|
super(BuildApi, self).__init__(*args, **kwargs)
|
|
|
|
|
2018-05-18 11:36:55 +00:00
|
|
|
def __call__(self, checkout_root, out_dir):
|
2018-05-14 16:50:38 +00:00
|
|
|
"""Compile the code."""
|
2018-05-18 11:36:55 +00:00
|
|
|
self.compile_fn(self.m, checkout_root, out_dir)
|
2018-05-14 16:50:38 +00:00
|
|
|
|
2018-05-18 11:36:55 +00:00
|
|
|
def copy_build_products(self, out_dir, dst):
|
2018-05-14 16:50:38 +00:00
|
|
|
"""Copy whitelisted build products to dst."""
|
2018-05-18 11:36:55 +00:00
|
|
|
util.copy_whitelisted_build_products(self.m, out_dir, dst)
|
|
|
|
self.copy_fn(self.m, out_dir, dst)
|