mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
3de78be2f0
This now supports real CompileRequest and CompileResponses, although it's missing features like importers, custom functions, and source maps.
48 lines
1.4 KiB
Dart
48 lines
1.4 KiB
Dart
// Copyright 2016 Google Inc. Use of this source code is governed by an
|
|
// MIT-style license that can be found in the LICENSE file or at
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:cli_pkg/cli_pkg.dart' as pkg;
|
|
import 'package:grinder/grinder.dart';
|
|
|
|
import 'utils.dart';
|
|
|
|
main(List<String> args) {
|
|
pkg.addGithubTasks();
|
|
grind(args);
|
|
}
|
|
|
|
@Task('Compile the protocol buffer definition to a Dart library.')
|
|
protobuf() async {
|
|
Directory('build').createSync(recursive: true);
|
|
|
|
// Make sure we use the version of protoc_plugin defined by our pubspec,
|
|
// rather than whatever version the developer might have globally installed.
|
|
log("Writing protoc-gen-dart");
|
|
if (Platform.isWindows) {
|
|
File('build/protoc-gen-dart.bat').writeAsStringSync('''
|
|
@echo off
|
|
pub run protoc_plugin %*
|
|
''');
|
|
} else {
|
|
File('build/protoc-gen-dart')
|
|
.writeAsStringSync('pub run protoc_plugin "\$@"');
|
|
run('chmod', arguments: ['a+x', 'build/protoc-gen-dart']);
|
|
}
|
|
|
|
await cloneOrPull("git://github.com/sass/embedded-protocol");
|
|
await runAsync("protoc",
|
|
arguments: [
|
|
"-Ibuild/embedded-protocol",
|
|
"embedded_sass.proto",
|
|
"--dart_out=lib/src/"
|
|
],
|
|
runOptions: RunOptions(environment: {
|
|
"PATH": 'build' +
|
|
(Platform.isWindows ? ";" : ":") +
|
|
Platform.environment["PATH"]
|
|
}));
|
|
}
|