From 17e422020d568e0bb073f9feb680e497437b26cc Mon Sep 17 00:00:00 2001 From: David Morgan Date: Fri, 19 Jul 2024 11:00:42 +0200 Subject: [PATCH 1/2] Build macros, run them, serve a (test) service, host. --- .github/workflows/dart.yml | 716 ++++++++++++++++-- README.md | 13 +- pkgs/_cfe_macros/test/cfe_test.dart | 2 +- pkgs/_macro_builder/lib/macro_builder.dart | 102 ++- pkgs/_macro_builder/mono_pkg.yaml | 5 + pkgs/_macro_builder/pubspec.yaml | 1 + .../test/macro_builder_test.dart | 51 ++ pkgs/_macro_client/lib/macro_client.dart | 28 +- pkgs/_macro_client/mono_pkg.yaml | 5 + pkgs/_macro_client/pubspec.yaml | 2 + .../_macro_client/test/macro_client_test.dart | 26 + pkgs/_macro_host/lib/macro_host.dart | 85 ++- pkgs/_macro_host/mono_pkg.yaml | 5 + pkgs/_macro_host/pubspec.yaml | 3 + pkgs/_macro_host/test/macro_host_test.dart | 34 + pkgs/_macro_runner/lib/macro_runner.dart | 12 +- pkgs/_macro_runner/mono_pkg.yaml | 5 + pkgs/_macro_runner/pubspec.yaml | 2 + .../_macro_runner/test/macro_runner_test.dart | 34 + pkgs/_macro_server/lib/macro_server.dart | 42 +- pkgs/_macro_server/mono_pkg.yaml | 5 + pkgs/_macro_server/pubspec.yaml | 3 + .../_macro_server/test/macro_server_test.dart | 40 + pkgs/_test_macros/lib/declare_x_macro.dart | 2 +- pkgs/dart_model/lib/src/dart_model.dart | 6 +- pkgs/dart_model/test/model_test.dart | 15 +- pkgs/macro_service/lib/src/macro_service.dart | 17 +- .../lib/src/macro_service.g.dart | 16 + schemas/macro_service.schema.json | 11 + 29 files changed, 1185 insertions(+), 103 deletions(-) create mode 100644 pkgs/_macro_builder/test/macro_builder_test.dart create mode 100644 pkgs/_macro_client/test/macro_client_test.dart create mode 100644 pkgs/_macro_host/test/macro_host_test.dart create mode 100644 pkgs/_macro_runner/test/macro_runner_test.dart create mode 100644 pkgs/_macro_server/test/macro_server_test.dart diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index ead58a5c..43ba1b4c 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable" @@ -27,12 +27,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: mono_repo self validate run: dart pub global activate mono_repo 6.6.1 - name: mono_repo self validate @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_analyzer_macros-pkgs/_cfe_macros-pkgs/_macro_builder-pkgs/_macro_client-pkgs/_macro_host-pkgs/_macro_runner-pkgs/_macro_server-pkgs/_test_macros-pkgs/dart_model-pkgs/macro-pkgs/macro_service-tool/dart_model_generator;commands:analyze" @@ -52,12 +52,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__analyzer_macros_pub_upgrade name: pkgs/_analyzer_macros; dart pub upgrade run: dart pub upgrade @@ -171,7 +171,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_analyzer_macros-pkgs/_macro_builder-pkgs/_macro_client-pkgs/_macro_host-pkgs/_macro_runner-pkgs/_macro_server-pkgs/_test_macros-pkgs/dart_model-pkgs/macro-pkgs/macro_service-tool/dart_model_generator;commands:analyze" @@ -181,12 +181,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__analyzer_macros_pub_upgrade name: pkgs/_analyzer_macros; dart pub upgrade run: dart pub upgrade @@ -291,7 +291,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_analyzer_macros-pkgs/_cfe_macros-pkgs/_macro_builder-pkgs/_macro_client-pkgs/_macro_host-pkgs/_macro_runner-pkgs/_macro_server-pkgs/_test_macros-pkgs/dart_model-pkgs/macro-pkgs/macro_service-tool/dart_model_generator;commands:format" @@ -301,12 +301,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__analyzer_macros_pub_upgrade name: pkgs/_analyzer_macros; dart pub upgrade run: dart pub upgrade @@ -420,7 +420,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_analyzer_macros;commands:test" @@ -430,12 +430,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__analyzer_macros_pub_upgrade name: pkgs/_analyzer_macros; dart pub upgrade run: dart pub upgrade @@ -455,7 +455,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_cfe_macros;commands:test" @@ -465,12 +465,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__cfe_macros_pub_upgrade name: pkgs/_cfe_macros; dart pub upgrade run: dart pub upgrade @@ -486,11 +486,186 @@ jobs: - job_003 - job_004 job_007: + name: "unit_test; linux; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_builder; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_builder;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_builder + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_builder_pub_upgrade + name: pkgs/_macro_builder; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_builder + - name: "pkgs/_macro_builder; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_builder_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_builder + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_008: + name: "unit_test; linux; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_client; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_client;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_client + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_client_pub_upgrade + name: pkgs/_macro_client; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_client + - name: "pkgs/_macro_client; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_client_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_client + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_009: + name: "unit_test; linux; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_host; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_host;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_host + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_host_pub_upgrade + name: pkgs/_macro_host; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_host + - name: "pkgs/_macro_host; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_host_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_host + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_010: + name: "unit_test; linux; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_runner; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_runner;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_runner + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_runner_pub_upgrade + name: pkgs/_macro_runner; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_runner + - name: "pkgs/_macro_runner; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_runner_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_runner + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_011: + name: "unit_test; linux; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_server; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_server;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/_macro_server + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_server_pub_upgrade + name: pkgs/_macro_server; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_server + - name: "pkgs/_macro_server; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_server_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_server + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_012: name: "unit_test; linux; Dart 3.6.0-48.0.dev; PKG: pkgs/dart_model; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:pkgs/dart_model;commands:test" @@ -500,12 +675,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs_dart_model_pub_upgrade name: pkgs/dart_model; dart pub upgrade run: dart pub upgrade @@ -520,12 +695,12 @@ jobs: - job_002 - job_003 - job_004 - job_008: + job_013: name: "unit_test; linux; Dart 3.6.0-48.0.dev; PKG: tool/dart_model_generator; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-48.0.dev;packages:tool/dart_model_generator;commands:test" @@ -535,12 +710,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: tool_dart_model_generator_pub_upgrade name: tool/dart_model_generator; dart pub upgrade run: dart pub upgrade @@ -555,12 +730,12 @@ jobs: - job_002 - job_003 - job_004 - job_009: + job_014: name: "unit_test; linux; Dart dev; PKG: pkgs/_analyzer_macros; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_analyzer_macros;commands:test" @@ -570,12 +745,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__analyzer_macros_pub_upgrade name: pkgs/_analyzer_macros; dart pub upgrade run: dart pub upgrade @@ -590,12 +765,187 @@ jobs: - job_002 - job_003 - job_004 - job_010: + job_015: + name: "unit_test; linux; Dart dev; PKG: pkgs/_macro_builder; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_builder;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_builder + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_builder_pub_upgrade + name: pkgs/_macro_builder; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_builder + - name: "pkgs/_macro_builder; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_builder_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_builder + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_016: + name: "unit_test; linux; Dart dev; PKG: pkgs/_macro_client; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_client;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_client + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_client_pub_upgrade + name: pkgs/_macro_client; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_client + - name: "pkgs/_macro_client; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_client_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_client + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_017: + name: "unit_test; linux; Dart dev; PKG: pkgs/_macro_host; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_host;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_host + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_host_pub_upgrade + name: pkgs/_macro_host; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_host + - name: "pkgs/_macro_host; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_host_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_host + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_018: + name: "unit_test; linux; Dart dev; PKG: pkgs/_macro_runner; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_runner;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_runner_pub_upgrade + name: pkgs/_macro_runner; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_runner + - name: "pkgs/_macro_runner; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_runner_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_runner + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_019: + name: "unit_test; linux; Dart dev; PKG: pkgs/_macro_server; `dart test --test-randomize-ordering-seed=random`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_server;commands:test" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/_macro_server + os:ubuntu-latest;pub-cache-hosted;sdk:dev + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_server_pub_upgrade + name: pkgs/_macro_server; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_server + - name: "pkgs/_macro_server; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_server_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_server + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_020: name: "unit_test; linux; Dart dev; PKG: pkgs/dart_model; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/dart_model;commands:test" @@ -605,12 +955,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs_dart_model_pub_upgrade name: pkgs/dart_model; dart pub upgrade run: dart pub upgrade @@ -625,12 +975,12 @@ jobs: - job_002 - job_003 - job_004 - job_011: + job_021: name: "unit_test; linux; Dart dev; PKG: tool/dart_model_generator; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:tool/dart_model_generator;commands:test" @@ -640,12 +990,12 @@ jobs: os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: tool_dart_model_generator_pub_upgrade name: tool/dart_model_generator; dart pub upgrade run: dart pub upgrade @@ -660,17 +1010,17 @@ jobs: - job_002 - job_003 - job_004 - job_012: + job_022: name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/_analyzer_macros; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__analyzer_macros_pub_upgrade name: pkgs/_analyzer_macros; dart pub upgrade run: dart pub upgrade @@ -685,17 +1035,17 @@ jobs: - job_002 - job_003 - job_004 - job_013: + job_023: name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/_cfe_macros; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__cfe_macros_pub_upgrade name: pkgs/_cfe_macros; dart pub upgrade run: dart pub upgrade @@ -710,17 +1060,142 @@ jobs: - job_002 - job_003 - job_004 - job_014: + job_024: + name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_builder; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_builder_pub_upgrade + name: pkgs/_macro_builder; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_builder + - name: "pkgs/_macro_builder; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_builder_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_builder + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_025: + name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_client; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_client_pub_upgrade + name: pkgs/_macro_client; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_client + - name: "pkgs/_macro_client; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_client_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_client + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_026: + name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_host; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_host_pub_upgrade + name: pkgs/_macro_host; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_host + - name: "pkgs/_macro_host; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_host_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_host + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_027: + name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_runner; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_runner_pub_upgrade + name: pkgs/_macro_runner; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_runner + - name: "pkgs/_macro_runner; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_runner_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_runner + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_028: + name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/_macro_server; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: "3.6.0-48.0.dev" + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_server_pub_upgrade + name: pkgs/_macro_server; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_server + - name: "pkgs/_macro_server; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_server_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_server + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_029: name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: pkgs/dart_model; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs_dart_model_pub_upgrade name: pkgs/dart_model; dart pub upgrade run: dart pub upgrade @@ -735,17 +1210,17 @@ jobs: - job_002 - job_003 - job_004 - job_015: + job_030: name: "unit_test; windows; Dart 3.6.0-48.0.dev; PKG: tool/dart_model_generator; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: "3.6.0-48.0.dev" - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: tool_dart_model_generator_pub_upgrade name: tool/dart_model_generator; dart pub upgrade run: dart pub upgrade @@ -760,17 +1235,17 @@ jobs: - job_002 - job_003 - job_004 - job_016: + job_031: name: "unit_test; windows; Dart dev; PKG: pkgs/_analyzer_macros; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs__analyzer_macros_pub_upgrade name: pkgs/_analyzer_macros; dart pub upgrade run: dart pub upgrade @@ -785,17 +1260,142 @@ jobs: - job_002 - job_003 - job_004 - job_017: + job_032: + name: "unit_test; windows; Dart dev; PKG: pkgs/_macro_builder; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_builder_pub_upgrade + name: pkgs/_macro_builder; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_builder + - name: "pkgs/_macro_builder; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_builder_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_builder + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_033: + name: "unit_test; windows; Dart dev; PKG: pkgs/_macro_client; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_client_pub_upgrade + name: pkgs/_macro_client; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_client + - name: "pkgs/_macro_client; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_client_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_client + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_034: + name: "unit_test; windows; Dart dev; PKG: pkgs/_macro_host; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_host_pub_upgrade + name: pkgs/_macro_host; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_host + - name: "pkgs/_macro_host; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_host_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_host + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_035: + name: "unit_test; windows; Dart dev; PKG: pkgs/_macro_runner; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_runner_pub_upgrade + name: pkgs/_macro_runner; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_runner + - name: "pkgs/_macro_runner; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_runner_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_runner + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_036: + name: "unit_test; windows; Dart dev; PKG: pkgs/_macro_server; `dart test --test-randomize-ordering-seed=random`" + runs-on: windows-latest + steps: + - name: Setup Dart SDK + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: dev + - id: checkout + name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs__macro_server_pub_upgrade + name: pkgs/_macro_server; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/_macro_server + - name: "pkgs/_macro_server; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.pkgs__macro_server_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/_macro_server + needs: + - job_001 + - job_002 + - job_003 + - job_004 + job_037: name: "unit_test; windows; Dart dev; PKG: pkgs/dart_model; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: pkgs_dart_model_pub_upgrade name: pkgs/dart_model; dart pub upgrade run: dart pub upgrade @@ -810,17 +1410,17 @@ jobs: - job_002 - job_003 - job_004 - job_018: + job_038: name: "unit_test; windows; Dart dev; PKG: tool/dart_model_generator; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d with: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - id: tool_dart_model_generator_pub_upgrade name: tool/dart_model_generator; dart pub upgrade run: dart pub upgrade diff --git a/README.md b/README.md index aa63658f..42e482e9 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,18 @@ This repository is home to various macro related Dart packages. | Package | Description | Version | |---|---|---| -| `dart_model` | Serializable data model for Dart code. | 0.0.1-wip | +| [_analyzer_macros](pkgs/_analyzer_macros/) | Macro support for the analyzer. | | +| [_cfe_macros](pkgs/_cfe_macros/) | Macro support for the CFE. | | +| [_macro_builder](pkgs/_macro_builder/) | Builds macros. | | +| [_macro_client](pkgs/_macro_client/) | Connects user macro code to a macro host. | | +| [_macro_host](pkgs/_macro_host/) | Hosts macros. | | +| [_macro_runner](pkgs/_macro_runner/) | Runs macros. | | +| [_macro_server](pkgs/_macro_server/) | Serves a `macro_service`. | | +| [_test_macros](pkgs/_test_macros/) | Some test macros. | | +| [dart_model](pkgs/dart_model/) | Data model for information about Dart code, queries about Dart code and augmentations to Dart code. Serializable with a versioned JSON schema for use by macros, generators and other tools. | [![pub package](https://img.shields.io/pub/v/dart_model.svg)](https://pub.dev/packages/dart_model) | +| [macro](pkgs/macro/) | For implementing a macro. | [![pub package](https://img.shields.io/pub/v/macro.svg)](https://pub.dev/packages/macro) | +| [macro_service](pkgs/macro_service/) | Macro communication with the macro host. | [![pub package](https://img.shields.io/pub/v/macro_service.svg)](https://pub.dev/packages/macro_service) | +| [generate_dart_model](tool/dart_model_generator/) | | | ## Publishing automation diff --git a/pkgs/_cfe_macros/test/cfe_test.dart b/pkgs/_cfe_macros/test/cfe_test.dart index 1231202e..d60ebb7a 100644 --- a/pkgs/_cfe_macros/test/cfe_test.dart +++ b/pkgs/_cfe_macros/test/cfe_test.dart @@ -80,7 +80,7 @@ class TestMacroPackageConfigs implements injected.MacroPackageConfigs { if (result == true) { macroWasFound = true; } - return macroWasFound; + return result; } } diff --git a/pkgs/_macro_builder/lib/macro_builder.dart b/pkgs/_macro_builder/lib/macro_builder.dart index 826b784b..03d834be 100644 --- a/pkgs/_macro_builder/lib/macro_builder.dart +++ b/pkgs/_macro_builder/lib/macro_builder.dart @@ -2,22 +2,110 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:io'; + import 'package:dart_model/dart_model.dart'; +/// Builds macros. +/// +/// TODO(davidmorgan): add a way to clean up generated files and built output. class MacroBuilder { /// Builds an executable from user-written macro code. /// /// Each `QualifiedName` in [macroImplementations] must point to a class that /// implements `Macro` from `package:macro`. + /// + /// The [packageConfig] must include the macros and all their deps. Future build( - Iterable macroImplementations) async { - // TODO(davidmorgan): implement. - // Generated entrypoint will instantiate all the `Macro` instances pointed - // to by `macroImplementations` then pass them to `MacroClient.run` in - // `package:_macro_client`. - return BuiltMacroBundle(); + File packageConfig, Iterable macroImplementations) async { + final script = createBootstrap(macroImplementations.toList()); + + return await MacroBuild(packageConfig, script).build(); + } + + /// Creates the entrypoint script for [macros]. + static String createBootstrap(List macros) { + final script = StringBuffer(); + for (var i = 0; i != macros.length; ++i) { + final macro = macros[i]; + // TODO(davidmorgan): pick non-clashing prefixes. + script.writeln("import '${macro.uri}' as m$i;"); + } + script.write(''' +import 'dart:convert'; + +import 'package:_macro_client/macro_client.dart'; +import 'package:macro_service/macro_service.dart'; + +void main(List arguments) { + MacroClient.run( + endpoint: HostEndpoint.fromJson(json.decode(arguments[0])), + macros: ['''); + for (var i = 0; i != macros.length; ++i) { + final macro = macros[i]; + script.write('m$i.${macro.name}()'); + if (i != macros.length - 1) script.write(', '); + } + script.writeln(']);'); + script.writeln('}'); + return script.toString(); } } /// A bundle of one or more macros that's ready to execute. -class BuiltMacroBundle {} +class BuiltMacroBundle { + // TODO(davidmorgan): other formats besides executable. + final String executablePath; + + BuiltMacroBundle(this.executablePath); +} + +/// A single build. +class MacroBuild { + final File packageConfig; + final String script; + final Directory workspace = + Directory.systemTemp.createTempSync('macro_builder'); + + /// Creates a build for [script] with [packageConfig], which must have all + /// the needed deps. + MacroBuild(this.packageConfig, this.script); + + /// Runs the build. + /// + /// Throws on failure to build. + Future build() async { + final scriptFile = File.fromUri(workspace.uri.resolve('bin/main.dart')); + scriptFile.parent.createSync(recursive: true); + scriptFile.writeAsStringSync(script.toString()); + + final targetPackageConfig = + File.fromUri(workspace.uri.resolve('.dart_tool/package_config.json')); + targetPackageConfig.parent.createSync(recursive: true); + targetPackageConfig + .writeAsStringSync(_makePackageConfigAbsolute(packageConfig)); + + // See package:analyzer/src/summary2/kernel_compilation_service.dart for an + // example of compiling macros using the frontend server. + // + // For now just use the command line. + + final result = Process.runSync('dart', ['compile', 'exe', 'bin/main.dart'], + workingDirectory: workspace.path); + if (result.exitCode != 0) { + throw StateError('Compile failed: ${result.stderr}'); + } + + return BuiltMacroBundle( + File.fromUri(scriptFile.parent.uri.resolve('main.exe')).path); + } + + /// Returns the contents of [pubspec] with relative paths replaced to + /// absolute paths, so the pubspec will work from any location. + String _makePackageConfigAbsolute(File pubspec) { + final root = pubspec.parent.parent.absolute.uri; + return pubspec + .readAsStringSync() + .replaceAll('"rootUri": "../', '"rootUri": "$root'); + } +} diff --git a/pkgs/_macro_builder/mono_pkg.yaml b/pkgs/_macro_builder/mono_pkg.yaml index 15378042..457cafcd 100644 --- a/pkgs/_macro_builder/mono_pkg.yaml +++ b/pkgs/_macro_builder/mono_pkg.yaml @@ -8,3 +8,8 @@ stages: - format: sdk: - dev +- unit_test: + - test: --test-randomize-ordering-seed=random + os: + - linux + - windows diff --git a/pkgs/_macro_builder/pubspec.yaml b/pkgs/_macro_builder/pubspec.yaml index fe8a6d2d..eb07ee96 100644 --- a/pkgs/_macro_builder/pubspec.yaml +++ b/pkgs/_macro_builder/pubspec.yaml @@ -13,3 +13,4 @@ dependencies: dev_dependencies: dart_flutter_team_lints: ^3.0.0 + test: ^1.25.0 diff --git a/pkgs/_macro_builder/test/macro_builder_test.dart b/pkgs/_macro_builder/test/macro_builder_test.dart new file mode 100644 index 00000000..f52df4d9 --- /dev/null +++ b/pkgs/_macro_builder/test/macro_builder_test.dart @@ -0,0 +1,51 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; +import 'dart:isolate'; + +import 'package:_macro_builder/macro_builder.dart'; +import 'package:dart_model/dart_model.dart'; +import 'package:test/test.dart'; + +void main() { + group(MacroBuilder, () { + test('bootstrap matches golden', () async { + final script = MacroBuilder.createBootstrap([ + QualifiedName('package:_test_macros/declare_x_macro.dart#DeclareX'), + QualifiedName('package:_test_macros/declare_y_macro.dart#DeclareY'), + QualifiedName( + 'package:_more_macros/other_macro.dart#OtherMacroImplementation') + ]); + + expect(script, ''' +import 'package:_test_macros/declare_x_macro.dart' as m0; +import 'package:_test_macros/declare_y_macro.dart' as m1; +import 'package:_more_macros/other_macro.dart' as m2; +import 'dart:convert'; + +import 'package:_macro_client/macro_client.dart'; +import 'package:macro_service/macro_service.dart'; + +void main(List arguments) { + MacroClient.run( + endpoint: HostEndpoint.fromJson(json.decode(arguments[0])), + macros: [m0.DeclareX(), m1.DeclareY(), m2.OtherMacroImplementation()]); +} +'''); + }); + + test('builds macros', () async { + final builder = MacroBuilder(); + + final bundle = + await builder.build(File.fromUri(Isolate.packageConfigSync!), [ + QualifiedName( + 'package:_test_macros/declare_x_macro.dart#DeclareXImplementation') + ]); + + expect(File(bundle.executablePath).existsSync(), true); + }); + }); +} diff --git a/pkgs/_macro_client/lib/macro_client.dart b/pkgs/_macro_client/lib/macro_client.dart index 0f5b7fac..a150aeff 100644 --- a/pkgs/_macro_client/lib/macro_client.dart +++ b/pkgs/_macro_client/lib/macro_client.dart @@ -2,12 +2,36 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; +import 'dart:io'; + import 'package:macro/macro.dart'; import 'package:macro_service/macro_service.dart'; +/// Runs macros, connecting them to a macro host. class MacroClient { + final Iterable macros; + final Socket socket; + + MacroClient._(this.macros, this.socket) { + // TODO(davidmorgan): negotiation about protocol version goes here. + + // Tell the host which macros are in this bundle. + for (final macro in macros) { + _send(MacroStartedRequest(macroDescription: macro.description).node); + } + } + /// Runs [macros] for the host at [endpoint]. - void run(HostEndpoint endpoint, Iterable macros) { - // TODO(davidmorgan): implement. + static Future run( + {required HostEndpoint endpoint, required Iterable macros}) async { + final socket = await Socket.connect('localhost', endpoint.port); + return MacroClient._(macros, socket); + } + + void _send(Map node) { + // TODO(davidmorgan): currently this is JSON with one request per line, + // switch to binary. + socket.writeln(json.encode(node)); } } diff --git a/pkgs/_macro_client/mono_pkg.yaml b/pkgs/_macro_client/mono_pkg.yaml index 15378042..457cafcd 100644 --- a/pkgs/_macro_client/mono_pkg.yaml +++ b/pkgs/_macro_client/mono_pkg.yaml @@ -8,3 +8,8 @@ stages: - format: sdk: - dev +- unit_test: + - test: --test-randomize-ordering-seed=random + os: + - linux + - windows diff --git a/pkgs/_macro_client/pubspec.yaml b/pkgs/_macro_client/pubspec.yaml index 82b85643..39802dfe 100644 --- a/pkgs/_macro_client/pubspec.yaml +++ b/pkgs/_macro_client/pubspec.yaml @@ -13,4 +13,6 @@ dependencies: macro_service: any dev_dependencies: + _test_macros: any dart_flutter_team_lints: ^3.0.0 + test: ^1.25.0 diff --git a/pkgs/_macro_client/test/macro_client_test.dart b/pkgs/_macro_client/test/macro_client_test.dart new file mode 100644 index 00000000..481eb75a --- /dev/null +++ b/pkgs/_macro_client/test/macro_client_test.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:io'; + +import 'package:_macro_client/macro_client.dart'; +import 'package:_test_macros/declare_x_macro.dart'; +import 'package:macro_service/macro_service.dart'; +import 'package:test/test.dart'; + +void main() { + group(MacroClient, () { + test('connects to service', () async { + final serverSocket = await ServerSocket.bind('localhost', 0); + + unawaited(MacroClient.run( + endpoint: HostEndpoint(port: serverSocket.port), + macros: [DeclareXImplementation()])); + + expect( + serverSocket.first.timeout(const Duration(seconds: 10)), completes); + }); + }); +} diff --git a/pkgs/_macro_host/lib/macro_host.dart b/pkgs/_macro_host/lib/macro_host.dart index 3831393c..50357e36 100644 --- a/pkgs/_macro_host/lib/macro_host.dart +++ b/pkgs/_macro_host/lib/macro_host.dart @@ -2,26 +2,91 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:io'; + import 'package:_macro_builder/macro_builder.dart'; import 'package:_macro_runner/macro_runner.dart'; import 'package:_macro_server/macro_server.dart'; +import 'package:dart_model/dart_model.dart'; import 'package:macro_service/macro_service.dart'; -class MacroHost { +/// Hosts macros: builds them, runs them, serves the macro service. +/// +/// Tools that want to support macros, such as the Analyzer and the CFE, can +/// do so by running a `MacroHost` and providing their own `MacroService`. +class MacroHost implements MacroService { final MacroServer macroServer; + final ListOfServices services; final MacroBuilder macroBuilder = MacroBuilder(); final MacroRunner macroRunner = MacroRunner(); - late final HostEndpoint hostEndpoint; - MacroHost._(this.macroServer, this.hostEndpoint); + // TODO(davidmorgan): this should be per macro, as part of tracking per-macro + // lifecycle state. + Set? _macroPhases; + + MacroHost._(this.macroServer, this.services) { + services.services.insert(0, this); + } + + /// Starts a macro host serving the provided [service]. + /// + /// The service passed in should handle introspection RPCs, it does not need + /// to handle others. + /// + /// TODO(davidmorgan): make this split clearer, it should be in the protocol + /// definition somewhere which requests the host handles. + static Future serve({required MacroService service}) async { + final listOfServices = ListOfServices(); + listOfServices.services.add(service); + final server = await MacroServer.serve(service: listOfServices); + return MacroHost._(server, listOfServices); + } + + /// Whether [name] is a macro according to that package's `pubspec.yaml`. + bool isMacro(File packageConfig, QualifiedName name) { + // TODO(language/3728): this is a placeholder, use package config when + // available. + return true; + } - static Future serve({required MacroHostService service}) async { - final server = MacroServer(service: service); - final endpoint = await server.serve(); - return MacroHost._(server, endpoint); + /// Determines which phases the macro implemented at [name] runs in. + Future> queryMacroPhases( + File packageConfig, QualifiedName name) async { + if (_macroPhases != null) return _macroPhases!; + final macroBundle = await macroBuilder.build(packageConfig, [name]); + macroRunner.run(macroBundle: macroBundle, endpoint: macroServer.endpoint); + // TODO(davidmorgan): wait explicitly for the MacroStartedRequest to + // arrive, remove this hard-coded wait. + await Future.delayed(const Duration(seconds: 2)); + return _macroPhases!; } - // TODO(davidmorgan): methods for integration with analyzer+CFE go here: - // check if an annotation is linked to a macro, run a macro and ask it to - // produce augmentations. + /// Handle requests that are for the host. + @override + Future handle(Object request) async { + // TODO(davidmorgan): don't assume the type. Return `null` for types + // that should be passed through to the service that was passed in. + final macroStartedRequest = + MacroStartedRequest.fromJson(request as Map); + _macroPhases = macroStartedRequest.macroDescription.runsInPhases.toSet(); + return MacroStartedResponse(); + } + + // TODO(davidmorgan): add method here for running macro phases. +} + +// TODO(davidmorgan): this is used to handle some requests in the host while +// letting some fall through to the passed in service. Differentiate in a +// better way. +class ListOfServices implements MacroService { + List services = []; + + @override + Future handle(Object request) async { + for (final service in services) { + final result = await service.handle(request); + if (result != null) return result; + } + throw StateError('No service handled: $request'); + } } diff --git a/pkgs/_macro_host/mono_pkg.yaml b/pkgs/_macro_host/mono_pkg.yaml index 15378042..457cafcd 100644 --- a/pkgs/_macro_host/mono_pkg.yaml +++ b/pkgs/_macro_host/mono_pkg.yaml @@ -8,3 +8,8 @@ stages: - format: sdk: - dev +- unit_test: + - test: --test-randomize-ordering-seed=random + os: + - linux + - windows diff --git a/pkgs/_macro_host/pubspec.yaml b/pkgs/_macro_host/pubspec.yaml index e6fccf65..87a4df53 100644 --- a/pkgs/_macro_host/pubspec.yaml +++ b/pkgs/_macro_host/pubspec.yaml @@ -12,7 +12,10 @@ dependencies: _macro_builder: any _macro_runner: any _macro_server: any + dart_model: any macro_service: any dev_dependencies: + _test_macros: any dart_flutter_team_lints: ^3.0.0 + test: ^1.25.0 diff --git a/pkgs/_macro_host/test/macro_host_test.dart b/pkgs/_macro_host/test/macro_host_test.dart new file mode 100644 index 00000000..cf9abf84 --- /dev/null +++ b/pkgs/_macro_host/test/macro_host_test.dart @@ -0,0 +1,34 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; +import 'dart:isolate'; + +import 'package:_macro_host/macro_host.dart'; +import 'package:dart_model/dart_model.dart'; +import 'package:macro_service/macro_service.dart'; +import 'package:test/test.dart'; + +void main() { + group(MacroHost, () { + test('hosts a macro', () async { + final service = TestMacroHostService(); + final host = await MacroHost.serve(service: service); + + final macroName = QualifiedName( + 'package:_test_macros/declare_x_macro.dart#DeclareXImplementation'); + final packageConfig = File.fromUri(Isolate.packageConfigSync!); + + expect(host.isMacro(packageConfig, macroName), true); + expect(await host.queryMacroPhases(packageConfig, macroName), {2}); + }); + }); +} + +class TestMacroHostService implements MacroService { + @override + Future handle(Object request) async { + return Object(); + } +} diff --git a/pkgs/_macro_runner/lib/macro_runner.dart b/pkgs/_macro_runner/lib/macro_runner.dart index 90007a8e..9377aab4 100644 --- a/pkgs/_macro_runner/lib/macro_runner.dart +++ b/pkgs/_macro_runner/lib/macro_runner.dart @@ -2,9 +2,19 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; +import 'dart:io'; + import 'package:_macro_builder/macro_builder.dart'; import 'package:macro_service/macro_service.dart'; +/// Runs macros. +/// +/// TODO(davidmorgan): support shutdown/cleanup. class MacroRunner { - void run(BuiltMacroBundle macro, HostEndpoint endpoint) {} + /// Runs [macroBundle] connected to [endpoint]. + void run( + {required BuiltMacroBundle macroBundle, required HostEndpoint endpoint}) { + Process.run(macroBundle.executablePath, [json.encode(endpoint)]); + } } diff --git a/pkgs/_macro_runner/mono_pkg.yaml b/pkgs/_macro_runner/mono_pkg.yaml index 15378042..457cafcd 100644 --- a/pkgs/_macro_runner/mono_pkg.yaml +++ b/pkgs/_macro_runner/mono_pkg.yaml @@ -8,3 +8,8 @@ stages: - format: sdk: - dev +- unit_test: + - test: --test-randomize-ordering-seed=random + os: + - linux + - windows diff --git a/pkgs/_macro_runner/pubspec.yaml b/pkgs/_macro_runner/pubspec.yaml index a83f0059..0055e2c8 100644 --- a/pkgs/_macro_runner/pubspec.yaml +++ b/pkgs/_macro_runner/pubspec.yaml @@ -14,3 +14,5 @@ dependencies: dev_dependencies: dart_flutter_team_lints: ^3.0.0 + dart_model: any + test: ^1.25.0 diff --git a/pkgs/_macro_runner/test/macro_runner_test.dart b/pkgs/_macro_runner/test/macro_runner_test.dart new file mode 100644 index 00000000..5af9a140 --- /dev/null +++ b/pkgs/_macro_runner/test/macro_runner_test.dart @@ -0,0 +1,34 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; +import 'dart:isolate'; + +import 'package:_macro_builder/macro_builder.dart'; +import 'package:_macro_runner/macro_runner.dart'; +import 'package:dart_model/dart_model.dart'; +import 'package:macro_service/macro_service.dart'; +import 'package:test/test.dart'; + +void main() { + group(MacroRunner, () { + test('runs macros', () async { + final builder = MacroBuilder(); + final bundle = + await builder.build(File.fromUri(Isolate.packageConfigSync!), [ + QualifiedName( + 'package:_test_macros/declare_x_macro.dart#DeclareXImplementation') + ]); + + final serverSocket = await ServerSocket.bind('localhost', 0); + + final runner = MacroRunner(); + runner.run( + macroBundle: bundle, endpoint: HostEndpoint(port: serverSocket.port)); + + expect( + serverSocket.first.timeout(const Duration(seconds: 10)), completes); + }); + }); +} diff --git a/pkgs/_macro_server/lib/macro_server.dart b/pkgs/_macro_server/lib/macro_server.dart index 79d06b20..7e171f54 100644 --- a/pkgs/_macro_server/lib/macro_server.dart +++ b/pkgs/_macro_server/lib/macro_server.dart @@ -2,15 +2,47 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:convert'; +import 'dart:io'; + import 'package:macro_service/macro_service.dart'; +/// Serves a [MacroService]. class MacroServer { - final MacroHostService service; + final MacroService service; + final HostEndpoint endpoint; + final ServerSocket serverSocket; + + MacroServer._(this.service, this.endpoint, this.serverSocket) { + _handleConnections(); + } - MacroServer({required this.service}); + /// Serves [service]. + /// + /// TODO(davidmorgan): other transports besides TCP/IP. + static Future serve({required MacroService service}) async { + final serverSocket = await ServerSocket.bind('localhost', 0); + return MacroServer._( + service, HostEndpoint(port: serverSocket.port), serverSocket); + } + + void _handleConnections() { + serverSocket.forEach(_handleConnection); + } - Future serve() async { - // TODO(davidmorgan): actually serve something. - return HostEndpoint(port: 12345); + void _handleConnection(Socket socket) { + // TODO(davidmorgan): currently this is JSON with one request per line, + // switch to binary. + socket + .cast>() + .transform(const Utf8Decoder()) + .transform(const LineSplitter()) + .forEach((line) { + // TODO(davidmorgan): this only works because there is just one request + // type! Add the request type on the wire to differentiate. + final message = MacroStartedRequest.fromJson( + json.decode(line) as Map); + service.handle(message as Object); + }); } } diff --git a/pkgs/_macro_server/mono_pkg.yaml b/pkgs/_macro_server/mono_pkg.yaml index 15378042..457cafcd 100644 --- a/pkgs/_macro_server/mono_pkg.yaml +++ b/pkgs/_macro_server/mono_pkg.yaml @@ -8,3 +8,8 @@ stages: - format: sdk: - dev +- unit_test: + - test: --test-randomize-ordering-seed=random + os: + - linux + - windows diff --git a/pkgs/_macro_server/pubspec.yaml b/pkgs/_macro_server/pubspec.yaml index ead763ff..966afefc 100644 --- a/pkgs/_macro_server/pubspec.yaml +++ b/pkgs/_macro_server/pubspec.yaml @@ -12,4 +12,7 @@ dependencies: macro_service: any dev_dependencies: + _macro_client: any + _test_macros: any dart_flutter_team_lints: ^3.0.0 + test: ^1.25.0 diff --git a/pkgs/_macro_server/test/macro_server_test.dart b/pkgs/_macro_server/test/macro_server_test.dart new file mode 100644 index 00000000..acfaf171 --- /dev/null +++ b/pkgs/_macro_server/test/macro_server_test.dart @@ -0,0 +1,40 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import 'package:_macro_client/macro_client.dart'; +import 'package:_macro_server/macro_server.dart'; +import 'package:_test_macros/declare_x_macro.dart'; +import 'package:macro_service/macro_service.dart'; +import 'package:test/test.dart'; + +void main() { + group(MacroServer, () { + test('serves a macro service', () async { + final service = TestMacroHostService(); + final server = await MacroServer.serve(service: service); + + await MacroClient.run( + endpoint: server.endpoint, macros: [DeclareXImplementation()]); + + // Check that the macro sent its description to the host on startup. + expect((await service.macroStartedRequests.first).macroDescription, + DeclareXImplementation().description); + }); + }); +} + +class TestMacroHostService implements MacroService { + final StreamController _macroStartedRequestsController = + StreamController(); + Stream get macroStartedRequests => + _macroStartedRequestsController.stream; + + @override + Future handle(Object request) async { + _macroStartedRequestsController.add(request as MacroStartedRequest); + return MacroStartedResponse() as Object; + } +} diff --git a/pkgs/_test_macros/lib/declare_x_macro.dart b/pkgs/_test_macros/lib/declare_x_macro.dart index 2b4896dc..d59613ad 100644 --- a/pkgs/_test_macros/lib/declare_x_macro.dart +++ b/pkgs/_test_macros/lib/declare_x_macro.dart @@ -12,7 +12,7 @@ class DeclareX { // TODO(davidmorgan): this is a placeholder; make it do something, test it. class DeclareXImplementation implements Macro { @override - MacroDescription get description => MacroDescription(runsInPhases: [3]); + MacroDescription get description => MacroDescription(runsInPhases: [2]); @override Future augment(Host host, AugmentRequest request) async { diff --git a/pkgs/dart_model/lib/src/dart_model.dart b/pkgs/dart_model/lib/src/dart_model.dart index d21294fe..923666c6 100644 --- a/pkgs/dart_model/lib/src/dart_model.dart +++ b/pkgs/dart_model/lib/src/dart_model.dart @@ -6,7 +6,7 @@ import 'dart_model.g.dart'; export 'dart_model.g.dart'; -// TODO(davidmorgan): remove example when we have an actual extension method. -extension ModelExtension on Model { - String get exampleGetter => 'exampleValue'; +extension QualifiedNameExtension on QualifiedName { + String get uri => string.substring(0, string.indexOf('#')); + String get name => string.substring(string.indexOf('#') + 1); } diff --git a/pkgs/dart_model/test/model_test.dart b/pkgs/dart_model/test/model_test.dart index 4fde1815..0b03c2d7 100644 --- a/pkgs/dart_model/test/model_test.dart +++ b/pkgs/dart_model/test/model_test.dart @@ -46,10 +46,6 @@ void main() { } }; - test('has extension methods', () { - expect(model.exampleGetter, 'exampleValue'); - }); - test('maps to JSON', () { expect(model as Map, expected); }); @@ -104,4 +100,15 @@ void main() { 'JsonData']!['members']); }); }); + + group(QualifiedName, () { + test('has uri', () { + expect(QualifiedName('package:foo/foo.dart#Foo').uri, + 'package:foo/foo.dart'); + }); + + test('has name', () { + expect(QualifiedName('package:foo/foo.dart#Foo').name, 'Foo'); + }); + }); } diff --git a/pkgs/macro_service/lib/src/macro_service.dart b/pkgs/macro_service/lib/src/macro_service.dart index 05a1b188..08ff8512 100644 --- a/pkgs/macro_service/lib/src/macro_service.dart +++ b/pkgs/macro_service/lib/src/macro_service.dart @@ -2,14 +2,11 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'macro_service.g.dart'; - -/// Macro->host RPCs as methods. -// TODO(davidmorgan): generate this. -abstract interface class MacroHostService {} - -/// Host->macro RPCs as methods. -// TODO(davidmorgan): generate this. -abstract interface class MacroClientService { - Future augment(AugmentRequest request); +/// Service interface. +abstract interface class MacroService { + /// Handles [request]. + /// + /// Returns `null` if the request is of a type not handled by this service + /// instance. + Future handle(Object request); } diff --git a/pkgs/macro_service/lib/src/macro_service.g.dart b/pkgs/macro_service/lib/src/macro_service.g.dart index f3e27d2d..a3e2d5e3 100644 --- a/pkgs/macro_service/lib/src/macro_service.g.dart +++ b/pkgs/macro_service/lib/src/macro_service.g.dart @@ -41,3 +41,19 @@ extension type MacroDescription.fromJson(Map node) { /// Phases that the macro runs in: 1, 2 and/or 3. List get runsInPhases => (node['runsInPhases'] as List).cast(); } + +/// Informs the host that a macro has started. +extension type MacroStartedRequest.fromJson(Map node) { + MacroStartedRequest({ + MacroDescription? macroDescription, + }) : this.fromJson({ + if (macroDescription != null) 'macroDescription': macroDescription, + }); + MacroDescription get macroDescription => + node['macroDescription'] as MacroDescription; +} + +/// Host's response to a [MacroStartedRequest]. +extension type MacroStartedResponse.fromJson(Map node) { + MacroStartedResponse() : this.fromJson({}); +} diff --git a/schemas/macro_service.schema.json b/schemas/macro_service.schema.json index ac6f50de..2e171398 100644 --- a/schemas/macro_service.schema.json +++ b/schemas/macro_service.schema.json @@ -42,6 +42,17 @@ } } } + }, + "MacroStartedRequest": { + "type": "object", + "description": "Informs the host that a macro has started.", + "properties": { + "macroDescription": {"$ref": "#/$defs/MacroDescription"} + } + }, + "MacroStartedResponse": { + "type": "object", + "description": "Host's response to a [MacroStartedRequest]." } } } From be9d3d73328f032d428bc2e64217af799c321b21 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Mon, 5 Aug 2024 14:14:38 +0200 Subject: [PATCH 2/2] Address review comments. --- pkgs/_macro_builder/lib/macro_builder.dart | 64 ++++++++----------- pkgs/_macro_builder/lib/src/bootstrap.dart | 34 ++++++++++ .../test/macro_builder_test.dart | 17 ++--- pkgs/_macro_client/lib/macro_client.dart | 20 +++--- .../_macro_client/test/macro_client_test.dart | 1 + pkgs/_macro_host/lib/macro_host.dart | 23 +++---- pkgs/_macro_host/test/macro_host_test.dart | 3 +- pkgs/_macro_runner/lib/macro_runner.dart | 4 +- .../_macro_runner/test/macro_runner_test.dart | 6 +- pkgs/_macro_server/lib/macro_server.dart | 6 +- pkgs/macro/lib/macro.dart | 5 ++ 11 files changed, 104 insertions(+), 79 deletions(-) create mode 100644 pkgs/_macro_builder/lib/src/bootstrap.dart diff --git a/pkgs/_macro_builder/lib/macro_builder.dart b/pkgs/_macro_builder/lib/macro_builder.dart index 03d834be..0c10da0e 100644 --- a/pkgs/_macro_builder/lib/macro_builder.dart +++ b/pkgs/_macro_builder/lib/macro_builder.dart @@ -6,6 +6,8 @@ import 'dart:io'; import 'package:dart_model/dart_model.dart'; +import 'src/bootstrap.dart'; + /// Builds macros. /// /// TODO(davidmorgan): add a way to clean up generated files and built output. @@ -16,40 +18,20 @@ class MacroBuilder { /// implements `Macro` from `package:macro`. /// /// The [packageConfig] must include the macros and all their deps. + /// + /// TODO(davidmorgan): figure out builder lifecycle: is it one builder per + /// host, one per workspace, one per build? + /// TODO(davidmorgan): replace `File` packageConfig with a concept of version + /// solve and workspace. + /// TODO(davidmorgan): support for multi-root workspaces. + /// TODO(davidmorgan): support (or decide not to support) in-memory overlay + /// filesystems. Future build( - File packageConfig, Iterable macroImplementations) async { + Uri packageConfig, Iterable macroImplementations) async { final script = createBootstrap(macroImplementations.toList()); return await MacroBuild(packageConfig, script).build(); } - - /// Creates the entrypoint script for [macros]. - static String createBootstrap(List macros) { - final script = StringBuffer(); - for (var i = 0; i != macros.length; ++i) { - final macro = macros[i]; - // TODO(davidmorgan): pick non-clashing prefixes. - script.writeln("import '${macro.uri}' as m$i;"); - } - script.write(''' -import 'dart:convert'; - -import 'package:_macro_client/macro_client.dart'; -import 'package:macro_service/macro_service.dart'; - -void main(List arguments) { - MacroClient.run( - endpoint: HostEndpoint.fromJson(json.decode(arguments[0])), - macros: ['''); - for (var i = 0; i != macros.length; ++i) { - final macro = macros[i]; - script.write('m$i.${macro.name}()'); - if (i != macros.length - 1) script.write(', '); - } - script.writeln(']);'); - script.writeln('}'); - return script.toString(); - } } /// A bundle of one or more macros that's ready to execute. @@ -61,8 +43,11 @@ class BuiltMacroBundle { } /// A single build. +/// +/// TODO(davidmorgan): split to interface+implementations as we add different +/// ways to build. class MacroBuild { - final File packageConfig; + final Uri packageConfig; final String script; final Directory workspace = Directory.systemTemp.createTempSync('macro_builder'); @@ -76,8 +61,8 @@ class MacroBuild { /// Throws on failure to build. Future build() async { final scriptFile = File.fromUri(workspace.uri.resolve('bin/main.dart')); - scriptFile.parent.createSync(recursive: true); - scriptFile.writeAsStringSync(script.toString()); + await scriptFile.create(recursive: true); + await scriptFile.writeAsString(script.toString()); final targetPackageConfig = File.fromUri(workspace.uri.resolve('.dart_tool/package_config.json')); @@ -90,7 +75,11 @@ class MacroBuild { // // For now just use the command line. - final result = Process.runSync('dart', ['compile', 'exe', 'bin/main.dart'], + final result = Process.runSync( + // TODO(davidmorgan): this is wrong if run from an AOT-compiled + // executable. + Platform.resolvedExecutable, + ['compile', 'exe', 'bin/main.dart', '--output=bin/main.exe'], workingDirectory: workspace.path); if (result.exitCode != 0) { throw StateError('Compile failed: ${result.stderr}'); @@ -100,11 +89,12 @@ class MacroBuild { File.fromUri(scriptFile.parent.uri.resolve('main.exe')).path); } - /// Returns the contents of [pubspec] with relative paths replaced to + /// Returns the contents of [packageConfig] with relative paths replaced to /// absolute paths, so the pubspec will work from any location. - String _makePackageConfigAbsolute(File pubspec) { - final root = pubspec.parent.parent.absolute.uri; - return pubspec + String _makePackageConfigAbsolute(Uri packageConfig) { + final file = File.fromUri(packageConfig); + final root = file.parent.parent.absolute.uri; + return file .readAsStringSync() .replaceAll('"rootUri": "../', '"rootUri": "$root'); } diff --git a/pkgs/_macro_builder/lib/src/bootstrap.dart b/pkgs/_macro_builder/lib/src/bootstrap.dart new file mode 100644 index 00000000..9bcc6722 --- /dev/null +++ b/pkgs/_macro_builder/lib/src/bootstrap.dart @@ -0,0 +1,34 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:dart_model/dart_model.dart'; + +/// Creates the entrypoint script for [macros]. +String createBootstrap(List macros) { + final script = StringBuffer(); + for (var i = 0; i != macros.length; ++i) { + final macro = macros[i]; + // TODO(davidmorgan): pick non-clashing prefixes. + script.writeln("import '${macro.uri}' as m$i;"); + } + script.write(''' +import 'dart:convert' as convert; + +import 'package:_macro_client/macro_client.dart' as macro_client; +import 'package:macro_service/macro_service.dart' as macro_service; + +void main(List arguments) { + macro_client.MacroClient.run( + endpoint: macro_service.HostEndpoint.fromJson( + convert.json.decode(arguments[0])), + macros: ['''); + for (var i = 0; i != macros.length; ++i) { + final macro = macros[i]; + script.write('m$i.${macro.name}()'); + if (i != macros.length - 1) script.write(', '); + } + script.writeln(']);'); + script.writeln('}'); + return script.toString(); +} diff --git a/pkgs/_macro_builder/test/macro_builder_test.dart b/pkgs/_macro_builder/test/macro_builder_test.dart index f52df4d9..1929737f 100644 --- a/pkgs/_macro_builder/test/macro_builder_test.dart +++ b/pkgs/_macro_builder/test/macro_builder_test.dart @@ -6,13 +6,14 @@ import 'dart:io'; import 'dart:isolate'; import 'package:_macro_builder/macro_builder.dart'; +import 'package:_macro_builder/src/bootstrap.dart'; import 'package:dart_model/dart_model.dart'; import 'package:test/test.dart'; void main() { group(MacroBuilder, () { test('bootstrap matches golden', () async { - final script = MacroBuilder.createBootstrap([ + final script = createBootstrap([ QualifiedName('package:_test_macros/declare_x_macro.dart#DeclareX'), QualifiedName('package:_test_macros/declare_y_macro.dart#DeclareY'), QualifiedName( @@ -23,14 +24,15 @@ void main() { import 'package:_test_macros/declare_x_macro.dart' as m0; import 'package:_test_macros/declare_y_macro.dart' as m1; import 'package:_more_macros/other_macro.dart' as m2; -import 'dart:convert'; +import 'dart:convert' as convert; -import 'package:_macro_client/macro_client.dart'; -import 'package:macro_service/macro_service.dart'; +import 'package:_macro_client/macro_client.dart' as macro_client; +import 'package:macro_service/macro_service.dart' as macro_service; void main(List arguments) { - MacroClient.run( - endpoint: HostEndpoint.fromJson(json.decode(arguments[0])), + macro_client.MacroClient.run( + endpoint: macro_service.HostEndpoint.fromJson( + convert.json.decode(arguments[0])), macros: [m0.DeclareX(), m1.DeclareY(), m2.OtherMacroImplementation()]); } '''); @@ -39,8 +41,7 @@ void main(List arguments) { test('builds macros', () async { final builder = MacroBuilder(); - final bundle = - await builder.build(File.fromUri(Isolate.packageConfigSync!), [ + final bundle = await builder.build(Isolate.packageConfigSync!, [ QualifiedName( 'package:_test_macros/declare_x_macro.dart#DeclareXImplementation') ]); diff --git a/pkgs/_macro_client/lib/macro_client.dart b/pkgs/_macro_client/lib/macro_client.dart index a150aeff..b89ff426 100644 --- a/pkgs/_macro_client/lib/macro_client.dart +++ b/pkgs/_macro_client/lib/macro_client.dart @@ -9,16 +9,20 @@ import 'package:macro/macro.dart'; import 'package:macro_service/macro_service.dart'; /// Runs macros, connecting them to a macro host. +/// +/// TODO(davidmorgan): handle shutdown and dispose. +/// TODO(davidmorgan): split to multpile implementations depending on +/// transport used to connect to host. class MacroClient { - final Iterable macros; - final Socket socket; - - MacroClient._(this.macros, this.socket) { + MacroClient._(Iterable macros, Socket socket) { // TODO(davidmorgan): negotiation about protocol version goes here. // Tell the host which macros are in this bundle. for (final macro in macros) { - _send(MacroStartedRequest(macroDescription: macro.description).node); + final request = MacroStartedRequest(macroDescription: macro.description); + // TODO(davidmorgan): currently this is JSON with one request per line, + // switch to binary. + socket.writeln(json.encode(request.node)); } } @@ -28,10 +32,4 @@ class MacroClient { final socket = await Socket.connect('localhost', endpoint.port); return MacroClient._(macros, socket); } - - void _send(Map node) { - // TODO(davidmorgan): currently this is JSON with one request per line, - // switch to binary. - socket.writeln(json.encode(node)); - } } diff --git a/pkgs/_macro_client/test/macro_client_test.dart b/pkgs/_macro_client/test/macro_client_test.dart index 481eb75a..f36c4979 100644 --- a/pkgs/_macro_client/test/macro_client_test.dart +++ b/pkgs/_macro_client/test/macro_client_test.dart @@ -14,6 +14,7 @@ void main() { group(MacroClient, () { test('connects to service', () async { final serverSocket = await ServerSocket.bind('localhost', 0); + addTearDown(serverSocket.close); unawaited(MacroClient.run( endpoint: HostEndpoint(port: serverSocket.port), diff --git a/pkgs/_macro_host/lib/macro_host.dart b/pkgs/_macro_host/lib/macro_host.dart index 50357e36..a553631d 100644 --- a/pkgs/_macro_host/lib/macro_host.dart +++ b/pkgs/_macro_host/lib/macro_host.dart @@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:io'; +import 'dart:async'; import 'package:_macro_builder/macro_builder.dart'; import 'package:_macro_runner/macro_runner.dart'; @@ -22,7 +22,7 @@ class MacroHost implements MacroService { // TODO(davidmorgan): this should be per macro, as part of tracking per-macro // lifecycle state. - Set? _macroPhases; + Completer>? _macroPhases; MacroHost._(this.macroServer, this.services) { services.services.insert(0, this); @@ -43,7 +43,7 @@ class MacroHost implements MacroService { } /// Whether [name] is a macro according to that package's `pubspec.yaml`. - bool isMacro(File packageConfig, QualifiedName name) { + bool isMacro(Uri packageConfig, QualifiedName name) { // TODO(language/3728): this is a placeholder, use package config when // available. return true; @@ -51,14 +51,14 @@ class MacroHost implements MacroService { /// Determines which phases the macro implemented at [name] runs in. Future> queryMacroPhases( - File packageConfig, QualifiedName name) async { - if (_macroPhases != null) return _macroPhases!; + Uri packageConfig, QualifiedName name) async { + // TODO(davidmorgan): track macro lifecycle, correctly run once per macro + // code change including if queried multiple times before response returns. + if (_macroPhases != null) return _macroPhases!.future; + _macroPhases = Completer(); final macroBundle = await macroBuilder.build(packageConfig, [name]); - macroRunner.run(macroBundle: macroBundle, endpoint: macroServer.endpoint); - // TODO(davidmorgan): wait explicitly for the MacroStartedRequest to - // arrive, remove this hard-coded wait. - await Future.delayed(const Duration(seconds: 2)); - return _macroPhases!; + macroRunner.start(macroBundle: macroBundle, endpoint: macroServer.endpoint); + return _macroPhases!.future; } /// Handle requests that are for the host. @@ -68,7 +68,8 @@ class MacroHost implements MacroService { // that should be passed through to the service that was passed in. final macroStartedRequest = MacroStartedRequest.fromJson(request as Map); - _macroPhases = macroStartedRequest.macroDescription.runsInPhases.toSet(); + _macroPhases! + .complete(macroStartedRequest.macroDescription.runsInPhases.toSet()); return MacroStartedResponse(); } diff --git a/pkgs/_macro_host/test/macro_host_test.dart b/pkgs/_macro_host/test/macro_host_test.dart index cf9abf84..789b2716 100644 --- a/pkgs/_macro_host/test/macro_host_test.dart +++ b/pkgs/_macro_host/test/macro_host_test.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:io'; import 'dart:isolate'; import 'package:_macro_host/macro_host.dart'; @@ -18,7 +17,7 @@ void main() { final macroName = QualifiedName( 'package:_test_macros/declare_x_macro.dart#DeclareXImplementation'); - final packageConfig = File.fromUri(Isolate.packageConfigSync!); + final packageConfig = Isolate.packageConfigSync!; expect(host.isMacro(packageConfig, macroName), true); expect(await host.queryMacroPhases(packageConfig, macroName), {2}); diff --git a/pkgs/_macro_runner/lib/macro_runner.dart b/pkgs/_macro_runner/lib/macro_runner.dart index 9377aab4..e2a6d8bd 100644 --- a/pkgs/_macro_runner/lib/macro_runner.dart +++ b/pkgs/_macro_runner/lib/macro_runner.dart @@ -12,8 +12,8 @@ import 'package:macro_service/macro_service.dart'; /// /// TODO(davidmorgan): support shutdown/cleanup. class MacroRunner { - /// Runs [macroBundle] connected to [endpoint]. - void run( + /// Starts [macroBundle] connected to [endpoint]. + void start( {required BuiltMacroBundle macroBundle, required HostEndpoint endpoint}) { Process.run(macroBundle.executablePath, [json.encode(endpoint)]); } diff --git a/pkgs/_macro_runner/test/macro_runner_test.dart b/pkgs/_macro_runner/test/macro_runner_test.dart index 5af9a140..20d052ef 100644 --- a/pkgs/_macro_runner/test/macro_runner_test.dart +++ b/pkgs/_macro_runner/test/macro_runner_test.dart @@ -15,16 +15,16 @@ void main() { group(MacroRunner, () { test('runs macros', () async { final builder = MacroBuilder(); - final bundle = - await builder.build(File.fromUri(Isolate.packageConfigSync!), [ + final bundle = await builder.build(Isolate.packageConfigSync!, [ QualifiedName( 'package:_test_macros/declare_x_macro.dart#DeclareXImplementation') ]); final serverSocket = await ServerSocket.bind('localhost', 0); + addTearDown(serverSocket.close); final runner = MacroRunner(); - runner.run( + runner.start( macroBundle: bundle, endpoint: HostEndpoint(port: serverSocket.port)); expect( diff --git a/pkgs/_macro_server/lib/macro_server.dart b/pkgs/_macro_server/lib/macro_server.dart index 7e171f54..746a6529 100644 --- a/pkgs/_macro_server/lib/macro_server.dart +++ b/pkgs/_macro_server/lib/macro_server.dart @@ -14,7 +14,7 @@ class MacroServer { final ServerSocket serverSocket; MacroServer._(this.service, this.endpoint, this.serverSocket) { - _handleConnections(); + serverSocket.forEach(_handleConnection); } /// Serves [service]. @@ -26,10 +26,6 @@ class MacroServer { service, HostEndpoint(port: serverSocket.port), serverSocket); } - void _handleConnections() { - serverSocket.forEach(_handleConnection); - } - void _handleConnection(Socket socket) { // TODO(davidmorgan): currently this is JSON with one request per line, // switch to binary. diff --git a/pkgs/macro/lib/macro.dart b/pkgs/macro/lib/macro.dart index f467b76b..6e0b0e83 100644 --- a/pkgs/macro/lib/macro.dart +++ b/pkgs/macro/lib/macro.dart @@ -8,6 +8,11 @@ import 'package:macro_service/macro_service.dart'; /// code. abstract interface class Macro { /// Description of the macro. + /// + /// TODO(davidmorgan): where possible the macro information should be + /// determined by `macro_builder` and injected in the bootstrap script rather + /// than relying on the user-written macro code to return it. + /// MacroDescription get description; /// Generate augmentatations and diagnostics for [request].