CMake: pro2cmake.py: Add a way to debug merges of scopes
Generate debug output whenever a qmake scope with a variable 'PRO2CMAKE_MERGE_DEBUG' is involved in a scope merge. Change-Id: I0ad94b881db9930de689c199adbac084efe6c03b Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
parent
645002cd43
commit
ca4edbec66
@ -233,13 +233,22 @@ class Scope(object):
|
|||||||
self._total_condition = None # type: typing.Optional[str]
|
self._total_condition = None # type: typing.Optional[str]
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '{}:{}:{}'.format(self._basedir, self._file,
|
debug_mark = ' [MERGE_DEBUG]' if self.merge_debug else ''
|
||||||
self._condition or '<NONE>')
|
return '{}:{}:{}{}'.format(self._basedir, self._file,
|
||||||
|
self._condition or '<NONE>', debug_mark)
|
||||||
|
|
||||||
def reset_visited_keys(self):
|
def reset_visited_keys(self):
|
||||||
self._visited_keys = set()
|
self._visited_keys = set()
|
||||||
|
|
||||||
def merge(self, other: 'Scope') -> None:
|
def merge(self, other: 'Scope') -> None:
|
||||||
|
assert self != other
|
||||||
|
merge_debug = self.merge_debug or other.merge_debug
|
||||||
|
if merge_debug:
|
||||||
|
print('..... [MERGE_DEBUG]: Merging scope {}:'.format(other))
|
||||||
|
other.dump(indent=1)
|
||||||
|
print('..... [MERGE_DEBUG]: ... into scope {}:'.format(self))
|
||||||
|
self.dump(indent=1)
|
||||||
|
|
||||||
for c in other._children:
|
for c in other._children:
|
||||||
self._add_child(c)
|
self._add_child(c)
|
||||||
|
|
||||||
@ -249,6 +258,15 @@ class Scope(object):
|
|||||||
else:
|
else:
|
||||||
self._operations[key] = other._operations[key]
|
self._operations[key] = other._operations[key]
|
||||||
|
|
||||||
|
if merge_debug:
|
||||||
|
print('..... [MERGE_DEBUG]: Result scope {}:'.format(self))
|
||||||
|
self.dump(indent=1)
|
||||||
|
print('..... [MERGE_DEBUG]: <<END OF MERGE>>')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def merge_debug(self) -> bool:
|
||||||
|
return self.getString('PRO2CMAKE_MERGE_DEBUG', None) != None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def parent(self) -> typing.Optional[Scope]:
|
def parent(self) -> typing.Optional[Scope]:
|
||||||
return self._parent
|
return self._parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user