| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 snapshotScript.write('import \'dart:vmserviceio\';\n') | 71 snapshotScript.write('import \'dart:vmserviceio\';\n') |
| 72 | 72 |
| 73 binaryVmIsolateSnapshotFile = path(outputFilePath, 'DartVmIsolateSnapshot.bi
n') | 73 binaryVmIsolateSnapshotFile = path(outputFilePath, 'DartVmIsolateSnapshot.bi
n') |
| 74 binaryIsolateSnapshotFile = path(outputFilePath, 'DartIsolateSnapshot.bin') | 74 binaryIsolateSnapshotFile = path(outputFilePath, 'DartIsolateSnapshot.bin') |
| 75 | 75 |
| 76 # Build a command to generate the snapshot bin file. | 76 # Build a command to generate the snapshot bin file. |
| 77 command = [ | 77 command = [ |
| 78 'python', | 78 'python', |
| 79 path(dartPath, 'runtime', 'tools', 'create_snapshot_bin.py'), | 79 path(dartPath, 'runtime', 'tools', 'create_snapshot_bin.py'), |
| 80 '--executable=%s' % path(genSnapshotBinPath), | 80 '--executable=%s' % path(genSnapshotBinPath), |
| 81 '--snapshot_kind=core', |
| 81 '--vm_output_bin=%s' % binaryVmIsolateSnapshotFile, | 82 '--vm_output_bin=%s' % binaryVmIsolateSnapshotFile, |
| 82 '--output_bin=%s' % binaryIsolateSnapshotFile, | 83 '--isolate_output_bin=%s' % binaryIsolateSnapshotFile, |
| 83 '--script=%s' % snapshotScriptName, | 84 '--script=%s' % snapshotScriptName, |
| 84 ] | 85 ] |
| 85 command.extend(['--url_mapping=dart:%s,%s' % lib for lib in snapshottedLibs]
) | 86 command.extend(['--url_mapping=dart:%s,%s' % lib for lib in snapshottedLibs]
) |
| 86 | 87 |
| 87 pipe = subprocess.Popen(command, | 88 pipe = subprocess.Popen(command, |
| 88 stdout=subprocess.PIPE, | 89 stdout=subprocess.PIPE, |
| 89 stderr=subprocess.PIPE) | 90 stderr=subprocess.PIPE) |
| 90 out, error = pipe.communicate() | 91 out, error = pipe.communicate() |
| 91 if (pipe.returncode != 0): | 92 if (pipe.returncode != 0): |
| 92 raise Exception('Snapshot bin generation failed: %s/%s' % (out, error)) | 93 raise Exception('Snapshot bin generation failed: %s/%s' % (out, error)) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 snapshotSizeInBytes = os.path.getsize(binaryIsolateSnapshotFile) | 112 snapshotSizeInBytes = os.path.getsize(binaryIsolateSnapshotFile) |
| 112 productDir = os.path.dirname(genSnapshotBinPath) | 113 productDir = os.path.dirname(genSnapshotBinPath) |
| 113 snapshotSizeOutputPath = os.path.join(productDir, 'snapshot-size.txt') | 114 snapshotSizeOutputPath = os.path.join(productDir, 'snapshot-size.txt') |
| 114 with file(snapshotSizeOutputPath, 'w') as snapshotSizeFile: | 115 with file(snapshotSizeOutputPath, 'w') as snapshotSizeFile: |
| 115 snapshotSizeFile.write('%d\n' % snapshotSizeInBytes) | 116 snapshotSizeFile.write('%d\n' % snapshotSizeInBytes) |
| 116 | 117 |
| 117 return 0 | 118 return 0 |
| 118 | 119 |
| 119 if __name__ == '__main__': | 120 if __name__ == '__main__': |
| 120 sys.exit(main(sys.argv)) | 121 sys.exit(main(sys.argv)) |
| OLD | NEW |