SkQP: ResourceFactory
Change-Id: Ic57a86ec115e3ace52615c0b8e9a22a915988850
Reviewed-on: https://skia-review.googlesource.com/101320
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/tools/skqp/setup_resources b/tools/skqp/setup_resources
new file mode 100755
index 0000000..45b9b70
--- /dev/null
+++ b/tools/skqp/setup_resources
@@ -0,0 +1,29 @@
+#! /usr/bin/env python
+
+# Copyright 2018 Google Inc.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import shutil
+import sys
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3 or not os.path.isdir(sys.argv[1]) or not os.path.isdir(sys.argv[2]):
+ sys.stderr.write('Usage\n %s SKIA_DIR BUILD_DIR\n\n' % sys.argv[0])
+ sys.exit(1)
+ skia = sys.argv[1]
+ gen = os.path.join(sys.argv[2], 'gen')
+ if not os.path.isdir(gen):
+ os.mkdir(gen)
+ with open(os.path.join(gen, 'binary_resources.cpp'), 'w') as o:
+ o.write('#include "BinaryAsset.h"\n'
+ 'BinaryAsset gResources[] = { {nullptr, nullptr, 0} };\n')
+ dst = os.path.join(skia, 'platform_tools', 'android', 'apps', 'skqp',
+ 'src', 'main', 'assets', 'resources')
+ if os.path.isdir(dst) and not os.path.islink(dst):
+ shutil.rmtree(dst)
+ elif os.path.exists(dst):
+ os.remove(dst)
+ shutil.copytree(os.path.join(skia, 'resources'), dst)
+