From a4a338179013b029d6dd55e737b5bd648a9fb68c Mon Sep 17 00:00:00 2001 From: Hal Canary Date: Fri, 9 Dec 2016 15:38:13 -0500 Subject: 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 Reviewed-by: Mike Klein --- bin/sync | 19 ++++--- bin/sync-and-gyp | 108 ------------------------------------- site/dev/design/sync.md | 5 +- site/dev/tools/qtdebugger.md | 120 ----------------------------------------- site/user/special/msan.md | 19 ------- tools/pdf-comparison.sh | 123 ------------------------------------------- 6 files changed, 10 insertions(+), 384 deletions(-) delete mode 100755 bin/sync-and-gyp delete mode 100644 site/dev/tools/qtdebugger.md delete mode 100644 site/user/special/msan.md delete mode 100755 tools/pdf-comparison.sh 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) diff --git a/site/dev/design/sync.md b/site/dev/design/sync.md index d7c192fdbc..7443dba6f4 100644 --- a/site/dev/design/sync.md +++ b/site/dev/design/sync.md @@ -2,8 +2,7 @@ sync ==== [`sync`](https://skia.googlesource.com/skia.git/+/master/bin/sync) -is a Python program that wraps `gclient sync` and `fetch-gn`. -Motivations for using it: +is a Python program that wraps `gclient sync`. Motivations for using it: - Written in Python, so it will work on all platforms. @@ -12,7 +11,5 @@ Motivations for using it: - Checks to see if the `DEPS` file has changed since it last ran `gclient sync`. If not, it skips that step. -- Calls `fetch-gn` if needed. - - Since running `sync` is fast when it can do nothing, it is easy to do before every recompile of Skia. This is a good habit. diff --git a/site/dev/tools/qtdebugger.md b/site/dev/tools/qtdebugger.md deleted file mode 100644 index bb3f97eba6..0000000000 --- a/site/dev/tools/qtdebugger.md +++ /dev/null @@ -1,120 +0,0 @@ -Skia Debugger (deprecated) -============= - -Introduction ------------- - -The Skia Debugger is a graphical tool used to step through and analyze the -contents of the Skia picture format. Pre-requisites include installing the Qt -Library and downloading the Skia code base. - -Qt is available here: http://qt-project.org/downloads. - -It can also be installed on linux using - - -~~~~ -sudo apt-get install libqt4-dev -~~~~ - -Note that the debugger has been tested with Qt 4.8.6; it is known not to work -with Qt 5.0RC1 on the Mac. - -Design Documents: - -https://docs.google.com/a/google.com/document/d/1b8muqVzfbJmYbno9nTv5721V2nlFMfnqXYLNHiSQ4ws/pub - - -How to build and run --------------------- - -Because the debugger uses Qt, you'll need to build skia in 64 bit mode: - - - - GYP_DEFINES="skia_arch_width=64" python bin/sync-and-gyp - ninja -C out/Debug debugger - out/Debug/debugger - -For Windows, Qt ships as 32 bit libraries so to build and run one should just be -able to: - - -~~~~ -cd trunk -make clean gyp - -~~~~ - -Depending on how your Qt is installed you may also need to define an environment -variable like: - -~~~~ -GYP_DEFINES=qt_sdk='C:\Qt\4.8.6\' -~~~~ -(which needs to be set before you execute 'make gyp') - -On Windows, you may need to copy several DLL and PDB files from %QTDIR%\bin into -your executable directory (out/Debug or out/Release): - -QtCore4.dll QtCored4.dll QtCored4.pdb - -QtGui4.dll QtGuid4.dll QtGuid4.pdb - -QtOpenGL4.dll QtOpenGLd4.dll QtOpenGLd4.pdb - - -Producing SKPs for usage ------------------------- - -You may either use the Skia testing images (GMs) for use in the debugger or -create your own via chromium. - -To create SKPs from Chromium you must download and build chromium on your -platform of choice: http://www.chromium.org/Home - - -~~~~ -cd src -make chrome -out/Debug/chrome --no-sandbox --enable-gpu-benchmarking --force-compositing-mode -~~~~ - -After which go to Tools, Settings, Javascript Console and type: - - -~~~~ -chrome.gpuBenchmarking.printToSkPicture(dirname) -~~~~ - -Using the Debugger ------------------- - -The debugger is fairly straight forward to use once a picture is loaded in. We -can step through different commands via the up and down keys, and clicking on -the command in the list. We can pause execution of commands with the pause -button in order to inspect the details of the command in the inspector tabs -down below. - - - Command | Function - -------------|----------------------------------------------- - x | toggles the visibility of the selected command - alt-x | clears all hidden commands - ctrl-x | shows all deleted commands - b | creates a breakpoint on a command - alt-b | clears all breakpoints - ctrl-b | shows all breakpoints - ctrl-r | rewinds the picture to the first command - ctrl-p | plays to the next breakpoint or last command - ctrl-i | Toggles the inspector and settings widgets - ctrl-d | Toggles the directory widget - space | Pauses drawing execution - ctrl-o | Opens a file dialog for loading pictures - ctrl-s | Saves the skp if you deleted any commands - ctrl-shift-s | Saves the skp under the new specified name - ctrl-q | Quits - -![Debugger interface](/dev/tools/debugger.png) - - diff --git a/site/user/special/msan.md b/site/user/special/msan.md deleted file mode 100644 index c4fce78c10..0000000000 --- a/site/user/special/msan.md +++ /dev/null @@ -1,19 +0,0 @@ -Running with Memory Sanitizer -============================= - -Prerequisites -------------- - -The msan build builds Clang from scratch, so you need to download Clang first: - - bin/sync-and-gyp --deps=llvm - -Build ------ - - tools/xsan_build memory dm - -Run ---- - - out/Debug/dm -v --match ~Codec ~BlurLargeImage ~FontMgrAndroidParser diff --git a/tools/pdf-comparison.sh b/tools/pdf-comparison.sh deleted file mode 100755 index 69f96c980f..0000000000 --- a/tools/pdf-comparison.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh - -# Copyright 2016 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This tool compares the PDF output of Skia's DM tool of two commits. - -CONTROL_COMMIT="$1" -EXPERIMENT_COMMIT="$2" - -SOURCE="${3:-gm}" # could be 'skp' - -if ! [ "$1" ] || ! [ "$2" ]; then - echo "usage:" >&2 - echo " $0 CONTROL_COMMIT EXPERIMENT_COMMIT [SOURCE]" >&2 - exit 1 -fi - -BAD='' -for CMD in 'python' 'ninja' 'pdfium_test' 'skdiff'; do - if ! command -v "$CMD" > /dev/null ; then - echo "could not find $CMD command in PATH." >&2 - BAD=1 - fi -done -if [ "$BAD" ]; then exit 1; fi - -cd "$(dirname "$0")/.." -if [ "$(git diff --shortstat)" ]; then - echo "please stash your changes" >&2 - exit 1 -fi - -DIR=$(mktemp -d "${TMPDIR:-/tmp}/skpdf.XXXXXXXXXX") -EXP="${DIR}/exp" -CON="${DIR}/con" - -set -e - -git checkout "$EXPERIMENT_COMMIT" -python bin/sync-and-gyp && ninja -C out/Release dm -out/Release/dm --src "$SOURCE" --config pdf -w "$EXP" - -git checkout "$CONTROL_COMMIT" -python bin/sync-and-gyp && ninja -C out/Release dm -out/Release/dm --src "$SOURCE" --config pdf -w "$CON" - -set +e - -EXP_DIR="${EXP}/pdf/${SOURCE}" -CON_DIR="${CON}/pdf/${SOURCE}" - -DIFFS='' -# remove byte-identical PDFs -for con in "$CON_DIR"/*pdf; do - exp="$EXP_DIR/$(basename "$con")" - if diff "$con" "$exp" > /dev/null; then - rm "$con" "$exp" # no difference - else - echo "PDF differs: $(basename "$con")" - DIFFS=1 - fi -done -if [ -z "$DIFFS" ]; then - echo 'All PDFs are byte-identical!' - rm -r "$DIR" - exit 0; -fi - -# Portable version of timeout from GNU coreutils. -timeout_py() { python -c "$(cat <&2 - exit 1 - fi - rm "$pdf" - else - echo "pdfium_test '$pdf' failed." - fi -done - -DIFFS='' -# remove byte-identical PNGs: -for con in "$CON_DIR"/*.png; do - exp="$EXP_DIR/$(basename "$con")" - if diff "$con" "$exp"; then - rm "$exp" "$con" - else - echo "PNG differs: $(basename "$con")" - DIFFS=1 - fi -done -if [ -z "$DIFFS" ]; then - echo 'All PNGs are byte-identical!' - rm -r "$DIR" - exit 0; -fi - -# run remaining PNG files through skdiff: -DIFF_DIR="${DIR}/skdiffout" -skdiff "$CON_DIR" "$EXP_DIR" "$DIFF_DIR" -echo "'$DIFF_DIR/index.html'" - -if [ $(uname) = 'Darwin' ] ; then - open "$DIFF_DIR/index.html" # look at diffs -elif [ $(uname) = 'Linux' ] ; then - xdg-open "$DIFF_DIR/index.html" # look at diffs -fi -- cgit v1.2.3