mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:18:06 +00:00
Update homebrew to drop the @2 tab and fix for 2.0
Change-Id: I1ece391c9c7cdcec9fd0662841bdbdaee7a7a373 Reviewed-on: https://dart-review.googlesource.com/69101 Reviewed-by: Alexander Thomas <athom@google.com>
This commit is contained in:
parent
ba119d7292
commit
8e2f28e264
|
@ -13,17 +13,14 @@ const CHANNELS = const ['dev', 'stable'];
|
|||
|
||||
const FILES = const {
|
||||
'dev': const [x64File, ia32File],
|
||||
'stable': const [x64File, ia32File, dartiumFile, contentShellFile]
|
||||
'stable': const [x64File, ia32File]
|
||||
};
|
||||
|
||||
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 dartiumFile = 'dartium/dartium-macos-x64-release.zip';
|
||||
const contentShellFile = 'dartium/content_shell-macos-x64-release.zip';
|
||||
|
||||
const dartRbFileName = 'dart.rb';
|
||||
const dart2RbFileName = 'dart@2.rb';
|
||||
|
||||
Future<String> getHash256(
|
||||
String channel, String revision, String download) async {
|
||||
|
@ -109,9 +106,6 @@ Future writeHomebrewInfo(
|
|||
await new File(p.join(repository, dartRbFileName)).writeAsString(
|
||||
createDartFormula(revisions, hashes, devVersion, stableVersion),
|
||||
flush: true);
|
||||
await new File(p.join(repository, dart2RbFileName)).writeAsString(
|
||||
createDart2Formula(revisions, hashes, devVersion, stableVersion),
|
||||
flush: true);
|
||||
}
|
||||
|
||||
String createDartFormula(
|
||||
|
@ -141,43 +135,10 @@ class Dart < Formula
|
|||
end
|
||||
end
|
||||
|
||||
option "with-content-shell", "Download and install content_shell -- headless Dartium for testing"
|
||||
option "with-dartium", "Download and install Dartium -- Chromium with Dart"
|
||||
|
||||
resource "content_shell" do
|
||||
version "$stableVersion"
|
||||
url "$urlBase/stable/release/${revisions['stable']}/$contentShellFile"
|
||||
sha256 "${hashes['stable'][contentShellFile]}"
|
||||
end
|
||||
|
||||
resource "dartium" do
|
||||
version "$stableVersion"
|
||||
url "$urlBase/stable/release/${revisions['stable']}/$dartiumFile"
|
||||
sha256 "${hashes['stable'][dartiumFile]}"
|
||||
end
|
||||
|
||||
def install
|
||||
libexec.install Dir["*"]
|
||||
bin.install_symlink "#{libexec}/bin/dart"
|
||||
bin.write_exec_script Dir["#{libexec}/bin/{pub,dart?*}"]
|
||||
|
||||
if build.with? "dartium"
|
||||
if build.devel?
|
||||
odie "dartium is no longer supported with --devel builds. Remove --with-dartium and try again."
|
||||
end
|
||||
dartium_binary = "Chromium.app/Contents/MacOS/Chromium"
|
||||
prefix.install resource("dartium")
|
||||
(bin+"dartium").write shim_script dartium_binary
|
||||
end
|
||||
|
||||
if build.with? "content-shell"
|
||||
if build.devel?
|
||||
odie "content-shell is no longer supported with --devel builds. Remove --with-content-shell and try again."
|
||||
end
|
||||
content_shell_binary = "Content Shell.app/Contents/MacOS/Content Shell"
|
||||
prefix.install resource("content_shell")
|
||||
(bin+"content_shell").write shim_script content_shell_binary
|
||||
end
|
||||
end
|
||||
|
||||
def shim_script(target)
|
||||
|
@ -205,60 +166,6 @@ class Dart < Formula
|
|||
end
|
||||
''';
|
||||
|
||||
/// TODO: Remove this formula after Dart 2 is released as stable.
|
||||
/// This is a transitional mechanism to support developers migrating
|
||||
/// from Dart 1 to Dart 2 while it's in pre-release.
|
||||
String createDart2Formula(
|
||||
Map revisions, Map hashes, String devVersion, String stableVersion) =>
|
||||
'''
|
||||
class DartAT2 < Formula
|
||||
desc "The Dart 2 SDK"
|
||||
homepage "https://www.dartlang.org/"
|
||||
version "$devVersion"
|
||||
|
||||
keg_only :versioned_formula
|
||||
|
||||
if MacOS.prefer_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]}"
|
||||
end
|
||||
|
||||
def install
|
||||
libexec.install Dir["*"]
|
||||
bin.install_symlink "#{libexec}/bin/dart"
|
||||
bin.write_exec_script Dir["#{libexec}/bin/{pub,dart?*}"]
|
||||
end
|
||||
|
||||
def shim_script(target)
|
||||
<<~EOS
|
||||
#!/usr/bin/env bash
|
||||
exec "#{prefix}/#{target}" "\$@"
|
||||
EOS
|
||||
end
|
||||
|
||||
def caveats; <<~EOS
|
||||
Note that this is a prerelease version of Dart.
|
||||
|
||||
Please note the path to the Dart SDK:
|
||||
#{opt_libexec}
|
||||
EOS
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"sample.dart").write <<~EOS
|
||||
void main() {
|
||||
print(r"test message");
|
||||
}
|
||||
EOS
|
||||
|
||||
assert_equal "test message\n", shell_output("#{bin}/dart sample.dart")
|
||||
end
|
||||
end
|
||||
''';
|
||||
|
||||
Future runGit(List<String> args, String repository,
|
||||
Map<String, String> gitEnvironment) async {
|
||||
print("git ${args.join(' ')}");
|
||||
|
|
|
@ -2,7 +2,7 @@ name: update_homebrew
|
|||
version: 0.1.0
|
||||
dependencies:
|
||||
_discoveryapis_commons: ^0.1.3+1
|
||||
args: ^0.13.0
|
||||
args: ^1.5.0
|
||||
googleapis: ^0.51.0
|
||||
http: ^0.11.1+1
|
||||
path: ^1.4.1
|
||||
|
|
Loading…
Reference in a new issue