summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDerek Bailey <derekbailey@google.com>2022-04-21 20:43:55 -0700
committerDerek Bailey <derekbailey@google.com>2022-04-21 20:43:55 -0700
commit746c73b910f11fcf5da0b4727bce0909d8a573e4 (patch)
treee9210a91222c624d239d1c35776c31c1c321a498 /scripts
parent0bbfd4b2e3adaf9a92e1ef5a44b0dd79704bbae3 (diff)
downloadflatbuffers-746c73b910f11fcf5da0b4727bce0909d8a573e4.tar.gz
flatbuffers-746c73b910f11fcf5da0b4727bce0909d8a573e4.tar.bz2
flatbuffers-746c73b910f11fcf5da0b4727bce0909d8a573e4.zip
Add Annotations for Monster schema and example buffer
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate_code.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/generate_code.py b/scripts/generate_code.py
index 939b7c0b..248c2f40 100755
--- a/scripts/generate_code.py
+++ b/scripts/generate_code.py
@@ -97,6 +97,12 @@ def flatc_reflection(options, location, target):
shutil.move(str(new_reflection_path), str(original_reflection_path))
shutil.rmtree(str(Path(reflection_path, temp_dir)))
+def flatc_annotate(schema, file, include=None, cwd=tests_path):
+ cmd = [str(flatc_path)]
+ if include:
+ cmd += ["-I"] + [include]
+ cmd += ["--annotate", schema, file]
+ result = subprocess.run(cmd, cwd=str(cwd), check=True)
# Glob a pattern relative to file path
def glob(path, pattern):
@@ -272,6 +278,19 @@ flatc(
schema="monster_test.fbs",
)
+# Generate the annotated binary of the monster_test binary schema.
+flatc_annotate(
+ schema="../reflection/reflection.fbs",
+ file="monster_test.bfbs",
+ include="include_test"
+)
+
+flatc_annotate(
+ schema="monster_test.fbs",
+ file="monsterdata_test.mon",
+ include="include_test"
+)
+
flatc(
CPP_OPTS
+ NO_INCL_OPTS