dart: 3.8.0 -> 3.8.1 (#423024)

This commit is contained in:
Tristan Ross
2025-07-13 06:57:56 -07:00
committed by GitHub
3 changed files with 38 additions and 91 deletions
+21 -11
View File
@@ -1,8 +1,10 @@
{
stdenv,
lib,
stdenv,
fetchurl,
unzip,
bintools,
versionCheckHook,
runCommand,
cctools,
darwin,
@@ -23,16 +25,25 @@ stdenv.mkDerivation (finalAttrs: {
installPhase =
''
mkdir -p $out
cp -R * $out/
echo $libPath
runHook preInstall
cp -R . $out
''
+ lib.optionalString (stdenv.hostPlatform.isLinux) ''
find $out/bin -executable -type f -exec patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \;
find $out/bin -executable -type f -exec patchelf --set-interpreter ${bintools.dynamicLinker} {} \;
''
+ ''
runHook postInstall
'';
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
dontStrip = true;
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
passthru = {
updateScript = ./update.sh;
tests = {
@@ -67,9 +78,9 @@ stdenv.mkDerivation (finalAttrs: {
};
};
meta = with lib; {
meta = {
homepage = "https://dart.dev";
maintainers = with maintainers; [ grburst ];
maintainers = with lib.maintainers; [ grburst ];
description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps";
longDescription = ''
Dart is a class-based, single inheritance, object-oriented language
@@ -79,12 +90,11 @@ stdenv.mkDerivation (finalAttrs: {
mainProgram = "dart";
platforms = [
"x86_64-linux"
"i686-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.bsd3;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.bsd3;
};
})
+5 -9
View File
@@ -1,27 +1,23 @@
let
version = "3.8.0";
version = "3.8.1";
in
{ fetchurl }:
{
versionUsed = version;
"${version}-x86_64-darwin" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-x64-release.zip";
sha256 = "0qkhzk9mn7xhdg03g3nj24zfalm4fd8k054gnncdsjn2vz1fhgpg";
hash = "sha256-OTcd89ZPlPWz2cERnD9UkWTFYoxqE7lFG3tEhZ8fkRQ=";
};
"${version}-aarch64-darwin" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-macos-arm64-release.zip";
sha256 = "1vlyncm8hyfvwkdjvvkmra3b3mj7rz7sxwy2xjh07dkrmvw0n4cy";
hash = "sha256-UIC8b0p4zM4OOOceRkdsCNYeCBRTZGlI8/DHcXepKPg=";
};
"${version}-aarch64-linux" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-arm64-release.zip";
sha256 = "09gmkyg0h662n8wd3k1mx8sglvwa9l5cfhaq934hvcvpc16ajssy";
hash = "sha256-eKMkAJe+47ebAJxp6tIuGq7e3ty+CT6qmACExWYQlsg=";
};
"${version}-x86_64-linux" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-x64-release.zip";
sha256 = "1kpkd1c48y0v6hi5pabxhijd04aqbq1fqw3lcsrfkyig84gawbhj";
};
"${version}-i686-linux" = fetchurl {
url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${version}/sdk/dartsdk-linux-ia32-release.zip";
sha256 = "0bcb95wadwhq0m64h9mrycdzp9ssnkh4lh3x3hf19py0ak6ix14v";
hash = "sha256-DVjAEKNh8/FYixwvV5QvfMr3t6u+A0BP73oQLrY48J0=";
};
}
+12 -71
View File
@@ -1,80 +1,21 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq
#!nix-shell -i bash -p curl jq common-updater-scripts
set -euo pipefail
# so if the script fails, debug logs are on stderr
log() {
>&2 echo "DART_UPDATER: $@"
}
latestVersion=$(curl -sL https://storage.googleapis.com/dart-archive/channels/stable/release/latest/VERSION | jq --raw-output .version)
currentVersion=$(nix eval --raw -f . dart.version)
# fetch the latest version number from upstream
NEW_VER_DETAILS=$(curl -sL https://storage.googleapis.com/dart-archive/channels/stable/release/latest/VERSION)
NEW_VER=$(jq -r '.version' <<< "$NEW_VER_DETAILS")
if [[ "$latestVersion" == "$currentVersion" ]]; then
exit 0
fi
MY_PATH=$(dirname $(realpath "$0"))
SRC_FILE=$(mktemp)
log "file to write is $SRC_FILE"
update-source-version dart $latestVersion --file=$MY_PATH/sources.nix
PRELUDE="let
version = \"$NEW_VER\";
in
{ fetchurl }:
{
versionUsed = version;"
echo "$PRELUDE" > "$SRC_FILE"
log "wrote prelude"
# Fetches the source, then writes the fetcher and hash into the sources file.
# Arguments:
# - $1: VARIABLE NAME of (table of nix platform -> dart platform mappings) ("DARWIN_PLATFORMS"|"LIN_PLATFORMS")
# - $2: Dart-OS ("macos"|"linux")
write_for_platform() {
BASE_OF_ALL_URLS='https://storage.googleapis.com/dart-archive/channels/stable/release'
BASE_URL_WRITTEN="$BASE_OF_ALL_URLS/\${version}/sdk"
BASE_URL_FETCHED="$BASE_OF_ALL_URLS/$NEW_VER/sdk"
TABLE_NAME=$1
declare -n TABLE=$TABLE_NAME
for platform in "${!TABLE[@]}"; do
DART_PLATFORM="${TABLE[$platform]}"
log "trying for dartplatform $DART_PLATFORM (platform $platform) (OS $2)"
URL_POSTFIX="dartsdk-$2-$DART_PLATFORM-release.zip"
URL="$BASE_URL_FETCHED/$URL_POSTFIX"
log "URL for $DART_PLATFORM: $URL"
HASH=$(nix-prefetch-url "$URL" --type sha256)
log "hash for platform $platform: $HASH"
FETCHER=" \"\${version}-$platform\" = fetchurl {
url = \"$BASE_URL_WRITTEN/$URL_POSTFIX\";
sha256 = \"$HASH\";
};"
echo "$FETCHER" >> $SRC_FILE
done
log "finished for $1"
}
# Map nix platforms -> Dart platforms
X8664="x64"
AARCH64="arm64"
I686="ia32"
declare -A DARWIN_PLATFORMS=(["aarch64-darwin"]="$AARCH64"
["x86_64-darwin"]="$X8664")
declare -A LIN_PLATFORMS=( ["x86_64-linux"]="$X8664"
["i686-linux"]="$I686"
["aarch64-linux"]="$AARCH64")
write_for_platform "DARWIN_PLATFORMS" "macos"
write_for_platform "LIN_PLATFORMS" "linux"
echo '}' >> $SRC_FILE
log "moving tempfile to target directory"
mv "$SRC_FILE" "$MY_PATH/sources.nix"
systems=$(nix eval --json -f . dart.meta.platforms | jq --raw-output '.[]')
for system in $systems; do
hash=$(nix hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix eval --raw -f . dart.src.url --system "$system")))
update-source-version dart $latestVersion $hash --file=$MY_PATH/sources.nix --system=$system --ignore-same-version --ignore-same-hash
done