Skip to content

Commit

Permalink
[flatbuffers] Enable including by absolute path.
Browse files Browse the repository at this point in the history
BUG=713774

Review-Url: https://codereview.chromium.org/2928573002
Cr-Commit-Position: refs/heads/master@{#478130}
  • Loading branch information
pkalinnikov authored and Commit Bot committed Jun 9, 2017
1 parent 4aeb968 commit 7975d5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(pkalinnikov): Make including by absolute path work.
include "url_pattern_index.fbs";
include "components/subresource_filter/core/common/flat/url_pattern_index.fbs";

namespace subresource_filter.flat;

Expand Down
29 changes: 16 additions & 13 deletions third_party/flatbuffers/flatbuffer.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
#
# flatc_include_dirs (optional)
# Specifies the directories which FlatBuffers compiler uses to find
# included .fbs files in.
# included .fbs files in. Almost always should be empty.
#
# The directories will be tried in the order given, and if all fail (or,
# as by default, none are specified) it will try to load relative to the
# directory of the schema file being parsed.
# The list always has an implicit first item corresponding to the root of
# the source tree. This enables including .fbs files by absolute path.
#
# TODO(pkalinnikov): Add repository root to this list, to allow including
# by absolute path.
# The compiler will try the directories in the order given, and if all
# fail it will try to load relative to the directory of the schema file
# being parsed.
#
# deps (optional)
# Additional dependencies.
Expand Down Expand Up @@ -79,22 +79,25 @@ template("flatbuffer") {
"$out_dir/{{source_name_part}}_generated.h",
]

args = [ "-c" ]
args = [
"-c",
"--keep-prefix",
"-o",
"$out_dir",
"-I",
rebase_path("//", root_build_dir),
]

if (defined(invoker.flatc_include_dirs)) {
foreach(include_dir, invoker.flatc_include_dirs) {
args += [
"-I",
rebase_path(include_dir, "$root_build_dir"),
rebase_path(include_dir, root_build_dir),
]
}
}

args += [
"-o",
"$out_dir",
"{{source}}",
]
args += [ "{{source}}" ]

# The deps may have steps that have to run before running flatc.
if (defined(invoker.deps)) {
Expand Down

0 comments on commit 7975d5b

Please sign in to comment.