Replace javah by javac -h, only write new constant files if something changes.
The const_generator changes help to ensure that e.g. Java rebuilds don't keep rebuilding everything.
This commit is contained in:
@@ -159,8 +159,9 @@ def gen(lang):
|
||||
templ = template[lang]
|
||||
for target in include:
|
||||
prefix = templ[target]
|
||||
outfile = open(templ['out_file'] %(prefix), 'wb') # open as binary prevents windows newlines
|
||||
outfile.write((templ['header'] % (prefix)).encode("utf-8"))
|
||||
outfn = templ['out_file'] % prefix
|
||||
outfile = open(outfn + ".tmp", 'wb') # open as binary prevents windows newlines
|
||||
outfile.write((templ['header'] % prefix).encode("utf-8"))
|
||||
if target == 'unicorn.h':
|
||||
prefix = ''
|
||||
with open(os.path.join(INCL_DIR, target)) as f:
|
||||
@@ -278,6 +279,19 @@ def gen(lang):
|
||||
outfile.write((templ['footer']).encode("utf-8"))
|
||||
outfile.close()
|
||||
|
||||
if os.path.isfile(outfn):
|
||||
with open(outfn, "rb") as infile:
|
||||
cur_data = infile.read()
|
||||
with open(outfn + ".tmp", "rb") as infile:
|
||||
new_data = infile.read()
|
||||
if cur_data == new_data:
|
||||
os.unlink(outfn + ".tmp")
|
||||
else:
|
||||
os.unlink(outfn)
|
||||
os.rename(outfn + ".tmp", outfn)
|
||||
else:
|
||||
os.rename(outfn + ".tmp", outfn)
|
||||
|
||||
def main():
|
||||
lang = sys.argv[1]
|
||||
if lang == "all":
|
||||
|
||||
Reference in New Issue
Block a user