Move generated files to dedicated folders named by namespace

Making it cleaner and simpler to navigate and removing previous
ugly and now useless hack where we were renaming files ourself
to make meson happy.
This commit is contained in:
Thibault Saunier 2018-03-11 21:39:46 -03:00
parent f9044e93e1
commit 2d00f898fb
836 changed files with 891 additions and 852 deletions

View file

@ -50,8 +50,10 @@ if __name__ == "__main__":
'--outdir=' + opts.out, '--outdir=' + opts.out,
'--assembly-name=' + opts.assembly_name, '--assembly-name=' + opts.assembly_name,
'--glue-includes=' + opts.abi_includes, '--glue-includes=' + opts.abi_includes,
'--abi-c-filename=' + os.path.join(opts.out, opts.assembly_name + "-abi.c"), '--abi-c-filename=' +
'--abi-cs-filename=' + os.path.join(opts.out, opts.assembly_name + "-abi.cs"), os.path.join(opts.out, opts.assembly_name + "-abi.c"),
'--abi-cs-filename=' +
os.path.join(opts.out, opts.assembly_name + "-abi.cs"),
] ]
if opts.schema: if opts.schema:
@ -68,21 +70,24 @@ if __name__ == "__main__":
# as meson doesn't like path separator in output names. # as meson doesn't like path separator in output names.
regex = re.compile('_') regex = re.compile('_')
dirs = set() dirs = set()
for _f in opts.files.split(';'): expected_files = set(opts.files.split(';'))
fpath = os.path.join(opts.out, regex.sub("/", _f, 1)) for _f in expected_files:
dirs.add(os.path.dirname(fpath)) dirs.add(os.path.dirname(_f))
_f = os.path.join(opts.out, _f)
shutil.move(fpath, _f)
missing_files = [] generated = set(glob.glob(os.path.join('*/*.cs')))
for _dir in dirs: rcode = 0
missing_files.extend(glob.glob(os.path.join(_dir, '*.cs'))) not_listed = generated - expected_files
if not_listed:
if missing_files:
print("Following files were generated but not listed:\n %s" % print("Following files were generated but not listed:\n %s" %
'\n '.join(["'%s_%s'," % (m.split(os.path.sep)[-2], m.split(os.path.sep)[-1]) '\n '.join(["'%s/%s'," % (m.split(os.path.sep)[-2], m.split(os.path.sep)[-1])
for m in missing_files])) for m in not_listed]))
exit(1) rcode = 1
for _dir in dirs: not_generated = expected_files - generated
shutil.rmtree(_dir) if not_generated:
print("Following files were generated but not listed:\n %s" %
'\n '.join(["'%s/%s'," % (m.split(os.path.sep)[-2], m.split(os.path.sep)[-1])
for m in not_generated]))
rcode = 1
exit(rcode)

Some files were not shown because too many files have changed in this diff Show more