OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (C) 2011 Google Inc. All rights reserved. | 3 # Copyright (C) 2011 Google Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 def dartName(path): | 55 def dartName(path): |
56 # Translates <dirs>/foo.dart into foo. | 56 # Translates <dirs>/foo.dart into foo. |
57 return os.path.splitext(os.path.split(path)[1])[0] | 57 return os.path.splitext(os.path.split(path)[1])[0] |
58 | 58 |
59 snapshottedLibs = [ | 59 snapshottedLibs = [ |
60 ('html', path(outputFilePath, 'html_dartium.dart')), | 60 ('html', path(outputFilePath, 'html_dartium.dart')), |
61 ('indexed_db', path(outputFilePath, 'indexed_db_dartium.dart')), | 61 ('indexed_db', path(outputFilePath, 'indexed_db_dartium.dart')), |
62 ('svg', path(outputFilePath, 'svg_dartium.dart')), | 62 ('svg', path(outputFilePath, 'svg_dartium.dart')), |
63 ('web_audio', path(outputFilePath, 'web_audio_dartium.dart')), | 63 ('web_audio', path(outputFilePath, 'web_audio_dartium.dart')), |
| 64 ('web_gl', path(outputFilePath, 'web_gl_dartium.dart')), |
64 ('web_sql', path(outputFilePath, 'web_sql_dartium.dart'))] | 65 ('web_sql', path(outputFilePath, 'web_sql_dartium.dart'))] |
65 snapshottedLibs.extend([(dartName(p), path(p)) for p in snapshottedLibPaths]
) | 66 snapshottedLibs.extend([(dartName(p), path(p)) for p in snapshottedLibPaths]
) |
66 | 67 |
67 # Generate a Dart script to build the snapshot from. | 68 # Generate a Dart script to build the snapshot from. |
68 snapshotScriptName = os.path.join(outputFilePath, 'snapshotScript.dart') | 69 snapshotScriptName = os.path.join(outputFilePath, 'snapshotScript.dart') |
69 with file(snapshotScriptName, 'w') as snapshotScript: | 70 with file(snapshotScriptName, 'w') as snapshotScript: |
70 snapshotScript.write('library snapshot;\n') | 71 snapshotScript.write('library snapshot;\n') |
71 for name, _ in snapshottedLibs: | 72 for name, _ in snapshottedLibs: |
72 snapshotScript.write('import \'dart:%(name)s\' as %(name)s;\n' % { 'name
': name }) | 73 snapshotScript.write('import \'dart:%(name)s\' as %(name)s;\n' % { 'name
': name }) |
73 | 74 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 snapshotSizeInBytes = os.path.getsize(binarySnapshotFile) | 110 snapshotSizeInBytes = os.path.getsize(binarySnapshotFile) |
110 productDir = os.path.dirname(genSnapshotBinPath) | 111 productDir = os.path.dirname(genSnapshotBinPath) |
111 snapshotSizeOutputPath = os.path.join(productDir, 'snapshot-size.txt') | 112 snapshotSizeOutputPath = os.path.join(productDir, 'snapshot-size.txt') |
112 with file(snapshotSizeOutputPath, 'w') as snapshotSizeFile: | 113 with file(snapshotSizeOutputPath, 'w') as snapshotSizeFile: |
113 snapshotSizeFile.write('%d\n' % snapshotSizeInBytes) | 114 snapshotSizeFile.write('%d\n' % snapshotSizeInBytes) |
114 | 115 |
115 return 0 | 116 return 0 |
116 | 117 |
117 if __name__ == '__main__': | 118 if __name__ == '__main__': |
118 sys.exit(main(sys.argv)) | 119 sys.exit(main(sys.argv)) |
OLD | NEW |