OLD | NEW |
---|---|
1 import 'dart:async'; | 1 import 'dart:async'; |
2 import 'dart:convert'; | 2 import 'dart:convert'; |
3 import 'dart:io'; | 3 import 'dart:io'; |
4 | 4 |
5 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart'; | 5 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart'; |
6 import 'package:googleapis/storage/v1.dart' as storage; | 6 import 'package:googleapis/storage/v1.dart' as storage; |
7 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 | 9 |
10 const GITHUB_REPO = 'dart-lang/homebrew-dart'; | 10 const GITHUB_REPO = 'dart-lang/homebrew-dart'; |
11 | 11 |
12 const CHANNELS = const ['dev', 'stable']; | 12 const CHANNELS = const ['dev', 'stable']; |
13 | 13 |
14 const FILES = const [x64File, ia32File, dartiumFile, contentShellFile]; | 14 const FILES = const { |
15 'dev': const [x64File, ia32File], | |
16 'stable': const [x64File, ia32File, dartiumFile, contentShellFile] | |
17 }; | |
15 | 18 |
16 const urlBase = 'https://storage.googleapis.com/dart-archive/channels'; | 19 const urlBase = 'https://storage.googleapis.com/dart-archive/channels'; |
17 const x64File = 'sdk/dartsdk-macos-x64-release.zip'; | 20 const x64File = 'sdk/dartsdk-macos-x64-release.zip'; |
18 const ia32File = 'sdk/dartsdk-macos-ia32-release.zip'; | 21 const ia32File = 'sdk/dartsdk-macos-ia32-release.zip'; |
19 const dartiumFile = 'dartium/dartium-macos-x64-release.zip'; | 22 const dartiumFile = 'dartium/dartium-macos-x64-release.zip'; |
20 const contentShellFile = 'dartium/content_shell-macos-x64-release.zip'; | 23 const contentShellFile = 'dartium/content_shell-macos-x64-release.zip'; |
21 | 24 |
22 const dartRbFileName = 'dart.rb'; | 25 const dartRbFileName = 'dart.rb'; |
23 | 26 |
24 Future<String> getHash256( | 27 Future<String> getHash256( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 revisions[channel] = | 75 revisions[channel] = |
73 regExp.firstMatch(lines.firstWhere(regExp.hasMatch)).group(1); | 76 regExp.firstMatch(lines.firstWhere(regExp.hasMatch)).group(1); |
74 } | 77 } |
75 return revisions; | 78 return revisions; |
76 } | 79 } |
77 | 80 |
78 Future<Map> getHashes(Map revisions) async { | 81 Future<Map> getHashes(Map revisions) async { |
79 var hashes = <String, Map>{}; | 82 var hashes = <String, Map>{}; |
80 for (var channel in CHANNELS) { | 83 for (var channel in CHANNELS) { |
81 hashes[channel] = {}; | 84 hashes[channel] = {}; |
82 for (var file in FILES) { | 85 for (var file in FILES[channel]) { |
83 var hash = await getHash256(channel, revisions[channel], file); | 86 var hash = await getHash256(channel, revisions[channel], file); |
84 hashes[channel][file] = hash; | 87 hashes[channel][file] = hash; |
85 } | 88 } |
86 } | 89 } |
87 return hashes; | 90 return hashes; |
88 } | 91 } |
89 | 92 |
90 Future writeHomebrewInfo( | 93 Future writeHomebrewInfo( |
91 String channel, String revision, String repository) async { | 94 String channel, String revision, String repository) async { |
92 var revisions = await getCurrentRevisions(repository); | 95 var revisions = await getCurrentRevisions(repository); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 | 127 |
125 devel do | 128 devel do |
126 version "$devVersion" | 129 version "$devVersion" |
127 if MacOS.prefer_64_bit? | 130 if MacOS.prefer_64_bit? |
128 url "$urlBase/dev/release/${revisions['dev']}/$x64File" | 131 url "$urlBase/dev/release/${revisions['dev']}/$x64File" |
129 sha256 "${hashes['dev'][x64File]}" | 132 sha256 "${hashes['dev'][x64File]}" |
130 else | 133 else |
131 url "$urlBase/dev/release/${revisions['dev']}/$ia32File" | 134 url "$urlBase/dev/release/${revisions['dev']}/$ia32File" |
132 sha256 "${hashes['dev'][ia32File]}" | 135 sha256 "${hashes['dev'][ia32File]}" |
133 end | 136 end |
134 | |
135 resource "content_shell" do | |
136 version "$devVersion" | |
137 url "$urlBase/dev/release/${revisions['dev']}/$contentShellFile" | |
138 sha256 "${hashes['dev'][contentShellFile]}" | |
139 end | |
140 | |
141 resource "dartium" do | |
142 version "$devVersion" | |
143 url "$urlBase/dev/release/${revisions['dev']}/$dartiumFile" | |
144 sha256 "${hashes['dev'][dartiumFile]}" | |
145 end | |
146 end | 137 end |
147 | 138 |
148 option "with-content-shell", "Download and install content_shell -- headless D artium for testing" | 139 option "with-content-shell", "Download and install content_shell -- headless D artium for testing" |
149 option "with-dartium", "Download and install Dartium -- Chromium with Dar" | 140 option "with-dartium", "Download and install Dartium -- Chromium with Dart" |
kevmoo
2017/07/17 16:25:47
Good find! :-)
| |
150 | 141 |
151 resource "content_shell" do | 142 resource "content_shell" do |
152 version "$stableVersion" | 143 version "$stableVersion" |
153 url "$urlBase/stable/release/${revisions['stable']}/$contentShellFile" | 144 url "$urlBase/stable/release/${revisions['stable']}/$contentShellFile" |
154 sha256 "${hashes['stable'][contentShellFile]}" | 145 sha256 "${hashes['stable'][contentShellFile]}" |
155 end | 146 end |
156 | 147 |
157 resource "dartium" do | 148 resource "dartium" do |
158 version "$stableVersion" | 149 version "$stableVersion" |
159 url "$urlBase/stable/release/${revisions['stable']}/$dartiumFile" | 150 url "$urlBase/stable/release/${revisions['stable']}/$dartiumFile" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 Future runGit(List<String> args, String repository, | 201 Future runGit(List<String> args, String repository, |
211 Map<String, String> gitEnvironment) async { | 202 Map<String, String> gitEnvironment) async { |
212 print("git ${args.join(' ')}"); | 203 print("git ${args.join(' ')}"); |
213 | 204 |
214 var result = await Process.run('git', args, | 205 var result = await Process.run('git', args, |
215 workingDirectory: repository, environment: gitEnvironment); | 206 workingDirectory: repository, environment: gitEnvironment); |
216 | 207 |
217 print(result.stdout); | 208 print(result.stdout); |
218 print(result.stderr); | 209 print(result.stderr); |
219 } | 210 } |
OLD | NEW |