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

Side by Side Diff: tools/create_editor.py

Issue 11343027: Make the editor build callable from tools/build.py (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « editor/tools/features/com.google.dart.tools.deploy.feature_releng/build_rcp.xml ('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/env python
2 #
3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file.
6 #
7 # A script which will be invoked from gyp to create a build of the editor.
8 #
9 # TODO(devoncarew): currently this script is not callable from tools/build.py
10 # Usage: ./tools/build.py editor
11 # -or-
12 # Usage: ./tools/build_editor.py <output>
13
14 import glob
15 import os
16 import shutil
17 import subprocess
18 import sys
19 import utils
20 import zipfile
21
22 from os.path import join
23
24 OUTPUT = None
25
26 OS_CONFIG = {
27 'win32': 'win32, win32',
28 'linux': 'linux, gtk',
29 'macos': 'macosx, cocoa'
30 }
31
32 ARCH_CONFIG = {
33 'ia32': 'x86',
34 'x64': 'x86_64'
35 }
36
37 def AntPath():
38 parent = join('third_party', 'apache_ant', 'v1_7_1', 'bin')
39 if utils.IsWindows():
40 return join(parent, 'ant.bat')
41 else:
42 return join(parent, 'ant')
43
44
45 def ProcessEditorArchive(archive, outDir):
46 tempDir = join(GetEditorTemp(), 'editor.out')
47 os.makedirs(tempDir)
48
49 if utils.IsWindows():
50 f = zipfile.ZipFile(archive)
51 f.extractall(tempDir)
52 else:
53 subprocess.call(['unzip', '-q', archive, '-d', tempDir])
54
55 for src in glob.glob(join(tempDir, 'dart', '*')):
56 shutil.move(src, outDir)
57
58 shutil.rmtree(tempDir)
59 os.unlink(archive)
60
61
62 def GetEditorTemp():
63 return join(GetBuildRoot(), 'editor.build.temp')
64
65
66 def GetDownloadCache():
67 return GetEclipseBuildRoot()
68
69
70 def GetBuildRoot():
71 root = utils.GetBuildRoot(utils.GuessOS())
72 if os.path.isabs(root):
ricow1 2013/01/10 13:23:12 can you just return os.path.abspath(root) I assume
devoncarew 2013/01/11 17:08:48 I tried it and this works fine - removed the isabs
73 return root
74 else:
75 return os.path.abspath(root)
76
77
78 def GetEclipseBuildRoot():
79 return join(GetBuildRoot(), 'editor.build.cache')
80
81
82 def GetSdkPath():
83 return join(os.path.dirname(OUTPUT), 'dart-sdk')
84
85
86 def GetOutputParent():
87 return os.path.dirname(os.path.dirname(OUTPUT))
88
89
90 def Main(argv):
91 global OUTPUT
92
93 if len(argv) != 2:
94 print 'usage: tools/create_editor.py <output>'
95 return 0
96
97 OUTPUT = argv[1]
98 if not os.path.isabs(OUTPUT):
99 OUTPUT = os.path.abspath(OUTPUT)
100
101 osName = utils.GuessOS()
102 mode = ('release', 'debug')['Debug' in OUTPUT]
103 arch = ('ia32', 'x64')['X64' in OUTPUT]
104
105 print "\nBuilding the editor"
106 print " config : %s, %s, %s" % (osName, arch, mode)
107 print " output : %s" % OUTPUT
108
109 print 'cleaning %s' % OUTPUT
110 shutil.rmtree(OUTPUT, True)
111
112 # These are the valid eclipse build configurations that we can produce.
113 # We synthesize these up from the OS_CONFIG and ARCH_CONFIG information.
114 # macosx, cocoa, x86 & macosx, cocoa, x86_64
115 # win32, win32, x86 & win32, win32, x86_64
116 # linux, gtk, x86 & linux, gtk, x86_64
117
118 buildConfig = OS_CONFIG[osName] + ', ' + ARCH_CONFIG[arch]
119
120 print "\ninvoking build_rcp.xml with buildConfig = [%s]\n" % buildConfig
121
122 sys.stdout.flush()
123 sys.stderr.flush()
124
125 buildScript = join('editor', 'tools', 'features',
126 'com.google.dart.tools.deploy.feature_releng',
127 'build_rcp.xml')
128
129 buildRcpStatus = subprocess.call(
130 [AntPath(),
131 '-lib',
132 join('third_party', 'bzip2', 'bzip2.jar'),
133 '-Dbuild.out=' + OUTPUT,
134 '-Dbuild.configs=' + buildConfig,
135 '-Dbuild.revision=' + utils.GetSVNRevision(),
136 '-Ddart.version.full=' + utils.GetVersion(),
137 '-Dbuild.root=' + GetEclipseBuildRoot(),
138 '-Dbuild.downloads=' + GetDownloadCache(),
139 '-Dbuild.source=' + os.path.abspath('editor'),
140 '-Dbuild.dart.sdk=' + GetSdkPath(),
141 '-Dbuild.no.properties=true',
142 '-buildfile',
143 buildScript],
144 shell=utils.IsWindows())
145
146 if buildRcpStatus != 0:
147 sys.exit(buildRcpStatus)
148
149 # build_rcp.xml will put the built editor archive in the OUTPUT directory
150 # (dart-editor-macosx.cocoa.x86.zip). It contains the editor application in a
151 # dart/ subdirectory. We unzip the contents of the archive into OUTPUT. It
152 # will use the ../dart-sdk directory as its SDK.
153 archives = glob.glob(join(OUTPUT, '*.zip'))
154
155 if (archives):
156 ProcessEditorArchive(archives[0], OUTPUT)
157
158 if os.path.exists(GetEditorTemp()):
159 shutil.rmtree(GetEditorTemp())
160
161 print('\nEditor build successful')
162
163
164 if __name__ == '__main__':
165 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « editor/tools/features/com.google.dart.tools.deploy.feature_releng/build_rcp.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698