From eb18526913bf38bd0fa59f5220fda706e82f922d Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 17 May 2023 13:12:44 -0700 Subject: [PATCH] Use the embedded protocol from the Sass language repo (#1966) --- .github/util/initialize/action.yml | 4 ++-- .github/workflows/ci.yml | 9 ++++----- README.md | 2 +- buf.work.yaml | 2 +- tool/grind.dart | 10 ++++++---- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/util/initialize/action.yml b/.github/util/initialize/action.yml index 858aceaee..f122d196b 100644 --- a/.github/util/initialize/action.yml +++ b/.github/util/initialize/action.yml @@ -26,9 +26,9 @@ runs: - uses: bufbuild/buf-setup-action@v1.13.1 with: {github_token: "${{ inputs.github-token }}"} - - name: Check out embedded Sass protocol + - name: Check out the language repo uses: sass/clone-linked-repo@v1 - with: {repo: sass/embedded-protocol, path: build/embedded-protocol} + with: {repo: sass/sass, path: build/language} - name: Generate Dart from protobuf run: dart run grinder protobuf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9081d8f8..49c37a73e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,15 +162,14 @@ jobs: uses: sass/clone-linked-repo@v1 with: {repo: sass/embedded-host-node} - - name: Check out the JS API definition + - name: Check out the language repo uses: sass/clone-linked-repo@v1 - with: {repo: sass/sass, path: language} + with: {repo: sass/sass, path: build/language} - name: Initialize embedded host run: | npm install - npm run init -- --protocol-path=../build/embedded-protocol \ - --compiler-path=.. --api-path=../language + npm run init -- --compiler-path=.. --language-path=../build/language npm run compile mv {`pwd`/,dist/}lib/src/vendor/dart-sass working-directory: embedded-host-node @@ -185,7 +184,7 @@ jobs: fi - name: Run tests - run: npm run js-api-spec -- --sassPackage ../embedded-host-node --sassSassRepo ../language + run: npm run js-api-spec -- --sassPackage ../embedded-host-node --sassSassRepo ../build/language working-directory: sass-spec dart_tests: diff --git a/README.md b/README.md index df46ad10e..d07fa04bb 100644 --- a/README.md +++ b/README.md @@ -316,7 +316,7 @@ Dart Sass includes an implementation of the compiler side of the [Embedded Sass protocol]. It's designed to be embedded in a host language, which then exposes an API for users to invoke Sass and define custom functions and importers. -[Embedded Sass protocol]: https://github.com/sass/sass-embedded-protocol/blob/master/README.md#readme +[Embedded Sass protocol]: https://github.com/sass/sass/blob/main/spec/embedded-protocol.md ### Usage diff --git a/buf.work.yaml b/buf.work.yaml index 0cc295bc9..3ffcae58c 100644 --- a/buf.work.yaml +++ b/buf.work.yaml @@ -1,2 +1,2 @@ version: v1 -directories: [build/embedded-protocol] +directories: [build/language/spec] diff --git a/tool/grind.dart b/tool/grind.dart index 2c02f8dc1..b84ad12f3 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -58,15 +58,16 @@ void main(List args) { "${pkg.githubReleaseNotes.defaultValue}"; pkg.environmentConstants.fn = () { - if (!Directory('build/embedded-protocol').existsSync()) { + if (!Directory('build/language').existsSync()) { fail('Run `dart run grinder protobuf` before building Dart Sass ' 'executables.'); } return { ...pkg.environmentConstants.defaultValue, - "protocol-version": - File('build/embedded-protocol/VERSION').readAsStringSync().trim(), + "protocol-version": File('build/language/spec/EMBEDDED_PROTOCOL_VERSION') + .readAsStringSync() + .trim(), "compiler-version": pkg.pubspec.version!.toString(), }; }; @@ -202,7 +203,8 @@ dart run protoc_plugin "\$@" } if (Platform.environment['UPDATE_SASS_PROTOCOL'] != 'false') { - cloneOrCheckout("https://github.com/sass/embedded-protocol.git", "main"); + cloneOrCheckout("https://github.com/sass/sass.git", "main", + name: 'language'); } await runAsync("buf",