diff options
author | Hal Canary <halcanary@google.com> | 2016-11-11 11:40:04 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-11 16:59:14 +0000 |
commit | 64dded3d95be625b65120a91ed29dd58112489d3 (patch) | |
tree | 10cb014a0f6790ddb548504585fd06fa8437cccd /site | |
parent | 58b130681db4432c4937c2cb1b2529de628c6b19 (diff) |
Documentation: more gn, less gyp
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4698
NOTRY=true
DOCS_PREVIEW= https://skia.org/?cl=4698
Change-Id: I03100542752a769060a7f0c9671cc44acbea2e48
Reviewed-on: https://skia-review.googlesource.com/4698
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'site')
-rw-r--r-- | site/dev/contrib/submit.md | 2 | ||||
-rw-r--r-- | site/dev/design/sync-and-gyp.md | 24 | ||||
-rw-r--r-- | site/dev/design/sync.md | 18 | ||||
-rw-r--r-- | site/dev/testing/testing.md | 72 | ||||
-rw-r--r-- | site/dev/testing/tests.md | 37 | ||||
-rw-r--r-- | site/user/tips.md | 63 |
6 files changed, 81 insertions, 135 deletions
diff --git a/site/dev/contrib/submit.md b/site/dev/contrib/submit.md index c01ec0ff49..a64fe87fa3 100644 --- a/site/dev/contrib/submit.md +++ b/site/dev/contrib/submit.md @@ -32,7 +32,7 @@ If your branch gets out of date, you will need to update it: <!--?prettify lang=sh?--> git pull - python bin/sync-and-gyp + python bin/sync Adding a unit test ------------------ diff --git a/site/dev/design/sync-and-gyp.md b/site/dev/design/sync-and-gyp.md deleted file mode 100644 index 894ad9a5c0..0000000000 --- a/site/dev/design/sync-and-gyp.md +++ /dev/null @@ -1,24 +0,0 @@ -sync-and-gyp -============ - -[`sync-and-gyp`](https://skia.googlesource.com/skia.git/+/master/bin/sync-and-gyp) -is a Python program that wraps `gclient sync` and `gyp_skia`. -Motivations for using it: - -- Fewer steps to configure and compile Skia and Skia's dependencies. - This makes documentation cleaner, too. - -- Written in Python, so it will work on all platforms. Python is - already necessary for gyp. - -- Sets up gclient better than `gclient config`, which has been broken. - -- Checks to see if the `DEPS` file has changed since it last ran - `gclient sync`. If not, it skips that step. - -- Checks to see if gyp needs to be re-run (it checks environment - variables and changed or added files); if not, it skips running - `gyp_skia`. - -- Since running `sync-and-gyp` 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/design/sync.md b/site/dev/design/sync.md new file mode 100644 index 0000000000..d7c192fdbc --- /dev/null +++ b/site/dev/design/sync.md @@ -0,0 +1,18 @@ +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: + +- Written in Python, so it will work on all platforms. + +- Sets up gclient better than `gclient config`, which has been broken. + +- 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/testing/testing.md b/site/dev/testing/testing.md index e577a51231..29f7a4dae0 100644 --- a/site/dev/testing/testing.md +++ b/site/dev/testing/testing.md @@ -4,11 +4,12 @@ Correctness Testing Skia correctness testing is primarily served by a tool named DM. This is a quickstart to building and running DM. -~~~ -$ python bin/sync-and-gyp -$ ninja -C out/Debug dm -$ out/Debug/dm -v -w dm_output -~~~ +<!--?prettify lang=sh?--> + + python bin/sync + gn gen out/Debug + ninja -C out/Debug dm + out/Debug/dm -v -w dm_output When you run this, you may notice your CPU peg to 100% for a while, then taper off to 1 or 2 active cores as the run finishes. This is intentional. DM is @@ -145,46 +146,47 @@ they happen and then again all together after everything is done running. These failures are also included in the dm.json file. DM has a simple facility to compare against the results of a previous run: -~~~ -$ python bin/sync-and-gyp -$ ninja -C out/Debug dm -$ out/Debug/dm -w good - # do some work +<!--?prettify lang=sh?--> + + ninja -C out/Debug dm + out/Debug/dm -w good + + # do some work + + ninja -C out/Debug dm + out/Debug/dm -r good -w bad -$ python bin/sync-and-gyp -$ ninja -C out/Debug dm -$ out/Debug/dm -r good -w bad -~~~ When using `-r`, DM will display a failure for any test that didn't produce the same image as the `good` run. For anything fancier, I suggest using skdiff: -~~~ -$ python bin/sync-and-gyp -$ ninja -C out/Debug dm -$ out/Debug/dm -w good - # do some work +<!--?prettify lang=sh?--> -$ python bin/sync-and-gyp -$ ninja -C out/Debug dm -$ out/Debug/dm -w bad + ninja -C out/Debug dm + out/Debug/dm -w good -$ ninja -C out/Debug skdiff -$ mkdir diff -$ out/Debug/skdiff good bad diff + # do some work - # open diff/index.html in your web browser -~~~ + ninja -C out/Debug dm + out/Debug/dm -w bad + + ninja -C out/Debug skdiff + mkdir diff + out/Debug/skdiff good bad diff + + # open diff/index.html in your web browser That's the basics of DM. DM supports many other modes and flags. Here are a few examples you might find handy. -~~~ -$ out/Debug/dm --help # Print all flags, their defaults, and a brief explanation of each. -$ out/Debug/dm --src tests # Run only unit tests. -$ out/Debug/dm --nocpu # Test only GPU-backed work. -$ out/Debug/dm --nogpu # Test only CPU-backed work. -$ out/Debug/dm --match blur # Run only work with "blur" in its name. -$ out/Debug/dm --dryRun # Don't really do anything, just print out what we'd do. -~~~ + +<!--?prettify lang=sh?--> + + out/Debug/dm --help # Print all flags, their defaults, and a brief explanation of each. + out/Debug/dm --src tests # Run only unit tests. + out/Debug/dm --nocpu # Test only GPU-backed work. + out/Debug/dm --nogpu # Test only CPU-backed work. + out/Debug/dm --match blur # Run only work with "blur" in its name. + out/Debug/dm --dryRun # Don't really do anything, just print out what we'd do. + diff --git a/site/dev/testing/tests.md b/site/dev/testing/tests.md index 3b216e88af..701c2c4dfd 100644 --- a/site/dev/testing/tests.md +++ b/site/dev/testing/tests.md @@ -5,6 +5,14 @@ Writing Skia Tests + [Rendering Tests](#gm) + [Benchmark Tests](#bench) +We assume you have already synced Skia's dependecies and set up Skia's build system. + +<!--?prettify lang=sh?--> + + python bin/sync + gn gen out/Debug + gn gen out/Release --args='is_debug=false' + <span id="test"></span> Writing a Unit Test @@ -29,9 +37,12 @@ Writing a Unit Test REPORTER_ASSERT(reporter, lifeIsGood); } -2. Recompile and run test: +2. Add `NewUnitTest.cpp` to `gn/tests.gni`. + +3. Recompile and run test: + + <!--?prettify lang=sh?--> - python bin/sync-and-gyp ninja -C out/Debug dm out/Debug/dm --match NewUnitTest @@ -58,22 +69,22 @@ Writing a Rendering Test canvas->drawLine(16, 16, 112, 112, p); } -2. Recompile and run test: +2. Add `newgmtest.cpp` to `gn/gm.gni`. + +3. Recompile and run test: + + <!--?prettify lang=sh?--> - python bin/sync-and-gyp ninja -C out/Debug dm out/Debug/dm --match newgmtest -3. Run the GM inside SampleApp: +4. Run the GM inside SampleApp: + + <!--?prettify lang=sh?--> - python bin/sync-and-gyp ninja -C out/Debug SampleApp out/Debug/SampleApp --slide GM:newgmtest - On MacOS, try this: - - out/Debug/SampleApp.app/Contents/MacOS/SampleApp --slide GM:newgmtest - <span id="bench"></span> Writing a Benchmark Test @@ -108,9 +119,11 @@ Writing a Benchmark Test } // namespace DEF_BENCH(return new FooBench;) +2. Add `FooBench.cpp` to `gn/bench.gni`. + +3. Recompile and run nanobench: -2. Recompile and run nanobench: + <!--?prettify lang=sh?--> - python bin/sync-and-gyp ninja -C out/Release nanobench out/Release/nanobench --match Foo diff --git a/site/user/tips.md b/site/user/tips.md index ec94db6260..c477138fc8 100644 --- a/site/user/tips.md +++ b/site/user/tips.md @@ -1,7 +1,6 @@ Tips & FAQ ========== -+ [Gyp Options](#gypdefines) + [Bitmap Subsetting](#bitmap-subsetting) + [Capture a `.skp` file on a web page in Chromium](#skp-capture) + [Capture a `.mskp` file on a web page in Chromium](#mskp-capture) @@ -12,68 +11,6 @@ Tips & FAQ * * * -<span id="gypdefines">Gyp Options</span> ----------------------------------------- - -When running `sync-and-gyp`, the `GYP_DEFINES` environment variable can -be used to change Skia’s compile-time settings, using a -space-separated list of key=value pairs. For example, to disable both -the Skia GPU backend and PDF backends, run it as follows: - -<!--?prettify lang=sh?--> - - GYP_DEFINES='skia_gpu=0 skia_pdf=0' python bin/sync-and-gyp - ninja -C out/Debug - -Note: Setting enviroment variables in the Windows CMD.EXE shell [uses a -different syntax](/user/quick/windows#env). - -You can also set environment variables such as `CC`, `CXX`, -`CFLAGS`, `CXXFLAGS`, or `CPPFLAGS` to control how Skia is compiled. -To build with clang, for example: - -<!--?prettify lang=sh?--> - - CC='clang' CXX='clang++' python bin/sync-and-gyp - ninja -C out/Debug - -To build with clang and enable a compiler warning for unused parameters in C++ -(but not C or assembly) code: - -<!--?prettify lang=sh?--> - - CXXFLAGS='-Wunused-parameter' \ - CC='clang' CXX='clang++' python bin/sync-and-gyp - ninja -C out/Debug - - -The `GYP_GENERATORS` environment variable can be used to set the -build systems that you want to use (as a comma-separated list). -The default is `'ninja,msvs-ninja'` on Windows, `'ninja,xcode'` on -Mac OS X, and just `'ninja'` on Linux. For example, to generate -only Ninja files on Mac: - -<!--?prettify lang=sh?--> - - GYP_GENERATORS='ninja' python bin/sync-and-gyp - ninja -C out/Debug - -Finally, the `SKIA_OUT` environment variable can be used to set -the path for the build directory. The default is `out` inside the -top-level Skia source directory. For example to test Skia with -two different compilers: - -<!--?prettify lang=sh?--> - - CC='clang' CXX='clang++' SKIA_OUT=~/build/skia_clang python bin/sync-and-gyp - CC='gcc' CXX='g++' SKIA_OUT=~/build/skia_gcc python bin/sync-and-gyp - ninja -C ~/build/skia_clang/Debug - ninja -C ~/build/skia_gcc/Debug - -* * * - - - <span id="bitmap-subsetting">Bitmap Subsetting</span> ----------------------------------------------------- |