Skip to content

Commit

Permalink
Use the embedded protocol from the Sass language repo
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed May 17, 2023
1 parent 17f7fab commit 829dae8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/util/initialize/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/sass}

- name: Generate Dart from protobuf
run: dart run grinder protobuf
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,10 @@ jobs:
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-host-node}

- name: Check out the JS API definition
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass, path: 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/sass
npm run compile
mv {`pwd`/,dist/}lib/src/vendor/dart-sass
working-directory: embedded-host-node
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion buf.work.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version: v1
directories: [build/embedded-protocol]
directories: [build/sass/spec]
9 changes: 5 additions & 4 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,16 @@ void main(List<String> args) {
"${pkg.githubReleaseNotes.defaultValue}";

pkg.environmentConstants.fn = () {
if (!Directory('build/embedded-protocol').existsSync()) {
if (!Directory('build/sass').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/sass/spec/EMBEDDED_PROTOCOL_VERSION')
.readAsStringSync()
.trim(),
"compiler-version": pkg.pubspec.version!.toString(),
};
};
Expand Down Expand Up @@ -202,7 +203,7 @@ 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");
}

await runAsync("buf",
Expand Down

0 comments on commit 829dae8

Please sign in to comment.