Permalink
Browse files

Turn on ASDL code generation in the default dev build.

Move generated Python code _devbuild/gen, where the generated C code
lives.

I tested this with the app bundle, and it works.
  • Loading branch information...
Andy Chu
Andy Chu committed Dec 20, 2017
1 parent 71bef3f commit dee20f7a380a262101e35533b2302096e6ab1867
Showing with 23 additions and 10 deletions.
  1. +1 −0 README.md
  2. +3 −2 asdl/run.sh
  3. +11 −0 build/dev.sh
  4. +2 −3 build/doc.sh
  5. +1 −1 core/builtin.py
  6. +5 −4 osh/ast_.py
View
@@ -92,6 +92,7 @@ Directory Structure
_bin/ # Native executables are put here
_build/ # Temporary build files
_devbuild/ # Developer build files not deleted upon 'make clean'
gen/ # Generated Python and C code
_deps/ # build dependencies like re2c
_tmp/ # Test suites and other temp files
spec/
View
@@ -64,9 +64,10 @@ gen-python() {
asdl/gen_python.py $schema
}
# For testing only, build/dev.sh has it
gen-osh-python() {
touch _tmp/__init__.py
local out=_devbuild/osh_asdl.py
local out=_devbuild/gen/osh_asdl.py
mkdir -p _devbuild/gen
gen-python osh/osh.asdl > $out
wc -l $out
}
View
@@ -31,6 +31,12 @@ gen-help() {
#build/doc.sh oil-quick-ref
}
gen-osh-asdl() {
local out=_devbuild/gen/osh_asdl.py
PYTHONPATH=. asdl/gen_python.py osh/osh.asdl > $out
echo "Wrote $out"
}
# TODO: should fastlex.c be part of the dev build? It means you need re2c
# installed? I don't think it makes sense to have 3 builds, so yes I think we
# can put it here for simplicity.
@@ -71,7 +77,12 @@ clean() {
# No fastlex, because we don't want to require re2c installation.
minimal() {
mkdir -p _devbuild/gen
# so osh_help.py and osh_asdl.py are importable
touch _devbuild/__init__.py _devbuild/gen/__init__.py
gen-help
gen-osh-asdl
pylibc
}
View
@@ -64,10 +64,9 @@ x-quick-ref() {
local html_out=$out_dir/doc/$prog-quick-ref.html
local text_out_dir=_build/$prog-quick-ref
local py_out=_devbuild/${prog}_help.py
local py_out=_devbuild/gen/${prog}_help.py
mkdir -p _build/doc $text_out_dir _devbuild
touch _devbuild/__init__.py # so osh_help is importable
mkdir -p _build/doc $text_out_dir
{
cat <<EOF
View
@@ -36,7 +36,7 @@
from osh import lex
from _devbuild import osh_help # generated file
from _devbuild.gen import osh_help # generated file
value_e = runtime.value_e
scope_e = runtime.scope_e
View
@@ -129,13 +129,14 @@ def LoadSchema(f):
asdl_module, type_lookup = LoadSchema(f)
root = sys.modules[__name__]
if 1:
if 0:
py_meta.MakeTypes(asdl_module, root, type_lookup)
f.close()
else:
# Export for generated code to look at
# Exported for the generated code to use
TYPE_LOOKUP = type_lookup
# Get the types from elsewhere
from _devbuild import osh_asdl
from _devbuild.gen import osh_asdl
py_meta.AssignTypes(osh_asdl, root)
f.close()

0 comments on commit dee20f7

Please sign in to comment.