aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-04-24 11:47:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-24 18:08:06 +0000
commitfd9bcabca1d2bef215862e8a16df862899d9ceca (patch)
tree51196d675641dbf721d7b2ffb359481582d05c88 /tools
parent32d19c42a2296aea9af946accb020ac80dfdc7da (diff)
sk_tools/Resources: optional SK_TOOLS_REQUIRE_RESOURCES flag
BUG=skia:7842 Change-Id: I1ce7d12308cd8ee101163d73dfc79f2d2155c632 Reviewed-on: https://skia-review.googlesource.com/123425 Auto-Submit: Hal Canary <halcanary@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org> Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/Resources.cpp14
-rwxr-xr-xtools/skqp/generate_gn_args1
2 files changed, 7 insertions, 8 deletions
diff --git a/tools/Resources.cpp b/tools/Resources.cpp
index 0e343c4883..183a8d807d 100644
--- a/tools/Resources.cpp
+++ b/tools/Resources.cpp
@@ -43,17 +43,15 @@ std::unique_ptr<SkStreamAsset> GetResourceAsStream(const char* resource) {
}
sk_sp<SkData> GetResourceAsData(const char* resource) {
- if (gResourceFactory) {
- if (auto data = gResourceFactory(resource)) {
- return data;
- }
- SkDebugf("Resource \"%s\" not found.\n", resource);
- SK_ABORT("missing resource");
- }
- if (auto data = SkData::MakeFromFileName(GetResourcePath(resource).c_str())) {
+ if (sk_sp<SkData> data = gResourceFactory
+ ? gResourceFactory(resource)
+ : SkData::MakeFromFileName(GetResourcePath(resource).c_str())) {
return data;
}
SkDebugf("Resource \"%s\" not found.\n", resource);
+ #ifdef SK_TOOLS_REQUIRE_RESOURCES
+ SK_ABORT("missing resource");
+ #endif
return nullptr;
}
diff --git a/tools/skqp/generate_gn_args b/tools/skqp/generate_gn_args
index c9b1891c47..889f427387 100755
--- a/tools/skqp/generate_gn_args
+++ b/tools/skqp/generate_gn_args
@@ -24,6 +24,7 @@ skia_use_lua = false
skia_use_piex = false
skia_use_skcms = false
skia_skqp_enable_driver_correctness_workarounds = {enable_workarounds}
+skia_tools_require_resources = true
'''
def parse_args():