The new directive in the form { 'include': 'path/to/file.json' } will trigger
the
parsing of path/to/file.json.
The directive will be replaced by the result of the parsing.
This will allow for easy modularisation of qapi JSON descriptions files.
The qapi commands now takes the input file path as first argument to make it
easier to detect include loops: stdin would not allow to do this.
Signed-off-by: Benoit Canet
---
Makefile | 24 +--
scripts/qapi-commands.py | 8 +++-
scripts/qapi-types.py | 8 +++-
scripts/qapi-visit.py | 8 +++-
scripts/qapi.py| 46 +-
tests/Makefile | 16
tests/qapi-schema/duplicate-key.err| 2 +-
.../qapi-schema/flat-union-invalid-branch-key.err | 2 +-
.../flat-union-invalid-discriminator.err | 2 +-
tests/qapi-schema/flat-union-no-base.err | 2 +-
.../flat-union-string-discriminator.err| 2 +-
tests/qapi-schema/funny-char.err | 2 +-
tests/qapi-schema/include.err | 0
tests/qapi-schema/include.exit | 1 +
tests/qapi-schema/include.json | 4 ++
tests/qapi-schema/include.out | 8
tests/qapi-schema/include/include.json | 7
tests/qapi-schema/include_loop.err | 0
tests/qapi-schema/include_loop.exit| 1 +
tests/qapi-schema/include_loop.json| 1 +
tests/qapi-schema/include_loop.out | 1 +
tests/qapi-schema/missing-colon.err| 2 +-
tests/qapi-schema/missing-comma-list.err | 2 +-
tests/qapi-schema/missing-comma-object.err | 2 +-
tests/qapi-schema/non-objects.err | 2 +-
tests/qapi-schema/quoted-structural-chars.err | 2 +-
tests/qapi-schema/test-qapi.py | 2 +-
tests/qapi-schema/trailing-comma-list.err | 2 +-
tests/qapi-schema/trailing-comma-object.err| 2 +-
tests/qapi-schema/unclosed-list.err| 2 +-
tests/qapi-schema/unclosed-object.err | 2 +-
tests/qapi-schema/unclosed-string.err | 2 +-
tests/qapi-schema/union-invalid-base.err | 2 +-
33 files changed, 116 insertions(+), 53 deletions(-)
create mode 100644 tests/qapi-schema/include.err
create mode 100644 tests/qapi-schema/include.exit
create mode 100644 tests/qapi-schema/include.json
create mode 100644 tests/qapi-schema/include.out
create mode 100644 tests/qapi-schema/include/include.json
create mode 100644 tests/qapi-schema/include_loop.err
create mode 100644 tests/qapi-schema/include_loop.exit
create mode 100644 tests/qapi-schema/include_loop.json
create mode 100644 tests/qapi-schema/include_loop.out
diff --git a/Makefile b/Makefile
index ec74039..9bec4ff 100644
--- a/Makefile
+++ b/Makefile
@@ -236,24 +236,24 @@ gen-out-type = $(subst .,-,$(suffix $@))
qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
-$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py
$(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, " GEN $@")
+$(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py
$(SRC_PATH)/qga/qapi-schema.json $(gen-out-type) -o qga/qapi-generated -p
"qga-" < $<, " GEN $@")
qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h :\
-$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py
$(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, " GEN $@")
+$(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py
$(SRC_PATH)/qga/qapi-schema.json $(gen-out-type) -o qga/qapi-generated -p
"qga-" < $<, " GEN $@")
qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-marshal.c :\
-$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py
$(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py
$(gen-out-type) -o qga/qapi-generated -p "qga-" < $<, " GEN $@")
+$(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
+ $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py
$(SRC_PATH)/qga/qapi-schema.json $(gen-out-type) -o qga/qapi-generated -p
"qga-" < $<, " GEN $@")
qapi-types.c qapi-types.h :\
-$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
- $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py
$(gen-out-type) -o "." -b < $<, "