Get code generator plugin to a decently working state.

Still a few outstanding performance issues, and imports inside .capnp
files may not be working
This commit is contained in:
Jason Paryani
2014-10-19 20:06:00 -07:00
parent ece4e36329
commit 64e80e06bf
6 changed files with 278 additions and 95 deletions

View File

@@ -5,14 +5,21 @@ import os
import re
files = [{% for f in code.requestedFiles %}"{{f.filename}}",{% endfor %}]
files = [{% for f in code.requestedFiles %}"{{f.filename}}", {% endfor %}]
for f in files:
cpp_file = f + '.cpp'
if not os.path.exists(cpp_file):
if not os.path.exists(f + '.c++'):
cplus_file = f + '.c++'
cpp_mod = os.path.getmtime(cpp_file)
cplus_mod = 0
try:
cplus_mod = os.path.getmtime(cplus_file)
except:
pass
if not os.path.exists(cpp_file) or cpp_mod < cplus_mod:
if not os.path.exists(cplus_file):
raise RuntimeError("You need to run `capnp compile -oc++` in addition to `-ocython` first.")
os.rename(f + '.c++', cpp_file)
os.rename(cplus_file, cpp_file)
with open(f + '.h', "r") as file:
lines = file.readlines()