| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//third_party/protobuf/proto_library.gni") |
| 6 |
| 5 config("protobuf_config") { | 7 config("protobuf_config") { |
| 6 include_dirs = [ "src" ] | 8 include_dirs = [ "src" ] |
| 7 defines = [ | 9 defines = [ |
| 8 "GOOGLE_PROTOBUF_NO_RTTI", | 10 "GOOGLE_PROTOBUF_NO_RTTI", |
| 9 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", | 11 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", |
| 10 ] | 12 ] |
| 11 if (!is_win) { | 13 if (!is_win) { |
| 12 defines += [ "HAVE_PTHREAD" ] | 14 defines += [ "HAVE_PTHREAD" ] |
| 13 } | 15 } |
| 14 } | 16 } |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 | 594 |
| 593 deps = [ | 595 deps = [ |
| 594 ":protoc_lib", | 596 ":protoc_lib", |
| 595 | 597 |
| 596 # Default manifest on Windows (a no-op elsewhere). | 598 # Default manifest on Windows (a no-op elsewhere). |
| 597 "//build/win:default_exe_manifest", | 599 "//build/win:default_exe_manifest", |
| 598 ] | 600 ] |
| 599 } | 601 } |
| 600 } | 602 } |
| 601 | 603 |
| 602 google_python_dir = "$root_out_dir/pyproto/google" | 604 pyproto_dir = "$root_out_dir/pyproto" |
| 603 | |
| 604 copy("copy_google") { | |
| 605 sources = [ | |
| 606 "__init__.py", | |
| 607 ] | |
| 608 outputs = [ | |
| 609 "$google_python_dir/{{source_file_part}}", | |
| 610 ] | |
| 611 } | |
| 612 | 605 |
| 613 copy("copy_six") { | 606 copy("copy_six") { |
| 614 sources = [ | 607 sources = [ |
| 615 "third_party/six/six.py", | 608 "third_party/six/six.py", |
| 616 ] | 609 ] |
| 617 outputs = [ | 610 outputs = [ |
| 618 "$google_python_dir/third_party/six/{{source_file_part}}", | 611 "$pyproto_dir/{{source_file_part}}", |
| 619 ] | 612 ] |
| 620 } | 613 } |
| 621 | 614 |
| 622 copy("copy_google_protobuf") { | 615 copy("copy_google_protobuf") { |
| 623 sources = [ | 616 sources = [ |
| 624 "python/google/protobuf/__init__.py", | |
| 625 "python/google/protobuf/descriptor.py", | 617 "python/google/protobuf/descriptor.py", |
| 626 "python/google/protobuf/descriptor_database.py", | 618 "python/google/protobuf/descriptor_database.py", |
| 627 "python/google/protobuf/descriptor_pool.py", | 619 "python/google/protobuf/descriptor_pool.py", |
| 628 "python/google/protobuf/json_format.py", | 620 "python/google/protobuf/json_format.py", |
| 629 "python/google/protobuf/message.py", | 621 "python/google/protobuf/message.py", |
| 630 "python/google/protobuf/message_factory.py", | 622 "python/google/protobuf/message_factory.py", |
| 631 "python/google/protobuf/proto_builder.py", | 623 "python/google/protobuf/proto_builder.py", |
| 632 "python/google/protobuf/reflection.py", | 624 "python/google/protobuf/reflection.py", |
| 633 "python/google/protobuf/service.py", | 625 "python/google/protobuf/service.py", |
| 634 "python/google/protobuf/service_reflection.py", | 626 "python/google/protobuf/service_reflection.py", |
| 635 "python/google/protobuf/symbol_database.py", | 627 "python/google/protobuf/symbol_database.py", |
| 636 "python/google/protobuf/text_encoding.py", | 628 "python/google/protobuf/text_encoding.py", |
| 637 "python/google/protobuf/text_format.py", | 629 "python/google/protobuf/text_format.py", |
| 638 | |
| 639 # TODO(ncarter): protoc's python generator treats descriptor.proto | |
| 640 # specially, but only when the input path is exactly | |
| 641 # "google/protobuf/descriptor.proto". I'm not sure how to execute a rule | |
| 642 # from a different directory. For now, use a manually-generated copy of | |
| 643 # descriptor_pb2.py. | |
| 644 "python/google/protobuf/descriptor_pb2.py", | |
| 645 ] | 630 ] |
| 646 outputs = [ | 631 outputs = [ |
| 647 "$google_python_dir/protobuf/{{source_file_part}}", | 632 "$pyproto_dir/google/protobuf/{{source_file_part}}", |
| 648 ] | 633 ] |
| 649 } | 634 } |
| 650 | 635 |
| 651 copy("copy_google_protobuf_internal") { | 636 copy("copy_google_protobuf_internal") { |
| 652 sources = [ | 637 sources = [ |
| 653 "python/google/protobuf/internal/__init__.py", | 638 "python/google/protobuf/internal/__init__.py", |
| 654 "python/google/protobuf/internal/_parameterized.py", | 639 "python/google/protobuf/internal/_parameterized.py", |
| 655 "python/google/protobuf/internal/api_implementation.py", | 640 "python/google/protobuf/internal/api_implementation.py", |
| 656 "python/google/protobuf/internal/containers.py", | 641 "python/google/protobuf/internal/containers.py", |
| 657 "python/google/protobuf/internal/decoder.py", | 642 "python/google/protobuf/internal/decoder.py", |
| 658 "python/google/protobuf/internal/encoder.py", | 643 "python/google/protobuf/internal/encoder.py", |
| 659 "python/google/protobuf/internal/enum_type_wrapper.py", | 644 "python/google/protobuf/internal/enum_type_wrapper.py", |
| 660 "python/google/protobuf/internal/message_listener.py", | 645 "python/google/protobuf/internal/message_listener.py", |
| 661 "python/google/protobuf/internal/python_message.py", | 646 "python/google/protobuf/internal/python_message.py", |
| 662 "python/google/protobuf/internal/type_checkers.py", | 647 "python/google/protobuf/internal/type_checkers.py", |
| 663 "python/google/protobuf/internal/well_known_types.py", | 648 "python/google/protobuf/internal/well_known_types.py", |
| 664 "python/google/protobuf/internal/wire_format.py", | 649 "python/google/protobuf/internal/wire_format.py", |
| 665 ] | 650 ] |
| 666 outputs = [ | 651 outputs = [ |
| 667 "$google_python_dir/protobuf/internal/{{source_file_part}}", | 652 "$pyproto_dir/google/protobuf/internal/{{source_file_part}}", |
| 668 ] | 653 ] |
| 669 } | 654 } |
| 670 | 655 |
| 656 proto_library("generate_google_protobuf_descriptor") { |
| 657 sources = [ |
| 658 "src/google/protobuf/compiler/plugin.proto", |
| 659 "src/google/protobuf/descriptor.proto", |
| 660 ] |
| 661 proto_in_dir = "src" |
| 662 proto_out_dir = "" |
| 663 |
| 664 generate_python = true |
| 665 generate_cc = false |
| 666 } |
| 667 |
| 671 group("py_proto") { | 668 group("py_proto") { |
| 672 public_deps = [ | 669 public_deps = [ |
| 673 ":copy_google", | |
| 674 ":copy_google_protobuf", | 670 ":copy_google_protobuf", |
| 675 ":copy_google_protobuf_internal", | 671 ":copy_google_protobuf_internal", |
| 676 ":copy_six", | 672 ":copy_six", |
| 673 ":generate_google_protobuf_descriptor", |
| 677 ] | 674 ] |
| 678 | 675 |
| 679 # Targets that depend on this should depend on the copied data files. | 676 # Targets that depend on this should depend on the copied data files. |
| 680 data = get_target_outputs(":copy_google") | 677 data_deps = [ |
| 681 data += get_target_outputs(":copy_six") | 678 ":copy_google_protobuf", |
| 682 data += get_target_outputs(":copy_google_protobuf") | 679 ":copy_google_protobuf_internal", |
| 683 data += get_target_outputs(":copy_google_protobuf_internal") | 680 ":copy_six", |
| 681 ":generate_google_protobuf_descriptor", |
| 682 ] |
| 683 |
| 684 # Init files implicitly created by protoc_wrapper. |
| 685 data = [ |
| 686 "$pyproto_dir/google/__init__.py", |
| 687 "$pyproto_dir/google/protobuf/__init__.py", |
| 688 "$pyproto_dir/google/protobuf/compiler/__init__.py", |
| 689 ] |
| 684 } | 690 } |
| OLD | NEW |