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

Side by Side Diff: tools/bots/editor.py

Issue 336243004: Remove old buildbot editor building script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « client/tools/buildbot_annotated_steps.py ('k') | 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
(Empty)
1 #!/usr/bin/python
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file.
5
6 import os
7 import re
8 import sys
9
10 import bot
11
12 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
13 sys.path.append(os.path.join(SCRIPT_DIR, '..'))
14 import utils
15
16
17 GSUTIL = utils.GetBuildbotGSUtilPath()
18 GCS_DARTIUM_BUCKET = "gs://dartium-archive/continuous"
19 GCS_EDITOR_BUCKET = "gs://continuous-editor-archive"
20
21 def GetBuildDirectory(mode, arch):
22 configuration_dir = mode + arch.upper()
23 build_directory_dict = {
24 'linux2' : os.path.join('out', configuration_dir),
25 'darwin' : os.path.join('xcodebuild', configuration_dir),
26 'win32' : os.path.join('build', configuration_dir),
27 }
28 if sys.platform == 'darwin':
29 # TODO(kustermann,ricow): Maybe we're able to get rid of this in the future.
30 # We use ninja on bots which use out/ (i.e. what linux2 does) instead of
31 # xcodebuild/
32 if (os.path.exists(build_directory_dict['linux2']) and
33 os.path.isdir(build_directory_dict['linux2'])):
34 return build_directory_dict['linux2']
35 return build_directory_dict[sys.platform]
36
37 def GetEditorDirectory(mode, arch):
38 return os.path.join(GetBuildDirectory(mode, arch), 'editor')
39
40 def GetDartSdkDirectory(mode, arch):
41 return os.path.join(GetBuildDirectory(mode, arch), 'dart-sdk')
42
43 def GetEditorExecutable(mode, arch):
44 editor_dir = GetEditorDirectory(mode, arch)
45 if sys.platform == 'darwin':
46 executable = os.path.join('DartEditor.app', 'Contents', 'MacOS',
47 'DartEditor')
48 elif sys.platform == 'win32':
49 executable = 'DartEditor.exe'
50 elif sys.platform == 'linux2':
51 executable = 'DartEditor'
52 else:
53 raise Exception('Unknown platform %s' % sys.platform)
54 return os.path.join(editor_dir, executable)
55
56 def RunProcess(args):
57 if sys.platform == 'linux2':
58 args = ['xvfb-run', '-a'] + args
59 print 'Running: %s' % (' '.join(args))
60 sys.stdout.flush()
61 bot.RunProcess(args)
62
63 def DownloadDartium(temp_dir, zip_file):
64 """Returns the filename of the unpacked archive"""
65 local_path = os.path.join(temp_dir, zip_file)
66 uri = "%s/%s" % (GCS_DARTIUM_BUCKET, zip_file)
67 RunProcess([GSUTIL, 'cp', uri, local_path])
68 RunProcess(['unzip', local_path, '-d', temp_dir])
69 for filename in os.listdir(temp_dir):
70 match = re.search('^dartium-.*-inc-([0-9]+)\.0$', filename)
71 if match:
72 return os.path.join(temp_dir, match.group(0))
73 raise Exception("Couldn't find dartium archive")
74
75 def UploadInstaller(dart_editor_dmg, directory):
76 directory = directory % {'revision' : utils.GetSVNRevision()}
77 uri = '%s/%s' % (GCS_EDITOR_BUCKET, directory)
78 RunProcess([GSUTIL, 'cp', dart_editor_dmg, uri])
79 RunProcess([GSUTIL, 'setacl', 'public-read', uri])
80
81 def CreateAndUploadMacInstaller(arch):
82 dart_icns = os.path.join(
83 'editor', 'tools', 'plugins', 'com.google.dart.tools.deploy',
84 'icons', 'dart.icns')
85 mac_build_bundle_py = os.path.join('tools', 'mac_build_editor_bundle.sh')
86 mac_build_dmg_py = os.path.join('tools', 'mac_build_editor_dmg.sh')
87 editor_dir = GetEditorDirectory('Release', arch)
88 dart_sdk = GetDartSdkDirectory('Release', arch)
89 with utils.TempDir('eclipse') as temp_dir:
90 # Get dartium
91 dartium_directory = DownloadDartium(temp_dir, 'dartium-mac.zip')
92 dartium_bundle_dir = os.path.join(dartium_directory,
93 'Chromium.app')
94
95 # Build the editor bundle
96 darteditor_bundle_dir = os.path.join(temp_dir, 'DartEditor.app')
97 args = [mac_build_bundle_py, darteditor_bundle_dir, editor_dir,
98 dart_sdk, dartium_bundle_dir, dart_icns]
99 RunProcess(args)
100
101 # Build the dmg installer from the editor bundle
102 dart_editor_dmg = os.path.join(temp_dir, 'DartEditor.dmg')
103 args = [mac_build_dmg_py, dart_editor_dmg, darteditor_bundle_dir,
104 dart_icns, 'Dart Editor']
105 RunProcess(args)
106
107 # Upload the dmg installer
108 UploadInstaller(dart_editor_dmg, 'dart-editor-mac-%(revision)s.dmg')
109
110 def main():
111 build_py = os.path.join('tools', 'build.py')
112
113 architectures = ['ia32', 'x64']
114 test_architectures = ['x64']
115 if sys.platform == 'win32':
116 # Our windows bots pull in only a 32 bit JVM.
117 test_architectures = ['ia32']
118
119 for arch in architectures:
120 with bot.BuildStep('Build Editor %s' % arch):
121 args = [sys.executable, build_py,
122 '-mrelease', '--arch=%s' % arch, 'editor', 'create_sdk']
123 RunProcess(args)
124
125 # before we run the editor, suppress any 'restore windows' dialogs
126 if sys.platform == 'darwin':
127 bot.RunProcess(['defaults', 'write', 'org.eclipse.eclipse.savedState',
128 'NSQuitAlwaysKeepsWindows', '-bool', 'false'])
129
130 for arch in test_architectures:
131 editor_executable = GetEditorExecutable('Release', arch)
132 with bot.BuildStep('Test Editor %s' % arch):
133 with utils.TempDir('eclipse') as temp_dir:
134 args = [editor_executable, '--test', '--auto-exit', '-data', temp_dir]
135 RunProcess(args)
136
137 # TODO: Permissions need to be clarified
138 for arch in test_architectures:
139 with bot.BuildStep('Build Installer %s' % arch):
140 if sys.platform == 'darwin':
141 CreateAndUploadMacInstaller(arch)
142 else:
143 print ("We currently don't build installers for sys.platform=%s"
144 % sys.platform)
145 return 0
146
147 if __name__ == '__main__':
148 try:
149 sys.exit(main())
150 except OSError as e:
151 sys.exit(e.errno)
OLDNEW
« no previous file with comments | « client/tools/buildbot_annotated_steps.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698