Skip to content

Commit

Permalink
Let flatbuffer.gni supports to generate mutable header
Browse files Browse the repository at this point in the history
This change adds a "mutable" option to flatbuffer template,
let it using "--gen-mutable" flag to compile flatbuffer with
non-const accessors for mutating FlatBuffers in-place.

Bug: 1149150
Test: Compile flatbuffer see if it generates mutable header
Change-Id: I42ce7dfcac5ee8496db56548391b205d0b056aa3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2534550
Commit-Queue: Fish Lin <linfish@google.com>
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827709}
  • Loading branch information
Fish Lin authored and Commit Bot committed Nov 16, 2020
1 parent 7073726 commit e1f913d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions third_party/flatbuffers/flatbuffer.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# fail it will try to load relative to the directory of the schema file
# being parsed.
#
# mutable (optional)
# Boolean to compile flatbuffers with the "--gen-mutable" argument, which
# generates non-const accessors for mutating FlatBuffers in-place.
#
# deps (optional)
# Additional dependencies.
#
Expand Down Expand Up @@ -90,6 +94,10 @@ template("flatbuffer") {
}
}

if (defined(invoker.mutable) && invoker.mutable) {
args += [ "--gen-mutable" ]
}

args += [ "{{source}}" ]

# The deps may have steps that have to run before running flatc.
Expand Down

0 comments on commit e1f913d

Please sign in to comment.