summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-10-19 14:44:48 -0400
committerColin Walters <walters@verbum.org>2011-10-19 14:44:48 -0400
commit80de6648b5be315c9f2b73b3f04282e42517568e (patch)
tree194991d983cdb76194a9090803fab003087b8799
parentdf189c388b458475ac866715c7ff61a2d2cd7ccf (diff)
downloadgobject-introspection-80de6648b5be315c9f2b73b3f04282e42517568e.tar.gz
scanner: Support --header-only flag
This is useful for someone who just wants a set of constants from a .h file accessible by introspection.
-rwxr-xr-xgiscanner/scannermain.py12
-rw-r--r--tests/scanner/Makefile.am5
2 files changed, 14 insertions, 3 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 6dc56ef0..bcacd0f6 100755
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -108,6 +108,9 @@ def _get_option_parser():
parser.add_option("-L", "--library-path",
action="append", dest="library_paths", default=[],
help="directories to search for libraries")
+ parser.add_option("", "--header-only",
+ action="store_true", dest="header_only", default=[],
+ help="If specified, just generate a GIR for the given header files")
parser.add_option("-n", "--namespace",
action="store", dest="namespace_name",
help=("name of namespace for this unit, also "
@@ -389,7 +392,9 @@ def scanner_main(args):
else:
_error("Unknown format: %s" % (options.format, ))
- if not (options.libraries or options.program):
+ if not (options.libraries
+ or options.program
+ or options.header_only):
_error("Must specify --program or --library")
namespace = create_namespace(options)
@@ -413,7 +418,10 @@ def scanner_main(args):
transformer.set_annotations(blocks)
transformer.parse(ss.get_symbols())
- shlibs = create_binary(transformer, options, args)
+ if not options.header_only:
+ shlibs = create_binary(transformer, options, args)
+ else:
+ shlibs = []
main = MainTransformer(transformer, blocks)
main.transform()
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index 0b287091..38e1cd04 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -115,7 +115,10 @@ Bar_1_0_gir_SCANNERFLAGS = --accept-unprefixed
GIRS += Bar-1.0.gir
endif
+Headeronly-1.0.gir: headeronly.h
+ $(AM_V_GEN) $(INTROSPECTION_SCANNER) $(INTROSPECTION_SCANNER_ARGS) --warn-all --warn-error --reparse-validate --namespace=Headeronly --nsversion=1.0 --header-only --output=$@ $<
+
%.gir.check: %.gir
@diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo " TEST $*.gir"
-check-local: $(CHECKGIRS) $(TYPELIBS)
+check-local: Headeronly-1.0.gir $(CHECKGIRS) $(TYPELIBS)