mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
Run in Dart 2 runtime mode everywhere
This commit is contained in:
parent
0aca829515
commit
80afdd88f8
13
.travis.yml
13
.travis.yml
@ -3,25 +3,20 @@
|
||||
# Set the language to Ruby so that we can run sass-spec tests.
|
||||
language: ruby
|
||||
|
||||
# TODO(nweiz): We're currently locked to Dart 2.0.0 and 2.0.0-dev.5.0 because
|
||||
# 2.0.0-dev.6.0 removes the --preview-dart-2 flag, which we use because it's
|
||||
# faster than Dart 2 mode (at least in 2.0.0). Re-enable tracking the latest
|
||||
# stable and dev versions once a stable release is out where Dart 2 mode is
|
||||
# verified to be faster than Dart 1 mode was in Dart 2.1.0.
|
||||
|
||||
env:
|
||||
global:
|
||||
- DART_CHANNEL=stable
|
||||
- DART_VERSION=2.0.0
|
||||
- DART_VERSION=latest
|
||||
matrix:
|
||||
# Language specs, defined in sass/sass-spec
|
||||
- TASK=specs
|
||||
- TASK=specs DART_CHANNEL=dev DART_VERSION=2.1.0-dev.5.0
|
||||
- TASK=specs DART_CHANNEL=dev
|
||||
- TASK=specs ASYNC=true
|
||||
|
||||
# Unit tests, defined in test/.
|
||||
- TASK=tests
|
||||
- TASK=tests DART_CHANNEL=dev DART_VERSION=2.1.0-dev.5.0
|
||||
- TASK=tests DART_VERSION=2.0.0
|
||||
- TASK=tests DART_CHANNEL=dev
|
||||
- TASK=tests NODE_VERSION=stable
|
||||
|
||||
# Keep these up-to-date with the latest LTA Node releases. They next need to be
|
||||
|
@ -5,4 +5,4 @@ REM https://opensource.org/licenses/MIT.
|
||||
|
||||
set SCRIPTPATH=%~dp0
|
||||
set arguments=%*
|
||||
dart.exe --no-preview-dart-2 "-Dversion=SASS_VERSION" "%SCRIPTPATH%\sass.dart.snapshot" %arguments%
|
||||
dart.exe "-Dversion=SASS_VERSION" "%SCRIPTPATH%\sass.dart.snapshot" %arguments%
|
||||
|
@ -11,4 +11,4 @@ echo "WARNING: The dart-sass executable is deprecated, use sass instead."
|
||||
|
||||
set SCRIPTPATH=%~dp0
|
||||
set arguments=%*
|
||||
"%SCRIPTPATH%\src\dart.exe" --no-preview-dart-2 "-Dversion=SASS_VERSION" "%SCRIPTPATH%\src\sass.dart.snapshot" %arguments%
|
||||
"%SCRIPTPATH%\src\dart.exe" "-Dversion=SASS_VERSION" "%SCRIPTPATH%\src\sass.dart.snapshot" %arguments%
|
||||
|
@ -22,4 +22,4 @@ fi
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
path=`dirname "$(follow_links "$BASH_SOURCE")"`
|
||||
exec "$path/src/dart" --no-preview-dart-2 "-Dversion=SASS_VERSION" "$path/src/sass.dart.snapshot" "$@"
|
||||
exec "$path/src/dart" "-Dversion=SASS_VERSION" "$path/src/sass.dart.snapshot" "$@"
|
||||
|
@ -9,4 +9,4 @@ REM grinder package`.
|
||||
|
||||
set SCRIPTPATH=%~dp0
|
||||
set arguments=%*
|
||||
"%SCRIPTPATH%\src\dart.exe" --no-preview-dart-2 "-Dversion=SASS_VERSION" "%SCRIPTPATH%\src\sass.dart.snapshot" %arguments%
|
||||
"%SCRIPTPATH%\src\dart.exe" "-Dversion=SASS_VERSION" "%SCRIPTPATH%\src\sass.dart.snapshot" %arguments%
|
||||
|
@ -18,4 +18,4 @@ follow_links() {
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
path=`dirname "$(follow_links "$0")"`
|
||||
exec "$path/src/dart" --no-preview-dart-2 "-Dversion=SASS_VERSION" "$path/src/sass.dart.snapshot" "$@"
|
||||
exec "$path/src/dart" "-Dversion=SASS_VERSION" "$path/src/sass.dart.snapshot" "$@"
|
||||
|
@ -51,7 +51,7 @@ Future<TestProcess> runSass(Iterable<String> arguments,
|
||||
(path) => new File(path).existsSync(),
|
||||
orElse: () => p.absolute("bin/sass.dart"));
|
||||
|
||||
var args = ["--no-preview-dart-2", "--checked"];
|
||||
var args = ["--enable-asserts"];
|
||||
|
||||
// Work around dart-lang/sdk#33622.
|
||||
if (Platform.isWindows) args.add("--packages=${p.absolute('.packages')}");
|
||||
|
@ -90,8 +90,7 @@ Future _writeNTimes(String path, String text, num times,
|
||||
}
|
||||
|
||||
@Task('Run benchmarks for Sass compilation speed.')
|
||||
@Depends(benchmarkGenerate, snapshot, releaseAppSnapshot, snapshotDart2,
|
||||
releaseDart2AppSnapshot, npmReleasePackage)
|
||||
@Depends(benchmarkGenerate, snapshot, releaseAppSnapshot, npmReleasePackage)
|
||||
benchmark() async {
|
||||
var libsass = await cloneOrPull('https://github.com/sass/libsass');
|
||||
var sassc = await cloneOrPull('https://github.com/sass/sassc');
|
||||
@ -184,35 +183,21 @@ I ran five instances of each configuration and recorded the fastest time.
|
||||
var sasscTime = await _benchmark(p.join(sassc, 'bin', 'sassc'), [path]);
|
||||
buffer.writeln("* sassc: ${_formatTime(sasscTime)}");
|
||||
|
||||
var scriptSnapshotTime = await _benchmark(Platform.executable,
|
||||
['--no-preview-dart-2', p.join('build', 'sass.dart.snapshot'), path]);
|
||||
buffer.writeln("* Dart Sass from a Dart 1 script snapshot: "
|
||||
var scriptSnapshotTime = await _benchmark(Platform.executable, [
|
||||
'--no-enable-asserts',
|
||||
p.join('build', 'sass.dart.snapshot'),
|
||||
path
|
||||
]);
|
||||
buffer.writeln("* Dart Sass from a script snapshot: "
|
||||
"${_formatTime(scriptSnapshotTime)}");
|
||||
|
||||
var appSnapshotTime = await _benchmark(Platform.executable, [
|
||||
'--no-preview-dart-2',
|
||||
'--no-checked',
|
||||
'--no-enable-asserts',
|
||||
p.join('build', 'sass.dart.app.snapshot'),
|
||||
path
|
||||
]);
|
||||
buffer.writeln(
|
||||
"* Dart Sass from a Dart 1 app snapshot: ${_formatTime(appSnapshotTime)}");
|
||||
|
||||
var dart2ScriptSnapshotTime = await _benchmark(Platform.executable, [
|
||||
'--no-enable-asserts',
|
||||
p.join('build', 'sass.dart.dart2.snapshot'),
|
||||
path
|
||||
]);
|
||||
buffer.writeln("* Dart Sass from a Dart 2 script snapshot: "
|
||||
"${_formatTime(dart2ScriptSnapshotTime)}");
|
||||
|
||||
var dart2AppSnapshotTime = await _benchmark(Platform.executable, [
|
||||
'--no-enable-asserts',
|
||||
p.join('build', 'sass.dart.app.dart2.snapshot'),
|
||||
path
|
||||
]);
|
||||
buffer.writeln("* Dart Sass from a Dart 2 app snapshot: "
|
||||
"${_formatTime(dart2AppSnapshotTime)}");
|
||||
buffer.writeln("* Dart Sass from an app snapshot: "
|
||||
"${_formatTime(appSnapshotTime)}");
|
||||
|
||||
var nodeTime =
|
||||
await _benchmark("node", [p.join('build', 'npm', 'sass.js'), path]);
|
||||
@ -227,15 +212,10 @@ I ran five instances of each configuration and recorded the fastest time.
|
||||
'approximately:');
|
||||
buffer.writeln();
|
||||
buffer.writeln('* ${_compare(appSnapshotTime, sasscTime)} libsass');
|
||||
buffer
|
||||
.writeln('* ${_compare(appSnapshotTime, dart2AppSnapshotTime)} Dart 2');
|
||||
buffer
|
||||
.writeln('* ${_compare(appSnapshotTime, nodeTime)} Dart Sass on Node');
|
||||
buffer.writeln('* ${_compare(appSnapshotTime, rubyTime)} Ruby Sass');
|
||||
buffer.writeln();
|
||||
buffer.writeln('A Dart 1 script snapshot is approximately '
|
||||
'${_compare(scriptSnapshotTime, dart2ScriptSnapshotTime)} Dart 2.');
|
||||
buffer.writeln();
|
||||
log('');
|
||||
}
|
||||
|
||||
|
@ -20,14 +20,7 @@ bool get _is64Bit => Platform.version.contains("x64");
|
||||
snapshot() {
|
||||
ensureBuild();
|
||||
Dart.run('bin/sass.dart',
|
||||
vmArgs: ['--no-preview-dart-2', '--snapshot=build/sass.dart.snapshot']);
|
||||
}
|
||||
|
||||
@Task('Build Dart 2 script snapshot.')
|
||||
snapshotDart2() {
|
||||
ensureBuild();
|
||||
Dart.run('bin/sass.dart',
|
||||
vmArgs: ['--snapshot=build/sass.dart.dart2.snapshot']);
|
||||
vmArgs: ['--snapshot=build/sass.dart.snapshot']);
|
||||
}
|
||||
|
||||
@Task('Build a dev-mode Dart application snapshot.')
|
||||
@ -38,29 +31,17 @@ appSnapshot() => _appSnapshot(release: false);
|
||||
@Task('Build a release-mode Dart application snapshot.')
|
||||
releaseAppSnapshot() => _appSnapshot(release: true);
|
||||
|
||||
@Task('Build a release-mode Dart 2 application snapshot.')
|
||||
releaseDart2AppSnapshot() => _appSnapshot(release: true, dart2: true);
|
||||
|
||||
/// Compiles Sass to an application snapshot.
|
||||
///
|
||||
/// If [release] is `true`, this compiles in checked mode. Otherwise, it
|
||||
/// compiles in unchecked mode. If [dart2] is `true`, this compiles in Dart 2
|
||||
/// mode. Otherwise, it compiles in Dart 1 mode.
|
||||
void _appSnapshot({@required bool release, bool dart2: false}) {
|
||||
/// compiles in unchecked mode.
|
||||
void _appSnapshot({@required bool release}) {
|
||||
var args = [
|
||||
'--snapshot=build/sass.dart.app${dart2 ? '.dart2' : ''}.snapshot',
|
||||
'--snapshot=build/sass.dart.app.snapshot',
|
||||
'--snapshot-kind=app-jit'
|
||||
];
|
||||
|
||||
if (!dart2) args.add('--no-preview-dart-2');
|
||||
|
||||
if (!release) {
|
||||
if (dart2) {
|
||||
args.add('--enable-asserts');
|
||||
} else {
|
||||
args.add('--checked');
|
||||
}
|
||||
}
|
||||
if (!release) args.add('--enable-asserts');
|
||||
|
||||
ensureBuild();
|
||||
Dart.run('bin/sass.dart',
|
||||
|
Loading…
Reference in New Issue
Block a user