• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2#
3# Copyright 2016 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8import os
9import sys
10
11# We'll recursively search each include directory for headers,
12# then write them to skia.h with a small blacklist.
13
14# We'll also write skia.h.deps, which Ninja uses to track dependencies. It's the
15# very same mechanism Ninja uses to know which .h files affect which .cpp files.
16
17skia_h       = sys.argv[1]
18include_dirs = sys.argv[2:]
19
20blacklist = {
21  "GrGLConfig_chrome.h",
22  "GrVkBackendContext.h",
23  "GrVkDefines.h",
24  "GrVkInterface.h",
25  "GrVkTypes.h",
26  "SkFontMgr_fontconfig.h",
27}
28
29headers = []
30for directory in include_dirs:
31  for d, _, files in os.walk(directory):
32    for f in files:
33      if f.endswith('.h') and f not in blacklist:
34        headers.append(os.path.join(d,f))
35headers.sort()
36
37with open(skia_h, "w") as f:
38  f.write('// skia.h generated by GN.\n')
39  f.write('#ifndef skia_h_DEFINED\n')
40  f.write('#define skia_h_DEFINED\n')
41  for h in headers:
42    f.write('#include "' + h + '"\n')
43  f.write('#endif//skia_h_DEFINED\n')
44
45with open(skia_h + '.deps', "w") as f:
46  f.write(skia_h + ':')
47  for h in headers:
48    f.write(' ' + h)
49  f.write('\n')
50
51# Temporary: during development this file wrote skia.h.d, not skia.h.deps,
52# and I think we have some bad versions of those files laying around.
53if os.path.exists(skia_h + '.d'):
54  os.remove(skia_h + '.d')
55