mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 09:43:08 +00:00
Support homebrew on Linux
Fix dart-lang/homebrew-dart#42 Closes #38512 https://github.com/dart-lang/sdk/pull/38512 GitOrigin-RevId: 561d002a18d95b97f217904f0f024c71fad0cb3d Change-Id: I6ab2ef15e4220d641848bec15a12d9b64e375cb5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118376 Reviewed-by: Alexander Thomas <athom@google.com>
This commit is contained in:
parent
ee0b1df4a6
commit
6aa415841c
1 changed files with 47 additions and 19 deletions
|
@ -1,13 +1,19 @@
|
|||
part of '../update_homebrew.dart';
|
||||
|
||||
const _files = {
|
||||
'dev': [_x64File, _ia32File],
|
||||
'stable': [_x64File, _ia32File]
|
||||
'dev': [_x64Files, _ia32Files],
|
||||
'stable': [_x64Files, _ia32Files]
|
||||
};
|
||||
|
||||
const _urlBase = 'https://storage.googleapis.com/dart-archive/channels';
|
||||
const _x64File = 'sdk/dartsdk-macos-x64-release.zip';
|
||||
const _ia32File = 'sdk/dartsdk-macos-ia32-release.zip';
|
||||
const _x64Files = {
|
||||
'mac': 'sdk/dartsdk-macos-x64-release.zip',
|
||||
'linux': 'sdk/dartsdk-linux-x64-release.zip',
|
||||
};
|
||||
const _ia32Files = {
|
||||
'mac': 'sdk/dartsdk-macos-ia32-release.zip',
|
||||
'linux': 'sdk/dartsdk-linux-ia32-release.zip',
|
||||
};
|
||||
|
||||
Future<String> _getHash256(
|
||||
String channel, String revision, String download) async {
|
||||
|
@ -66,9 +72,11 @@ Future<Map<String, Map>> _getHashes(Map<String, String> revisions) async {
|
|||
var hashes = <String, Map>{};
|
||||
for (var channel in supportedChannels) {
|
||||
hashes[channel] = {};
|
||||
for (var file in _files[channel]) {
|
||||
var hash = await _getHash256(channel, revisions[channel], file);
|
||||
hashes[channel][file] = hash;
|
||||
for (var files in _files[channel]) {
|
||||
for (var file in files.values) {
|
||||
var hash = await _getHash256(channel, revisions[channel], file);
|
||||
hashes[channel][file] = hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hashes;
|
||||
|
@ -82,22 +90,42 @@ class Dart < Formula
|
|||
homepage "https://www.dartlang.org/"
|
||||
|
||||
version "$stableVersion"
|
||||
if Hardware::CPU.is_64_bit?
|
||||
url "$_urlBase/stable/release/${revisions['stable']}/$_x64File"
|
||||
sha256 "${hashes['stable'][_x64File]}"
|
||||
else
|
||||
url "$_urlBase/stable/release/${revisions['stable']}/$_ia32File"
|
||||
sha256 "${hashes['stable'][_ia32File]}"
|
||||
if OS.mac?
|
||||
if Hardware::CPU.is_64_bit?
|
||||
url "$_urlBase/stable/release/${revisions['stable']}/${_x64Files['mac']}"
|
||||
sha256 "${hashes['stable'][_x64Files['mac']]}"
|
||||
else
|
||||
url "$_urlBase/stable/release/${revisions['stable']}/${_ia32Files['mac']}"
|
||||
sha256 "${hashes['stable'][_ia32Files['mac']]}"
|
||||
end
|
||||
elsif OS.linux?
|
||||
if Hardware::CPU.is_64_bit?
|
||||
url "$_urlBase/stable/release/${revisions['stable']}/${_x64Files['linux']}"
|
||||
sha256 "${hashes['stable'][_x64Files['linux']]}"
|
||||
else
|
||||
url "$_urlBase/stable/release/${revisions['stable']}/${_ia32Files['linux']}"
|
||||
sha256 "${hashes['stable'][_ia32Files['linux']]}"
|
||||
end
|
||||
end
|
||||
|
||||
devel do
|
||||
version "$devVersion"
|
||||
if Hardware::CPU.is_64_bit?
|
||||
url "$_urlBase/dev/release/${revisions['dev']}/$_x64File"
|
||||
sha256 "${hashes['dev'][_x64File]}"
|
||||
else
|
||||
url "$_urlBase/dev/release/${revisions['dev']}/$_ia32File"
|
||||
sha256 "${hashes['dev'][_ia32File]}"
|
||||
if OS.mac?
|
||||
if Hardware::CPU.is_64_bit?
|
||||
url "$_urlBase/dev/release/${revisions['dev']}/${_x64Files['mac']}"
|
||||
sha256 "${hashes['dev'][_x64Files['mac']]}"
|
||||
else
|
||||
url "$_urlBase/dev/release/${revisions['dev']}/${_ia32Files['mac']}"
|
||||
sha256 "${hashes['dev'][_ia32Files['mac']]}"
|
||||
end
|
||||
elsif OS.linux?
|
||||
if Hardware::CPU.is_64_bit?
|
||||
url "$_urlBase/dev/release/${revisions['dev']}/${_x64Files['linux']}"
|
||||
sha256 "${hashes['dev'][_x64Files['linux']]}"
|
||||
else
|
||||
url "$_urlBase/dev/release/${revisions['dev']}/${_ia32Files['linux']}"
|
||||
sha256 "${hashes['dev'][_ia32Files['linux']]}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue