OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library update_homebrew; | 5 library update_homebrew; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
11 import 'package:args/args.dart'; | 11 import 'package:args/args.dart'; |
12 import 'package:googleapis/common/common.dart' show DownloadOptions, Media; | 12 import 'package:googleapis/common/common.dart' show DownloadOptions, Media; |
13 import 'package:googleapis/storage/v1.dart' as storage; | 13 import 'package:googleapis/storage/v1.dart' as storage; |
14 import 'package:http/http.dart' as http; | 14 import 'package:http/http.dart' as http; |
15 import 'package:stack_trace/stack_trace.dart'; | 15 import 'package:stack_trace/stack_trace.dart'; |
16 | 16 |
17 String repository; // The path to the temporary git checkout of dart-homebrew. | 17 String repository; // The path to the temporary git checkout of dart-homebrew. |
18 Map gitEnvironment; // Pass a wrapper script for SSH to git in the environment. | 18 Map gitEnvironment; // Pass a wrapper script for SSH to git in the environment. |
19 | 19 |
20 const GITHUB_REPO = 'dart-lang/homebrew-dart'; | 20 const GITHUB_REPO = 'dart-lang/homebrew-dart'; |
21 | 21 |
22 const CHANNELS = const ['dev', 'stable']; | 22 const CHANNELS = const ['dev', 'stable']; |
23 | 23 |
24 const FILES = const [x64File, ia32File, dartiumFile, contentShellFile]; | 24 const FILES = const [x64File, ia32File, dartiumFile, contentShellFile]; |
25 | 25 |
26 const urlBase = 'https://storage.googleapis.com/dart-archive/channels'; | 26 const urlBase = 'https://storage.googleapis.com/dart-archive/channels'; |
27 const x64File = 'sdk/dartsdk-macos-x64-release.zip'; | 27 const x64File = 'sdk/dartsdk-macos-x64-release.zip'; |
28 const ia32File = 'sdk/dartsdk-macos-ia32-release.zip'; | 28 const ia32File = 'sdk/dartsdk-macos-ia32-release.zip'; |
29 const dartiumFile = 'dartium/dartium-macos-ia32-release.zip'; | 29 const dartiumFile = 'dartium/dartium-macos-x64-release.zip'; |
30 const contentShellFile = 'dartium/content_shell-macos-ia32-release.zip'; | 30 const contentShellFile = 'dartium/content_shell-macos-x64-release.zip'; |
31 | 31 |
32 Future<String> getHash256( | 32 Future<String> getHash256( |
33 String channel, String revision, String download) async { | 33 String channel, String revision, String download) async { |
34 var client = new http.Client(); | 34 var client = new http.Client(); |
35 try { | 35 try { |
36 var api = new storage.StorageApi(client); | 36 var api = new storage.StorageApi(client); |
37 var media = await api.objects.get('dart-archive', | 37 var media = await api.objects.get('dart-archive', |
38 'channels/$channel/release/$revision/$download.sha256sum', | 38 'channels/$channel/release/$revision/$download.sha256sum', |
39 downloadOptions: DownloadOptions.FullMedia); | 39 downloadOptions: DownloadOptions.FullMedia); |
40 | 40 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 await runGit(['push']); | 261 await runGit(['push']); |
262 } finally { | 262 } finally { |
263 await tempDir.delete(recursive: true); | 263 await tempDir.delete(recursive: true); |
264 } | 264 } |
265 }, onError: (error, chain) { | 265 }, onError: (error, chain) { |
266 print(error); | 266 print(error); |
267 print(chain.terse); | 267 print(chain.terse); |
268 }); | 268 }); |
269 } | 269 } |
OLD | NEW |