blob: 45b9b70e093f5dca953edef4dc5f5216c5a669af [file] [log] [blame]
Hal Canaryb4d01a92018-01-29 13:10:08 -05001#! /usr/bin/env python
2
3# Copyright 2018 Google Inc.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import os
8import shutil
9import sys
10
11if __name__ == '__main__':
12 if len(sys.argv) != 3 or not os.path.isdir(sys.argv[1]) or not os.path.isdir(sys.argv[2]):
13 sys.stderr.write('Usage\n %s SKIA_DIR BUILD_DIR\n\n' % sys.argv[0])
14 sys.exit(1)
15 skia = sys.argv[1]
16 gen = os.path.join(sys.argv[2], 'gen')
17 if not os.path.isdir(gen):
18 os.mkdir(gen)
19 with open(os.path.join(gen, 'binary_resources.cpp'), 'w') as o:
20 o.write('#include "BinaryAsset.h"\n'
21 'BinaryAsset gResources[] = { {nullptr, nullptr, 0} };\n')
22 dst = os.path.join(skia, 'platform_tools', 'android', 'apps', 'skqp',
23 'src', 'main', 'assets', 'resources')
24 if os.path.isdir(dst) and not os.path.islink(dst):
25 shutil.rmtree(dst)
26 elif os.path.exists(dst):
27 os.remove(dst)
28 shutil.copytree(os.path.join(skia, 'resources'), dst)
29