mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
Pass the version variable to script snapshots at build time (#920)
Closes #914 See https://github.com/dart-lang/sdk/issues/36579#issuecomment-571386118
This commit is contained in:
parent
bfdf4b35a4
commit
e110961120
@ -1,3 +1,8 @@
|
||||
## 1.24.3
|
||||
|
||||
* Fix a bug where `sass --version` would crash for certain executable
|
||||
distributions.
|
||||
|
||||
## 1.24.2
|
||||
|
||||
* Fix a bug introduced in the previous release that prevented custom importers
|
||||
|
@ -5,4 +5,4 @@ REM https://opensource.org/licenses/MIT.
|
||||
|
||||
set SCRIPTPATH=%~dp0
|
||||
set arguments=%*
|
||||
dart.exe "-Dversion=SASS_VERSION" "%SCRIPTPATH%\sass.dart.snapshot" %arguments%
|
||||
dart.exe "%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" "-Dversion=SASS_VERSION" "%SCRIPTPATH%\src\sass.dart.snapshot" %arguments%
|
||||
"%SCRIPTPATH%\src\dart.exe" "%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" "-Dversion=SASS_VERSION" "$path/src/sass.dart.snapshot" "$@"
|
||||
exec "$path/src/dart" "$path/src/sass.dart.snapshot" "$@"
|
||||
|
@ -9,4 +9,4 @@ REM grinder package`.
|
||||
|
||||
set SCRIPTPATH=%~dp0
|
||||
set arguments=%*
|
||||
"%SCRIPTPATH%\src\dart.exe" "-Dversion=SASS_VERSION" "%SCRIPTPATH%\src\sass.dart.snapshot" %arguments%
|
||||
"%SCRIPTPATH%\src\dart.exe" "%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" "-Dversion=SASS_VERSION" "$path/src/sass.dart.snapshot" "$@"
|
||||
exec "$path/src/dart" "$path/src/sass.dart.snapshot" "$@"
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: sass
|
||||
version: 1.24.2
|
||||
version: 1.24.3
|
||||
description: A Sass implementation in Dart.
|
||||
author: Sass Team
|
||||
homepage: https://github.com/sass/dart-sass
|
||||
|
@ -32,8 +32,7 @@ void chocolateyPackage() {
|
||||
"package/chocolatey/chocolateyInstall.ps1"))
|
||||
..addFile(file("tools/chocolateyUninstall.ps1",
|
||||
"package/chocolatey/chocolateyUninstall.ps1"))
|
||||
..addFile(fileFromString("tools/sass.bat",
|
||||
readAndReplaceVersion("package/chocolatey/sass.bat")));
|
||||
..addFile(file("tools/sass.bat", "package/chocolatey/sass.bat"));
|
||||
|
||||
var output = "build/sass.${_chocolateyVersion()}.nupkg";
|
||||
log("Creating $output...");
|
||||
|
@ -18,7 +18,8 @@ bool get _is64Bit => Platform.version.contains("x64");
|
||||
@Task('Build Dart script snapshot.')
|
||||
void snapshot() {
|
||||
ensureBuild();
|
||||
Dart.run('bin/sass.dart', vmArgs: ['--snapshot=build/sass.dart.snapshot']);
|
||||
Dart.run('bin/sass.dart',
|
||||
vmArgs: ['-Dversion=$version', '--snapshot=build/sass.dart.snapshot']);
|
||||
}
|
||||
|
||||
@Task('Build a dev-mode Dart application snapshot.')
|
||||
@ -42,6 +43,7 @@ void _appSnapshot() {
|
||||
arguments: ['tool/app-snapshot-input.scss'],
|
||||
vmArgs: [
|
||||
'--enable-asserts',
|
||||
'-Dversion=$version',
|
||||
'--snapshot=build/sass.dart.app.snapshot',
|
||||
'--snapshot-kind=app-jit'
|
||||
],
|
||||
@ -103,15 +105,11 @@ Future<void> _buildPackage(String os) async {
|
||||
..addFile(file("dart-sass/src/sass.dart.snapshot",
|
||||
useNative ? "build/sass.dart.native" : "build/sass.dart.snapshot"))
|
||||
..addFile(file("dart-sass/src/SASS_LICENSE", "LICENSE"))
|
||||
..addFile(fileFromString(
|
||||
"dart-sass/dart-sass${os == 'windows' ? '.bat' : ''}",
|
||||
readAndReplaceVersion(
|
||||
"package/dart-sass.${os == 'windows' ? 'bat' : 'sh'}"),
|
||||
..addFile(file("dart-sass/dart-sass${os == 'windows' ? '.bat' : ''}",
|
||||
"package/dart-sass.${os == 'windows' ? 'bat' : 'sh'}",
|
||||
executable: true))
|
||||
..addFile(fileFromString(
|
||||
"dart-sass/sass${os == 'windows' ? '.bat' : ''}",
|
||||
readAndReplaceVersion(
|
||||
"package/sass.${os == 'windows' ? 'bat' : 'sh'}"),
|
||||
..addFile(file("dart-sass/sass${os == 'windows' ? '.bat' : ''}",
|
||||
"package/sass.${os == 'windows' ? 'bat' : 'sh'}",
|
||||
executable: true));
|
||||
|
||||
var prefix = 'build/dart-sass-$version-$os-$architecture';
|
||||
|
@ -35,11 +35,6 @@ void ensureBuild() {
|
||||
Directory('build').createSync(recursive: true);
|
||||
}
|
||||
|
||||
/// Reads [file], replaces all instances of SASS_VERSION with the actual
|
||||
/// version, and returns its contents.
|
||||
String readAndReplaceVersion(String file) =>
|
||||
File(file).readAsStringSync().replaceAll("SASS_VERSION", version);
|
||||
|
||||
/// Returns the environment variable named [name], or throws an exception if it
|
||||
/// can't be found.
|
||||
String environment(String name) {
|
||||
|
Loading…
Reference in New Issue
Block a user