aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2016-12-09 15:38:13 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-09 21:15:27 +0000
commita4a338179013b029d6dd55e737b5bd648a9fb68c (patch)
tree92bbbedc12950187e83156b6d1ddd56a7b3e077c /bin
parent0e8fc8b9e6a138cf4a66b421fb824679df717329 (diff)
tools and docs: clean up gyp-specific things
BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=5770 Change-Id: Iadc436a68cbf7ec0d1dd3c019072eb28bf589bb6 Reviewed-on: https://skia-review.googlesource.com/5770 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sync19
-rwxr-xr-xbin/sync-and-gyp108
2 files changed, 9 insertions, 118 deletions
diff --git a/bin/sync b/bin/sync
index 154acbc300..d95d4a82b7 100755
--- a/bin/sync
+++ b/bin/sync
@@ -68,18 +68,17 @@ if current_deps_hash != deps_hash:
if not os.path.isfile('.gclient'):
with open('.gclient', 'w') as o:
o.write(default_gclient_config)
- for command in [[gclient, 'sync'] + skia_opt_deps,
- ['python', os.path.join('bin', 'fetch-gn')]]:
+ command = [gclient, 'sync'] + skia_opt_deps
+ try:
+ sys.stdout.write('%r\n' % command)
+ subprocess.check_call(command)
+ except:
+ sys.stderr.write('\n%r failed.\n' % command)
try:
- sys.stdout.write('%r\n' % command)
- subprocess.check_call(command)
+ os.remove('.deps_sha1') # Unknown state.
except:
- sys.stderr.write('\n%r failed.\n' % command)
- try:
- os.remove('.deps_sha1') # Unknown state.
- except:
- pass
- exit(1)
+ pass
+ exit(1)
# Only write hash after a successful sync.
with open('.deps_sha1', 'w') as o:
o.write(deps_hash)
diff --git a/bin/sync-and-gyp b/bin/sync-and-gyp
deleted file mode 100755
index 469c84e8f8..0000000000
--- a/bin/sync-and-gyp
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2015 Google Inc.
-#
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This script will update Skia's dependencies as necessary and run
-# gyp if needed.
-
-# Depends on: Python, Git, and depot_tools.
-#
-# Example usage:
-#
-# git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
-# export PATH="${PWD}/depot_tools:${PATH}"
-# git clone https://skia.googlesource.com/skia
-# cd skia
-# python bin/sync-and-gyp
-# ninja -C out/Debug && out/Debug/dm
-#
-# Once changes are made to DEPS or gyp/ or the source, call:
-#
-# python bin/sync-and-gyp
-
-# To retreive and use all optional deps:
-#
-# python bin/sync-and-gyp --deps=all
-# ninja -C out/Debug && out/Debug/dm
-
-import fnmatch
-import hashlib
-import os
-import subprocess
-import sys
-
-skia_dir = os.path.join(os.path.dirname(__file__), os.pardir)
-
-skia_out = os.environ.get("SKIA_OUT")
-if skia_out:
- skia_out = os.path.abspath(skia_out)
- hash_path = os.path.join(skia_out, 'gyp_hash')
-else:
- hash_path = os.path.join('out', 'gyp_hash')
-
-os.chdir(skia_dir)
-
-if 0 != subprocess.call(['python', 'bin/sync'] + sys.argv[1:]):
- sys.stderr.write('sync failed.')
- exit(1)
-
-hasher = hashlib.sha1()
-
-for var in ['AR', 'AR_host', 'AR_target',
- 'CC', 'CC_host', 'CC_target',
- 'CFLAGS', 'CFLAGS_host',
- 'CPPFLAGS', 'CPPFLAGS_host',
- 'CXX', 'CXX_host', 'CXX_target',
- 'GYP_DEFINES', 'GYP_GENERATORS',
- 'NM', 'NM_host', 'NM_target',
- 'READELF', 'READELF_host', 'READELF_target']:
- hasher.update(os.environ.get(var, '') + '\n')
-
-def listfiles(folder, matchfilter):
- for root, folders, files in os.walk(folder):
- for filename in files:
- if fnmatch.fnmatch(filename, matchfilter):
- yield os.path.join(root, filename)
-
-for filename in sorted(listfiles('gyp', '*')):
- with open(filename, 'r') as f:
- hasher.update(f.read())
-
-find_dirs = [
- 'bench',
- 'fuzz',
- 'gm',
- 'tests',
- 'third_party/externals/icu/source/common',
- 'third_party/externals/sfntly/sfntly',
- 'third_party/externals/shaderc2',
- 'tools/VisualBench',
- 'tools/gpu',
- 'tools/kilobench',
- 'tools/skiaserve',
- 'tools/skiaserve/urlhandlers',
- 'tools/vulkan',
-]
-
-for dir in find_dirs:
- for filename in sorted(listfiles(dir, '*.c*')):
- hasher.update(filename + '\n')
-
-gyp_hash = hasher.hexdigest()
-
-def cat_if_exists(path):
- if os.path.exists(path):
- with open(path, 'r') as f:
- return f.read()
- return ''
-
-if cat_if_exists(hash_path).strip() != gyp_hash:
- env = os.environ.copy()
- if skia_out:
- env['SKIA_OUT'] = skia_out
- subprocess.call(['python', './gyp_skia'], env=env)
- with open(hash_path, 'w') as o:
- o.write(gyp_hash)