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
|
2018-10-09 13:36:35 +00:00
|
|
|
from . import canvaskit
|
2018-05-14 16:50:38 +00:00
|
|
|
from . import chromebook
|
|
|
|
from . import chromecast
|
2019-01-31 17:47:20 +00:00
|
|
|
from . import cmake
|
2018-05-14 16:50:38 +00:00
|
|
|
from . import default
|
|
|
|
from . import flutter
|
[PathKit] Adding test infrastructure to support Gold output
To get the gold images out of the browser tests, this adds
testReporter.js and pathkit_aggregator.go. testReporter bundles
up the output as a base64 encoded PNG and sends it over the local
network to pathkit_aggregator. pathkit_aggregator will keep
a list of test results reported in this way and write the PNGs
to /OUT of the container (which is the swarming output directory).
Finally, after all the tests are run, the helper script "test_pathkit.sh"
makes a POST request that creates the JSON file that gold expects
(following the schema https://github.com/google/skia-buildbot/blob/master/golden/docs/INGESTION.md)
pathkit_aggregator takes many command line arguments which control
the keys that Gold needs in order to ingest and handle the data.
Of note, this creates a new set (i.e. source_type) of gold images
called "pathkit", which will distinguish it from "gm", "image", etc.
There will be at least 2 sub-sets of "pathkit" images, "canvas" and "svg",
(representing the 2 output types of PathKit). This CL doesn't
quite handle SVG yet, as it needs a way to convert SVG to PNG in the
browser and will be addressed in a follow up CL.
A "standard" gm is sized at 600x600. This was arbitrarily picked.
Note that the functions in testReporter.js return Promises based
on the fetch requests to post the data. This eliminates the race
condition between the /report_gold_data and /dump_json since
running the karma tests won't return until all reports are done.
Other changes of note:
- Adds go to karma-chrome-tests container.
- renames recipe_modules/build/wasm.py -> pathkit.py to be consistent with
the name of test_pathkit.py and make for easier grepping.
- Increases the JS test timeout to 10s (up from 5) to hopefully avoid
the flakes seen in the Debug Test.
Bug: skia:8216
Change-Id: Ic2cad54f3d19cc16601cf2e9a87798db1e6887a2
Reviewed-on: https://skia-review.googlesource.com/147042
Reviewed-by: Stephan Altmueller <stephana@google.com>
2018-08-15 17:45:28 +00:00
|
|
|
from . import pathkit
|
2018-10-08 19:07:42 +00:00
|
|
|
from . import skqp
|
2018-05-14 16:50:38 +00:00
|
|
|
from . import util
|
|
|
|
|
|
|
|
|
|
|
|
class BuildApi(recipe_api.RecipeApi):
|
|
|
|
def __init__(self, buildername, *args, **kwargs):
|
|
|
|
b = buildername
|
2018-10-08 19:07:42 +00:00
|
|
|
if 'SKQP' in b and not 'Test' in b:
|
|
|
|
self.compile_fn = skqp.compile_fn
|
|
|
|
self.copy_fn = skqp.copy_extra_build_products
|
|
|
|
elif 'Android' in b and not 'Flutter' in b:
|
2018-05-14 16:50:38 +00:00
|
|
|
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:
|
2018-10-09 13:36:35 +00:00
|
|
|
if 'PathKit' in b:
|
|
|
|
self.compile_fn = pathkit.compile_fn
|
|
|
|
self.copy_fn = pathkit.copy_extra_build_products
|
|
|
|
else:
|
|
|
|
self.compile_fn = canvaskit.compile_fn
|
|
|
|
self.copy_fn = canvaskit.copy_extra_build_products
|
2019-01-31 17:47:20 +00:00
|
|
|
elif 'CMake' in b:
|
|
|
|
self.compile_fn = cmake.compile_fn
|
|
|
|
self.copy_fn = cmake.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)
|