tree: 2012bd47021c2d7ef629a04beff9cd97aa4c5b25 [path history] [tgz]
  1. bin/
  2. lib/
  3. test/
  4. mono_pkg.yaml
  5. pubspec.yaml
  6. README.md
pkgs/_macro_tool/README.md

A tool for running and benchmarking with macros.

Specify a list of commands in addition to options:

apply: runs macros, outputs to disk patch_for_analyzer: fixes macro output for the analyzer patch_for_cfe: fixes macro output for the CFE run: runs the specified script revert: reverts patches to files benchmark_apply: benchmarks applying macros benchmark_analyze: benchmarks analyzing macros bust_caches: modifies files like the benchmarks do watch: loops watching for changes to the specified script and applying

Examples

All examples are run from the root of this repo.

Benchmarks require that you first create sources to benchmark with:

dart run benchmark_generator large 16 BuiltValue JsonCodable

Benchmark running macros:

dart run _macro_tool \
    --workspace=goldens/foo/lib/generated/large \
    benchmark_apply

Benchmark analysis on macro output without running macros:

dart run _macro_tool \
    --workspace=goldens/foo/lib/generated/large \
    apply patch_for_analyzer benchmark_analyze revert

Run a script with macros:

dart run _macro_tool \
  --workspace=goldens/foo \
  --script=goldens/foo/lib/json_codable_test.dart \
  apply patch_for_cfe run revert

Watch for changes to a script, applying macros when it changes, writing the output to disk and reporting how long it took:

dart run _macro_tool \
  --workspace=goldens/foo \
  --script=goldens/foo/lib/json_codable_test.dart \
  watch

Clean up output after using watch:

dart run _macro_tool \
  --workspace=goldens/foo \
  --script=goldens/foo/lib/json_codable_test.dart \
  revert