Skip to contentSkip to conversation

qapi: Build-depend on all json files

PATCH In review Lluís Vilanova 2 participants 2 messages Feb 4, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qapi: Build-depend on all json files

Dynamically detects the files used to generate QAPI code, thus ensuring it's never out of sync with the sources.

---
 Makefile |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Makefile +2 -4
index d0de2d4..f8e8648 100644
@@ -269,10 +269,8 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
 		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
 		"  GEN   $@")
 
-qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
-               $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
-               $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json \
-               $(SRC_PATH)/qapi/crypto.json
+qapi-modules = $(SRC_PATH)/qapi-schema.json
+qapi-modules += $(wildcard $(SRC_PATH)/qapi/*.json)
 
 qapi-types.c qapi-types.h :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
#1 lore raw
Quoted 15 lines · Lluís Vilanova

Dynamically detects the files used to generate QAPI code, thus ensuring it's never out of sync with the sources.

---
 Makefile |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Makefile +0 -0
index d0de2d4..f8e8648 100644
@@ -269,10 +269,8 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
 		$(gen-out-type) -o qga/qapi-generated -p "qga-" $<, \
 		"  GEN   $@")

Makefile $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) · line 276

Quoted 10 lines
Makefile +2 -4
 
-qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
-               $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
-               $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json \
-               $(SRC_PATH)/qapi/crypto.json
+qapi-modules = $(SRC_PATH)/qapi-schema.json
+qapi-modules += $(wildcard $(SRC_PATH)/qapi/*.json)
 
 qapi-types.c qapi-types.h :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)

I'm not really a fan of the use of wildcards - IME they also lead to bugs where the build picks up too many or too few files and you don't notice the mistake until later - this is particularly true at release time when making dist, but also where a developer has a file locally they forget to commit and submit for merge, it can be silently missed.

So yes you are fixing one possible source of mistakes, but in exchange you are introducing a different possible source of mistakes. I don't think one is clearer better than the other, and IMHO so we're better sticking with normal QEMU practice listing all files explicitly.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|