| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 This script invokes the go build tool. | 7 This script invokes the go build tool. |
| 8 Must be called as follows: | 8 Must be called as follows: |
| 9 python go.py [--android] <go-tool> <build directory> <output file> | 9 python go.py [--android] <go-tool> <build directory> <output file> |
| 10 <src directory> <CGO_CFLAGS> <CGO_LDFLAGS> <go-binary options> | 10 <src directory> <CGO_CFLAGS> <CGO_LDFLAGS> <go-binary options> |
| 11 eg. | 11 eg. |
| 12 python go.py /usr/lib/google-golang/bin/go out/build out/a.out .. "-I." | 12 python go.py /usr/lib/google-golang/bin/go out/build out/a.out .. "-I." |
| 13 "-L. -ltest" test -c test/test.go | 13 "-L. -ltest" test -c test/test.go |
| 14 """ | 14 """ |
| 15 | 15 |
| 16 import argparse | 16 import argparse |
| 17 import os | 17 import os |
| 18 import shutil | 18 import shutil |
| 19 import subprocess | 19 import subprocess |
| 20 import sys | 20 import sys |
| 21 | 21 |
| 22 NDK_PLATFORM = 'android-14' | 22 NDK_PLATFORM = 'android-16' |
| 23 NDK_TOOLCHAIN = 'arm-linux-androideabi-4.9' | 23 NDK_TOOLCHAIN = 'arm-linux-androideabi-4.9' |
| 24 | 24 |
| 25 def main(): | 25 def main(): |
| 26 parser = argparse.ArgumentParser() | 26 parser = argparse.ArgumentParser() |
| 27 parser.add_argument('--android', action='store_true') | 27 parser.add_argument('--android', action='store_true') |
| 28 parser.add_argument('go_tool') | 28 parser.add_argument('go_tool') |
| 29 parser.add_argument('build_directory') | 29 parser.add_argument('build_directory') |
| 30 parser.add_argument('output_file') | 30 parser.add_argument('output_file') |
| 31 parser.add_argument('src_root') | 31 parser.add_argument('src_root') |
| 32 parser.add_argument('out_root') | 32 parser.add_argument('out_root') |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (len(out_files) > 0): | 81 if (len(out_files) > 0): |
| 82 shutil.move(out_files[0], out_file) | 82 shutil.move(out_files[0], out_file) |
| 83 os.chdir(old_directory) | 83 os.chdir(old_directory) |
| 84 try: | 84 try: |
| 85 shutil.rmtree(build_dir, True) | 85 shutil.rmtree(build_dir, True) |
| 86 except Exception: | 86 except Exception: |
| 87 pass | 87 pass |
| 88 | 88 |
| 89 if __name__ == '__main__': | 89 if __name__ == '__main__': |
| 90 sys.exit(main()) | 90 sys.exit(main()) |
| OLD | NEW |