Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: tools/apps/update_homebrew/bin/update_homebrew.dart

Issue 1170953004: update_homebrew: add optional resources content-shell and dartium to dart formula (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 url '$urlBase/stable/release/${revisions['stable']}/$dartiumFile' 126 url '$urlBase/stable/release/${revisions['stable']}/$dartiumFile'
127 sha256 '${hashes['stable'][dartiumFile]}' 127 sha256 '${hashes['stable'][dartiumFile]}'
128 128
129 devel do 129 devel do
130 version '$devVersion' 130 version '$devVersion'
131 url '$urlBase/dev/release/${revisions['dev']}/$dartiumFile' 131 url '$urlBase/dev/release/${revisions['dev']}/$dartiumFile'
132 sha256 '${hashes['dev'][dartiumFile]}' 132 sha256 '${hashes['dev'][dartiumFile]}'
133 133
134 resource 'content_shell' do 134 resource 'content_shell' do
135 url '$urlBase/dev/release/${revisions['dev']}/$contentShellFile' 135 url '$urlBase/dev/release/${revisions['dev']}/$contentShellFile'
136 version '$devVersion'
137 sha256 '${hashes['dev'][contentShellFile]}' 136 sha256 '${hashes['dev'][contentShellFile]}'
138 end 137 end
139 end 138 end
140 139
141 resource 'content_shell' do 140 resource 'content_shell' do
142 url '$urlBase/stable/release/${revisions['stable']}/$contentShellFile' 141 url '$urlBase/stable/release/${revisions['stable']}/$contentShellFile'
143 version '$stableVersion'
144 sha256 '${hashes['stable'][contentShellFile]}' 142 sha256 '${hashes['stable'][contentShellFile]}'
145 end 143 end
146 144
147 def shim_script target 145 def shim_script target
148 <<-EOS.undent 146 <<-EOS.undent
149 #!/bin/bash 147 #!/bin/bash
150 exec "#{prefix}/#{target}" "\$@" 148 exec "#{prefix}/#{target}" "\$@"
151 EOS 149 EOS
152 end 150 end
153 151
154 def install 152 def install
155 dartium_binary = 'Chromium.app/Contents/MacOS/Chromium' 153 dartium_binary = 'Chromium.app/Contents/MacOS/Chromium'
156 prefix.install Dir['*'] 154 prefix.install Dir['*']
157 (bin+"dartium").write shim_script dartium_binary 155 (bin+"dartium").write shim_script dartium_binary
158 156
159 content_shell_binary = 'Content Shell.app/Contents/MacOS/Content Shell' 157 content_shell_binary = 'Content Shell.app/Contents/MacOS/Content Shell'
160 prefix.install resource('content_shell') 158 prefix.install resource('content_shell')
161 (bin+"content_shell").write shim_script content_shell_binary 159 (bin+"content_shell").write shim_script content_shell_binary
162 end 160 end
163 161
164 def caveats; <<-EOS.undent 162 def caveats; <<-EOS.undent
165 To use with IntelliJ, set the Dartium execute home to: 163 DEPRECATED
164 In the future, use the `dart` formula using
165 `--with-dartium` and/or `--with-content-shell`
166
167 To use with IntelliJ, set the Dartium execute home to:
166 #{prefix}/Chromium.app 168 #{prefix}/Chromium.app
167 EOS 169 EOS
168 end 170 end
169 171
170 test do 172 test do
171 system "#{bin}/dartium" 173 system "#{bin}/dartium"
172 end 174 end
173 end 175 end
174 '''; 176 ''';
175 177
176 String createDartFormula( 178 String createDartFormula(
177 Map revisions, Map hashes, String devVersion, String stableVersion) => ''' 179 Map revisions, Map hashes, String devVersion, String stableVersion) => '''
178 require 'formula' 180 require 'formula'
179 181
180 class Dart < Formula 182 class Dart < Formula
181 homepage 'https://www.dartlang.org/' 183 homepage 'https://www.dartlang.org/'
182 184
183 version '$stableVersion' 185 version '$stableVersion'
184 if MacOS.prefer_64_bit? 186 if MacOS.prefer_64_bit?
185 url '$urlBase/stable/release/${revisions['stable']}/$x64File' 187 url '$urlBase/stable/release/${revisions['stable']}/$x64File'
186 sha256 '${hashes['stable'][x64File]}' 188 sha256 '${hashes['stable'][x64File]}'
187 else 189 else
188 url '$urlBase/stable/release/${revisions['stable']}/$ia32File' 190 url '$urlBase/stable/release/${revisions['stable']}/$ia32File'
189 sha256 '${hashes['stable'][ia32File]}' 191 sha256 '${hashes['stable'][ia32File]}'
190 end 192 end
191 193
194 option 'with-content-shell', 'Download and install content_shell -- headless D artium for testing'
195 option 'with-dartium', 'Download and install Dartium -- Chromium with Dart'
196
192 devel do 197 devel do
193 version '$devVersion' 198 version '$devVersion'
194 if MacOS.prefer_64_bit? 199 if MacOS.prefer_64_bit?
195 url '$urlBase/dev/release/${revisions['dev']}/$x64File' 200 url '$urlBase/dev/release/${revisions['dev']}/$x64File'
196 sha256 '${hashes['dev'][x64File]}' 201 sha256 '${hashes['dev'][x64File]}'
197 else 202 else
198 url '$urlBase/dev/release/${revisions['dev']}/$ia32File' 203 url '$urlBase/dev/release/${revisions['dev']}/$ia32File'
199 sha256 '${hashes['dev'][ia32File]}' 204 sha256 '${hashes['dev'][ia32File]}'
200 end 205 end
206
207 resource 'content_shell' do
208 url '$urlBase/dev/release/${revisions['dev']}/$contentShellFile'
209 sha256 '${hashes['dev'][contentShellFile]}'
210 end
211
212 resource 'dartium' do
213 url '$urlBase/dev/release/${revisions['dev']}/$dartiumFile'
214 sha256 '${hashes['dev'][dartiumFile]}'
215 end
216 end
217
218 resource 'content_shell' do
219 url '$urlBase/stable/release/${revisions['stable']}/$contentShellFile'
220 sha256 '${hashes['stable'][contentShellFile]}'
221 end
222
223 resource 'dartium' do
224 url '$urlBase/stable/release/${revisions['stable']}/$dartiumFile'
225 sha256 '${hashes['stable'][dartiumFile]}'
201 end 226 end
202 227
203 def install 228 def install
204 libexec.install Dir['*'] 229 libexec.install Dir['*']
205 bin.install_symlink "#{libexec}/bin/dart" 230 bin.install_symlink "#{libexec}/bin/dart"
206 bin.write_exec_script Dir["#{libexec}/bin/{pub,docgen,dart?*}"] 231 bin.write_exec_script Dir["#{libexec}/bin/{pub,docgen,dart?*}"]
232
233 if build.with? 'content-shell'
234 dartium_binary = 'Chromium.app/Contents/MacOS/Chromium'
235 prefix.install resource('dartium')
236 (bin+"dartium").write shim_script dartium_binary
237 end
238
239 if build.with? 'content-shell'
240 content_shell_binary = 'Content Shell.app/Contents/MacOS/Content Shell'
241 prefix.install resource('content_shell')
242 (bin+"content_shell").write shim_script content_shell_binary
243 end
244 end
245
246 def shim_script target
247 <<-EOS.undent
248 #!/bin/bash
249 exec "#{prefix}/#{target}" "\$@"
250 EOS
207 end 251 end
208 252
209 def caveats; <<-EOS.undent 253 def caveats; <<-EOS.undent
210 Please note the path to the Dart SDK: 254 Please note the path to the Dart SDK:
211 #{opt_libexec} 255 #{opt_libexec}
256
257 --with-dartium:
258 To use with IntelliJ, set the Dartium execute home to:
259 #{prefix}/Chromium.app
212 EOS 260 EOS
213 end 261 end
214 262
215 test do 263 test do
216 (testpath/'sample.dart').write <<-EOS.undent 264 (testpath/'sample.dart').write <<-EOS.undent
217 void main() { 265 void main() {
218 print(r"test message"); 266 print(r"test message");
219 } 267 }
220 EOS 268 EOS
221 269
(...skipping 13 matching lines...) Expand all
235 } 283 }
236 284
237 main(args) async { 285 main(args) async {
238 final parser = new ArgParser() 286 final parser = new ArgParser()
239 ..addOption('revision', abbr: 'r') 287 ..addOption('revision', abbr: 'r')
240 ..addOption('channel', abbr: 'c', allowed: ['dev', 'stable']) 288 ..addOption('channel', abbr: 'c', allowed: ['dev', 'stable'])
241 ..addOption('key', abbr: 'k'); 289 ..addOption('key', abbr: 'k');
242 final options = parser.parse(args); 290 final options = parser.parse(args);
243 final revision = options['revision']; 291 final revision = options['revision'];
244 final channel = options['channel']; 292 final channel = options['channel'];
245 final key = options['key']; 293 if ([revision, channel].contains(null)) {
246 if ([revision, channel, key].contains(null)) { 294 print("Usage: update_homebrew.dart -r revision -c channel [-k ssh_key]\n"
247 print("Usage: update_homebrew.dart -r revision -c channel -k ssh_key\n"
248 " ssh_key should allow pushes to ${GITHUB_REPO} on github"); 295 " ssh_key should allow pushes to ${GITHUB_REPO} on github");
249 return; 296 return;
250 } 297 }
251 final sshWrapper = Platform.script.resolve('ssh_with_key').toFilePath(); 298
252 gitEnvironment = {'GIT_SSH': sshWrapper, 'SSH_KEY_PATH': key}; 299 final key = options['key'];
300 if (key != null) {
301 final sshWrapper = Platform.script.resolve('ssh_with_key').toFilePath();
302 gitEnvironment = {'GIT_SSH': sshWrapper, 'SSH_KEY_PATH': key};
303 }
253 304
254 Chain.capture(() async { 305 Chain.capture(() async {
255 var tempDir = await Directory.systemTemp.createTemp('update_homebrew'); 306 var tempDir = await Directory.systemTemp.createTemp('update_homebrew');
256 307
257 try { 308 try {
258 repository = tempDir.path; 309 repository = tempDir.path;
259 310
260 await runGit(['clone', 'git@github.com:${GITHUB_REPO}.git', '.']); 311 await runGit(['clone', 'git@github.com:${GITHUB_REPO}.git', '.']);
261 await writeHomebrewInfo(channel, revision); 312 await writeHomebrewInfo(channel, revision);
262 await runGit([ 313 await runGit([
263 'commit', 314 'commit',
264 '-a', 315 '-a',
265 '-m', 316 '-m',
266 'Updated $channel branch to revision $revision' 317 'Updated $channel branch to revision $revision'
267 ]); 318 ]);
268 319
269 await runGit(['push']); 320 await runGit(['push']);
270 } finally { 321 } finally {
271 await tempDir.delete(recursive: true); 322 await tempDir.delete(recursive: true);
272 } 323 }
273 }, onError: (error, chain) { 324 }, onError: (error, chain) {
274 print(error); 325 print(error);
275 print(chain.terse); 326 print(chain.terse);
276 }); 327 });
277 } 328 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698