Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions waftools/zcm-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

import os
import waflib
import json
from waflib import Task
from waflib import Utils
from waflib import Logs
from waflib.Errors import WafError
from waflib.TaskGen import extension
from waflib.Configure import conf
Expand Down Expand Up @@ -178,6 +180,22 @@ def outFileNames(ctx, bldpath, inFile, **kw):

return files

def getTypeHashes(ctx, inFile):
zcmgen = ctx.env['ZCMGEN']

raw = ctx.cmd_and_log('zcm-gen -d %s' % (inFile),
output=waflib.Context.STDOUT,
quiet=waflib.Context.BOTH).strip()
data = json.loads(raw)
results = [
[
entry["structname"]["fullname"],
str(entry["hash"]),
]
for entry in data.values()
]
return results

def genJuliaPkgFiles(task):
gen = task.generator

Expand Down Expand Up @@ -265,7 +283,15 @@ def zcmgen(ctx, **kw):
cppStdArray = cppStdArray,
juliapkg = juliapkg,
javapkg = javapkg)
allTypeHashes = {}
for s in tg.source:
typeHashes = getTypeHashes(ctx, s)
for [tName, tHash] in typeHashes:
if tHash in allTypeHashes:
Logs.warn(('WARNING: %s and %s have the same hash. ' +
'You probably do not want this.')
% (allTypeHashes[tHash], tName))
allTypeHashes[tHash] = tName
ctx.add_manual_dependency(s, zcmgen)

if 'cpp' in lang:
Expand Down
Loading