Change protoc build rule to not use cygwin bash.
Now protoc.exe will be directly invoked.
This rolls cacheinvalidation from r218:r219
------------------------------------------------------------------------
r219 | ghcooper@gmail.com | 2012-07-20 17:44:14 -0700 (Fri, 20 Jul 2012) | 1 line
move protos out of v2/; use relative paths for proto imports
------------------------------------------------------------------------
This also rolls gyp from r1440:r1441
------------------------------------------------------------------------
r1441 | iannucci@chromium.org | 2012-07-26 17:54:17 -0700 (Thu, 26 Jul 2012) | 8 lines
Fix bug: non-cygwin actions incorrectly run options through _FixPath.
This adds an additional heuristic to the existing one. Now if an option begins
with either a '/' OR a '-', it assumes it's not a strict path.
Added a TODO which notes that the existing (and new) behavior will miss options
such as '--opt=a/posix/path', and '/opt:a/posix/path'.
Review URL: https://chromiumcodereview.appspot.com/10829049
------------------------------------------------------------------------
BUG=123026,113339
R=scottmg@chromium.org,cmp@chromium.org,nsylvain@chromium.org,jar@chromium.org,akalin@chromium.org,maruel@chromium.org
TEST=
Review URL: https://chromiumcodereview.appspot.com/10796051
git-svn-id: http://src.chromium.org/svn/trunk/src/build@149100 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
2012-07-31 05:07:32 +04:00
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
2011-08-19 01:52:15 +04:00
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
Change protoc build rule to not use cygwin bash.
Now protoc.exe will be directly invoked.
This rolls cacheinvalidation from r218:r219
------------------------------------------------------------------------
r219 | ghcooper@gmail.com | 2012-07-20 17:44:14 -0700 (Fri, 20 Jul 2012) | 1 line
move protos out of v2/; use relative paths for proto imports
------------------------------------------------------------------------
This also rolls gyp from r1440:r1441
------------------------------------------------------------------------
r1441 | iannucci@chromium.org | 2012-07-26 17:54:17 -0700 (Thu, 26 Jul 2012) | 8 lines
Fix bug: non-cygwin actions incorrectly run options through _FixPath.
This adds an additional heuristic to the existing one. Now if an option begins
with either a '/' OR a '-', it assumes it's not a strict path.
Added a TODO which notes that the existing (and new) behavior will miss options
such as '--opt=a/posix/path', and '/opt:a/posix/path'.
Review URL: https://chromiumcodereview.appspot.com/10829049
------------------------------------------------------------------------
BUG=123026,113339
R=scottmg@chromium.org,cmp@chromium.org,nsylvain@chromium.org,jar@chromium.org,akalin@chromium.org,maruel@chromium.org
TEST=
Review URL: https://chromiumcodereview.appspot.com/10796051
git-svn-id: http://src.chromium.org/svn/trunk/src/build@149100 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
2012-07-31 05:07:32 +04:00
|
|
|
# This file is meant to be included into a target to provide a rule
|
2012-11-15 01:20:47 +04:00
|
|
|
# to invoke protoc in a consistent manner. For Java-targets, see
|
|
|
|
# protoc_java.gypi.
|
2011-08-19 01:52:15 +04:00
|
|
|
#
|
|
|
|
# To use this, create a gyp target with the following form:
|
|
|
|
# {
|
|
|
|
# 'target_name': 'my_proto_lib',
|
|
|
|
# 'type': 'static_library',
|
|
|
|
# 'sources': [
|
|
|
|
# 'foo.proto',
|
|
|
|
# 'bar.proto',
|
|
|
|
# ],
|
|
|
|
# 'variables': {
|
|
|
|
# # Optional, see below: 'proto_in_dir': '.'
|
|
|
|
# 'proto_out_dir': 'dir/for/my_proto_lib'
|
|
|
|
# },
|
|
|
|
# 'includes': ['path/to/this/gypi/file'],
|
|
|
|
# }
|
|
|
|
# If necessary, you may add normal .cc files to the sources list or other gyp
|
|
|
|
# dependencies. The proto headers are guaranteed to be generated before any
|
|
|
|
# source files, even within this target, are compiled.
|
|
|
|
#
|
|
|
|
# The 'proto_in_dir' variable must be the relative path to the
|
|
|
|
# directory containing the .proto files. If left out, it defaults to '.'.
|
|
|
|
#
|
|
|
|
# The 'proto_out_dir' variable specifies the path suffix that output
|
|
|
|
# files are generated under. Targets that gyp-depend on my_proto_lib
|
|
|
|
# will be able to include the resulting proto headers with an include
|
|
|
|
# like:
|
|
|
|
# #include "dir/for/my_proto_lib/foo.pb.h"
|
|
|
|
#
|
2012-09-13 06:27:52 +04:00
|
|
|
# If you need to add an EXPORT macro to a protobuf's c++ header, set the
|
|
|
|
# 'cc_generator_options' variable with the value: 'dllexport_decl=FOO_EXPORT:'
|
|
|
|
# e.g. 'dllexport_decl=BASE_EXPORT:'
|
|
|
|
#
|
|
|
|
# It is likely you also need to #include a file for the above EXPORT macro to
|
|
|
|
# work. You can do so with the 'cc_include' variable.
|
|
|
|
# e.g. 'base/base_export.h'
|
|
|
|
#
|
2011-08-19 01:52:15 +04:00
|
|
|
# Implementation notes:
|
2012-02-28 09:25:06 +04:00
|
|
|
# A proto_out_dir of foo/bar produces
|
2011-08-19 01:52:15 +04:00
|
|
|
# <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h}
|
|
|
|
# <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py
|
|
|
|
|
|
|
|
{
|
|
|
|
'variables': {
|
2012-09-13 06:27:52 +04:00
|
|
|
'protoc_wrapper': '<(DEPTH)/tools/protoc_wrapper/protoc_wrapper.py',
|
2011-08-19 01:52:15 +04:00
|
|
|
'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)',
|
|
|
|
'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)',
|
2012-09-13 06:27:52 +04:00
|
|
|
'cc_generator_options%': '',
|
|
|
|
'cc_include%': '',
|
2011-08-19 01:52:15 +04:00
|
|
|
'proto_in_dir%': '.',
|
2012-11-01 03:29:37 +04:00
|
|
|
'conditions': [
|
|
|
|
['use_system_protobuf==0', {
|
|
|
|
'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
|
|
|
|
}, { # use_system_protobuf==1
|
|
|
|
'protoc': '<!(which protoc)',
|
|
|
|
}],
|
|
|
|
],
|
2011-08-19 01:52:15 +04:00
|
|
|
},
|
|
|
|
'rules': [
|
|
|
|
{
|
|
|
|
'rule_name': 'genproto',
|
|
|
|
'extension': 'proto',
|
|
|
|
'inputs': [
|
2012-09-13 06:27:52 +04:00
|
|
|
'<(protoc_wrapper)',
|
2011-08-19 01:52:15 +04:00
|
|
|
'<(protoc)',
|
|
|
|
],
|
|
|
|
'outputs': [
|
2012-02-28 09:25:06 +04:00
|
|
|
'<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py',
|
|
|
|
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
|
|
|
|
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
|
2011-08-19 01:52:15 +04:00
|
|
|
],
|
|
|
|
'action': [
|
2012-09-13 06:27:52 +04:00
|
|
|
'python',
|
|
|
|
'<(protoc_wrapper)',
|
|
|
|
'--include',
|
|
|
|
'<(cc_include)',
|
|
|
|
'--protobuf',
|
|
|
|
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
|
|
|
|
'--',
|
2011-08-19 01:52:15 +04:00
|
|
|
'<(protoc)',
|
Change protoc build rule to not use cygwin bash.
Now protoc.exe will be directly invoked.
This rolls cacheinvalidation from r218:r219
------------------------------------------------------------------------
r219 | ghcooper@gmail.com | 2012-07-20 17:44:14 -0700 (Fri, 20 Jul 2012) | 1 line
move protos out of v2/; use relative paths for proto imports
------------------------------------------------------------------------
This also rolls gyp from r1440:r1441
------------------------------------------------------------------------
r1441 | iannucci@chromium.org | 2012-07-26 17:54:17 -0700 (Thu, 26 Jul 2012) | 8 lines
Fix bug: non-cygwin actions incorrectly run options through _FixPath.
This adds an additional heuristic to the existing one. Now if an option begins
with either a '/' OR a '-', it assumes it's not a strict path.
Added a TODO which notes that the existing (and new) behavior will miss options
such as '--opt=a/posix/path', and '/opt:a/posix/path'.
Review URL: https://chromiumcodereview.appspot.com/10829049
------------------------------------------------------------------------
BUG=123026,113339
R=scottmg@chromium.org,cmp@chromium.org,nsylvain@chromium.org,jar@chromium.org,akalin@chromium.org,maruel@chromium.org
TEST=
Review URL: https://chromiumcodereview.appspot.com/10796051
git-svn-id: http://src.chromium.org/svn/trunk/src/build@149100 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
2012-07-31 05:07:32 +04:00
|
|
|
# Using the --arg val form (instead of --arg=val) allows gyp's msvs rule
|
|
|
|
# generation to correct 'val' which is a path.
|
|
|
|
'--proto_path','<(proto_in_dir)',
|
2011-08-19 01:52:15 +04:00
|
|
|
# Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires
|
|
|
|
# --proto_path is a strict prefix of the path given as an argument.
|
2012-02-28 09:25:06 +04:00
|
|
|
'<(proto_in_dir)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
|
2012-09-13 06:27:52 +04:00
|
|
|
'--cpp_out', '<(cc_generator_options)<(cc_dir)',
|
|
|
|
'--python_out', '<(py_dir)',
|
|
|
|
],
|
Change protoc build rule to not use cygwin bash.
Now protoc.exe will be directly invoked.
This rolls cacheinvalidation from r218:r219
------------------------------------------------------------------------
r219 | ghcooper@gmail.com | 2012-07-20 17:44:14 -0700 (Fri, 20 Jul 2012) | 1 line
move protos out of v2/; use relative paths for proto imports
------------------------------------------------------------------------
This also rolls gyp from r1440:r1441
------------------------------------------------------------------------
r1441 | iannucci@chromium.org | 2012-07-26 17:54:17 -0700 (Thu, 26 Jul 2012) | 8 lines
Fix bug: non-cygwin actions incorrectly run options through _FixPath.
This adds an additional heuristic to the existing one. Now if an option begins
with either a '/' OR a '-', it assumes it's not a strict path.
Added a TODO which notes that the existing (and new) behavior will miss options
such as '--opt=a/posix/path', and '/opt:a/posix/path'.
Review URL: https://chromiumcodereview.appspot.com/10829049
------------------------------------------------------------------------
BUG=123026,113339
R=scottmg@chromium.org,cmp@chromium.org,nsylvain@chromium.org,jar@chromium.org,akalin@chromium.org,maruel@chromium.org
TEST=
Review URL: https://chromiumcodereview.appspot.com/10796051
git-svn-id: http://src.chromium.org/svn/trunk/src/build@149100 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
2012-07-31 05:07:32 +04:00
|
|
|
'msvs_cygwin_shell': 0,
|
2011-08-19 01:52:15 +04:00
|
|
|
'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
|
|
|
|
'process_outputs_as_sources': 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'dependencies': [
|
|
|
|
'<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
|
|
|
|
'<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
|
|
|
|
],
|
|
|
|
'include_dirs': [
|
|
|
|
'<(SHARED_INTERMEDIATE_DIR)/protoc_out',
|
2012-09-13 06:27:52 +04:00
|
|
|
'<(DEPTH)',
|
2011-08-19 01:52:15 +04:00
|
|
|
],
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'include_dirs': [
|
|
|
|
'<(SHARED_INTERMEDIATE_DIR)/protoc_out',
|
2012-09-13 06:27:52 +04:00
|
|
|
'<(DEPTH)',
|
2011-08-19 01:52:15 +04:00
|
|
|
]
|
|
|
|
},
|
2011-08-19 22:19:52 +04:00
|
|
|
'export_dependent_settings': [
|
|
|
|
# The generated headers reference headers within protobuf_lite,
|
|
|
|
# so dependencies must be able to find those headers too.
|
|
|
|
'<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
|
|
|
|
],
|
2011-08-19 01:52:15 +04:00
|
|
|
# This target exports a hard dependency because it generates header
|
|
|
|
# files.
|
|
|
|
'hard_dependency': 1,
|
|
|
|
}
|