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

Unified Diff: dart/editor/build/build.py

Issue 57483005: Add tools/download_file.dart helper + download_contentshell shell/bat script included in the editor… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/tools/download_file.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/editor/build/build.py
diff --git a/dart/editor/build/build.py b/dart/editor/build/build.py
index 22fbec75c85479f50676b74c9293d22ba83266da..e626612e8a146abe5f4770f48a18dff8cd18e993 100755
--- a/dart/editor/build/build.py
+++ b/dart/editor/build/build.py
@@ -11,6 +11,7 @@ import optparse
import os
import re
import shutil
+import stat
import subprocess
import sys
import tempfile
@@ -965,6 +966,68 @@ def RenameRcpZipFiles(out_dir):
def PostProcessEditorBuilds(out_dir, buildos):
"""Post-process the created RCP builds"""
with utils.TempDir('editor_scratch') as scratch_dir:
+ contentshell_scriptconfig = {
+ 'windows' : {
+ 'local_path' : os.path.join(scratch_dir, 'download_contentshell.bat'),
+ 'zipfile_path' : 'dart/chromium/download_contentshell.bat',
+ 'content_pattern' :
+r"""
+REM This script will download content shell to "content_shell.zip" in the
ricow1 2013/11/04 17:14:53 why don't we just put these scripts inside tools/d
kustermann 2013/11/05 12:45:19 We could, but remember that these are not executab
+REM current working directory.
+
+CHROMIUM_DIR="%~dp0"
+SDK_BIN="%CHROMIUM_DIR%\..\dart-sdk\bin"
+
+DART="%SDK_BIN%\dart.exe"
+DOWNLOAD_SCRIPT="%CHROMIUM_DIR%\download_file.dart"
+
+"$DART" "$DOWNLOAD_SCRIPT" "%(url)s" content_shell.zip
+"""
+ },
+ 'posix' : {
+ 'local_path' : os.path.join(scratch_dir, 'download_contentshell.sh'),
+ 'zipfile_path' : 'dart/chromium/download_contentshell.sh',
+ 'content_pattern' :
+r"""#!/bin/bash
+
+# This script will download content shell to "content_shell.zip" in the current
+# working directory.
+
+CHROMIUM_DIR="$(dirname $BASH_SOURCE)"
+SDK_BIN="$CHROMIUM_DIR/../dart-sdk/bin"
+
+DART="$SDK_BIN/dart"
+DOWNLOAD_SCRIPT="$CHROMIUM_DIR/download_file.dart"
+
+"$DART" "$DOWNLOAD_SCRIPT" "%(url)s" content_shell.zip
+"""
+ },
+ }
+ contentshell_scriptconfig['linux'] = contentshell_scriptconfig['posix']
+ contentshell_scriptconfig['macos'] = contentshell_scriptconfig['posix']
+
+ # Create a download_contentshell shell/bat script.
+ def create_download_contentshell_script(arch):
+ # The directory tree will look like this:
+ # dart/dart-sdk/bin/dart(.exe)
+ # /chromium/download_contentshell.(sh,bat)
+ # /chromium/download_file.dart
+ namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RELEASE)
+ contentshell_name = namer.dartium_variant_zipfilename(
+ 'content_shell', SYSTEM, arch, 'release')
+ contentshell_url = (
+ "http://dartlang.org/editor/update/channels/%s/latest/dartium/%s"
+ % (CHANNEL, contentshell_name))
kustermann 2013/11/04 16:36:52 I'm not sure if we should use 'latest' here or the
ricow1 2013/11/04 17:14:53 We should use the exact version, otherwise there c
kustermann 2013/11/05 12:45:19 I'll change it.
+
+ with open(contentshell_scriptconfig[SYSTEM]['local_path'], 'w') as fd:
+ fd.write(contentshell_scriptconfig[SYSTEM]['content_pattern']
+ % {'url' : contentshell_url })
+
+ # Make it executable if we are not on windows
+ if SYSTEM != 'windows':
+ shell_script = contentshell_scriptconfig[SYSTEM]['local_path']
+ os.chmod(shell_script, os.stat(shell_script).st_mode | stat.S_IEXEC)
+
# Create a editor.properties
editor_properties = os.path.join(scratch_dir, 'editor.properties')
with open(editor_properties, 'w') as fd:
@@ -973,6 +1036,7 @@ def PostProcessEditorBuilds(out_dir, buildos):
for zipFile in _FindRcpZipFiles(out_dir):
basename = os.path.basename(zipFile)
+ is_64bit = basename.endswith('-64.zip')
print(' processing %s' % basename)
@@ -990,8 +1054,17 @@ def PostProcessEditorBuilds(out_dir, buildos):
f = ziputils.ZipUtil(zipFile, buildos)
f.AddFile(editor_properties, 'dart/editor.properties')
+ # Add a shell/bat script to download content shell (and the
+ # tools/download_file.dart helper utility).
+ create_download_contentshell_script('64' if is_64bit else '32')
+ f = ziputils.ZipUtil(zipFile, buildos)
+ f.AddFile(contentshell_scriptconfig[SYSTEM]['local_path'],
+ contentshell_scriptconfig[SYSTEM]['zipfile_path'])
+ f.AddFile(os.path.join(DART_DIR, 'tools', 'download_file.dart'),
+ 'dart/chromium/download_file.dart')
+
# adjust memory params for 64 bit versions
- if (basename.endswith('-64.zip')):
+ if is_64bit:
if (basename.startswith('darteditor-macos-')):
inifile = join('dart', 'DartEditor.app', 'Contents', 'MacOS',
'DartEditor.ini')
« no previous file with comments | « no previous file | dart/tools/download_file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698