rewriter: Renamed tgt_{add,rm} --> target_{add,rm}

pull/4992/head
Daniel Mensinger 6 years ago
parent c98987c19e
commit 1290330894
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 2
      docs/markdown/Rewriter.md
  2. 12
      mesonbuild/rewriter.py
  3. 2
      test cases/rewrite/1 basic/addTgt.json
  4. 4
      test cases/rewrite/1 basic/rmTgt.json
  5. 2
      test cases/rewrite/2 subdirs/addTgt.json
  6. 2
      test cases/rewrite/2 subdirs/rmTgt.json

@ -175,7 +175,7 @@ The format for the type `target` is defined as follows:
{
"type": "target",
"target": "target ID/name/assignment variable",
"operation": "one of ['src_add', 'src_rm', 'tgt_rm', 'tgt_add', 'info']",
"operation": "one of ['src_add', 'src_rm', 'target_rm', 'target_add', 'info']",
"sources": ["list", "of", "source", "files", "to", "add, remove"],
"subdir": "subdir where the new target should be added (only has an effect for operation 'tgt_add')",
"target_type": "function name of the new target -- same as in the CLI (only has an effect for operation 'tgt_add')"

@ -306,7 +306,7 @@ rewriter_keys = {
},
'target': {
'target': (str, None, None),
'operation': (str, None, ['src_add', 'src_rm', 'tgt_rm', 'tgt_add', 'info']),
'operation': (str, None, ['src_add', 'src_rm', 'target_rm', 'target_add', 'info']),
'sources': (list, [], None),
'subdir': (str, '', None),
'target_type': (str, 'executable', ['both_libraries', 'executable', 'jar', 'library', 'shared_library', 'shared_module', 'static_library']),
@ -571,7 +571,7 @@ class Rewriter:
def process_target(self, cmd):
mlog.log('Processing target', mlog.bold(cmd['target']), 'operation', mlog.cyan(cmd['operation']))
target = self.find_target(cmd['target'])
if target is None and cmd['operation'] != 'tgt_add':
if target is None and cmd['operation'] != 'target_add':
mlog.error('Unknown target "{}" --> skipping'.format(cmd['target']))
return
@ -678,7 +678,7 @@ class Rewriter:
if root not in self.modefied_nodes:
self.modefied_nodes += [root]
elif cmd['operation'] == 'tgt_add':
elif cmd['operation'] == 'target_add':
if target is not None:
mlog.error('Can not add target', mlog.bold(cmd['target']), 'because it already exists')
return
@ -705,7 +705,7 @@ class Rewriter:
tgt_ass_node.accept(AstIndentationGenerator())
self.to_add_nodes += [src_ass_node, tgt_ass_node]
elif cmd['operation'] == 'tgt_rm':
elif cmd['operation'] == 'target_rm':
to_remove = self.find_assignment_node(target['node'])
if to_remove is None:
to_remove = target['node']
@ -841,8 +841,8 @@ class Rewriter:
target_operation_map = {
'add': 'src_add',
'rm': 'src_rm',
'add_target': 'tgt_add',
'rm_target': 'tgt_rm',
'add_target': 'target_add',
'rm_target': 'target_rm',
'info': 'info',
}

@ -2,7 +2,7 @@
{
"type": "target",
"target": "trivialprog10",
"operation": "tgt_add",
"operation": "target_add",
"sources": ["new1.cpp", "new2.cpp"],
"target_type": "shared_library"
}

@ -7,11 +7,11 @@
{
"type": "target",
"target": "trivialprog1",
"operation": "tgt_rm"
"operation": "target_rm"
},
{
"type": "target",
"target": "trivialprog9",
"operation": "tgt_rm"
"operation": "target_rm"
}
]

@ -2,7 +2,7 @@
{
"type": "target",
"target": "newLib",
"operation": "tgt_add",
"operation": "target_add",
"sources": ["new1.cpp", "new2.cpp"],
"target_type": "shared_library",
"subdir": "sub2"

@ -2,6 +2,6 @@
{
"type": "target",
"target": "something",
"operation": "tgt_rm"
"operation": "target_rm"
}
]

Loading…
Cancel
Save