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

Side by Side Diff: compiler/generate_source_list.py

Issue 13982010: Use intermediate file containing javac arguments to overcome windows limitations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « compiler/.gitignore ('k') | compiler/scripts/generate_my_projects.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 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. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 from __future__ import with_statement 6 from __future__ import with_statement
7 import StringIO 7 import StringIO
8 import os 8 import os
9 import sys 9 import sys
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 self.resources.append(os.path.join(path, filename)) 50 self.resources.append(os.path.join(path, filename))
51 self.sources.sort() 51 self.sources.sort()
52 self.resources.sort() 52 self.resources.sort()
53 53
54 def _print_gypi_files(self, out, name, files): 54 def _print_gypi_files(self, out, name, files):
55 out.write(" '%s': [\n" % name) 55 out.write(" '%s': [\n" % name)
56 for filename in files: 56 for filename in files:
57 out.write(''' r'%s/%s',%s''' % (self.path, filename,'\n')) 57 out.write(''' r'%s/%s',%s''' % (self.path, filename,'\n'))
58 out.write(" ],\n") 58 out.write(" ],\n")
59 59
60 def _print_txt_files(self, out, files):
61 for filename in files:
62 out.write('%s\n' % os.path.join(self.path, filename))
63
60 def _print_ant_files(self, out, name, files): 64 def _print_ant_files(self, out, name, files):
61 out.write(" <filelist id='%s' dir='%s'>\n" % (name, self.path)) 65 out.write(" <filelist id='%s' dir='%s'>\n" % (name, self.path))
62 for filename in files: 66 for filename in files:
63 out.write(" <file name='%s'/>\n" % filename) 67 out.write(" <file name='%s'/>\n" % filename)
64 out.write(" </filelist>\n") 68 out.write(" </filelist>\n")
65 out.write(" <pathconvert pathsep=',' property='%s' refid='%s'>\n" 69 out.write(" <pathconvert pathsep=',' property='%s' refid='%s'>\n"
66 % (name, name)) 70 % (name, name))
67 out.write(" <map from='${basedir}/%s/' to=''/>\n" % self.path) 71 out.write(" <map from='${basedir}/%s/' to=''/>\n" % self.path)
68 out.write(" </pathconvert>\n") 72 out.write(" </pathconvert>\n")
69 73
(...skipping 12 matching lines...) Expand all
82 with open(file_name, 'r') as f: 86 with open(file_name, 'r') as f:
83 old_text = f.read() 87 old_text = f.read()
84 if old_text == new_text: 88 if old_text == new_text:
85 return 89 return
86 sys.stderr.write('Updating %s\n' % file_name) 90 sys.stderr.write('Updating %s\n' % file_name)
87 with open(file_name, 'w') as f: 91 with open(file_name, 'w') as f:
88 f.write(new_text) 92 f.write(new_text)
89 93
90 def generate(self): 94 def generate(self):
91 self._list_files() 95 self._list_files()
96
92 file_name = self.output + '.gypi'; 97 file_name = self.output + '.gypi';
93 gypi = self._make_output(file_name) 98 gypi = self._make_output(file_name)
94 gypi.write("{\n 'variables': {\n") 99 gypi.write("{\n 'variables': {\n")
95 self._print_gypi_files(gypi, self.name + '_sources', self.sources) 100 self._print_gypi_files(gypi, self.name + '_sources', self.sources)
96 self._print_gypi_files(gypi, self.name + '_resources', self.resources) 101 self._print_gypi_files(gypi, self.name + '_resources', self.resources)
97 gypi.write(" },\n}\n") 102 gypi.write(" },\n}\n")
98 self._close(file_name, gypi) 103 self._close(file_name, gypi)
104
99 file_name = self.output + '.xml' 105 file_name = self.output + '.xml'
100 ant = self._make_output(file_name) 106 ant = self._make_output(file_name)
101 ant.write("<project>\n") 107 ant.write("<project>\n")
102 self._print_ant_files(ant, self.name + '_sources', self.sources) 108 self._print_ant_files(ant, self.name + '_sources', self.sources)
103 self._print_ant_files(ant, self.name + '_resources', self.resources) 109 self._print_ant_files(ant, self.name + '_resources', self.resources)
104 ant.write("</project>\n") 110 ant.write("</project>\n")
105 self._close(file_name, ant) 111 self._close(file_name, ant)
106 112
113 file_name = self.output + '.txt';
114 txt = self._make_output(file_name)
115 self._print_txt_files(txt, self.sources)
116 self._close(file_name, txt)
117
107 118
108 def Main(script_name = None, name = None, output = None, path = None, 119 def Main(script_name = None, name = None, output = None, path = None,
109 *rest): 120 *rest):
110 if not path: 121 if not path:
111 raise GenerateError("usage: %s NAME OUTPUT PATH EXCLUDE_DIR_NAME ..." 122 raise GenerateError("usage: %s NAME OUTPUT PATH EXCLUDE_DIR_NAME ..."
112 % script_name) 123 % script_name)
113 base_directory = os.path.dirname(output) 124 base_directory = os.path.dirname(output)
114 Generator(base_directory, name, output, path, *rest).generate() 125 Generator(base_directory, name, output, path, *rest).generate()
115 126
116 127
117 if __name__ == '__main__': 128 if __name__ == '__main__':
118 sys.exit(Main(*sys.argv)) 129 sys.exit(Main(*sys.argv))
OLDNEW
« no previous file with comments | « compiler/.gitignore ('k') | compiler/scripts/generate_my_projects.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698