Skip to content

Commit

Permalink
java_gen: clean filename handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andi-bigswitch committed Jul 25, 2013
1 parent cfcd3bc commit d83883e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ python-doc: python

java: .loxi_ts.java

.loxi_ts.java: ${LOXI_JAVA_FILES} ${LOXI_TEMPLATE_FILES} ${INPUT_FILES}
.loxi_ts.java: ${LOXI_PY_FILES} ${LOXI_TEMPLATE_FILES} ${INPUT_FILES}
./loxigen.py --install-dir=${LOXI_OUTPUT_DIR} --lang=java
cd loxi_output/openflowj; mvn package
cd ${LOXI_OUTPUT_DIR}/openflowj; mvn package
touch $@


Expand Down
6 changes: 3 additions & 3 deletions java_gen/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java_gen.java_model as java_model

def gen_all_java(out, name):
basedir='loxi_output/openflowj'
basedir= '%s/openflowj' % of_g.options.install_dir
srcdir = "%s/src/main/java/" % basedir
print "Outputting to %s" % basedir
if os.path.exists(basedir):
Expand All @@ -55,7 +55,7 @@ def gen_all_java(out, name):
gen.create_of_classes()
gen.create_of_const_enums()

with open('README.java-lang') as readme_src:
with open('%s/README.java-lang' % os.path.dirname(__file__)) as readme_src:
out.writelines(readme_src.readlines())
out.close()

Expand Down Expand Up @@ -138,4 +138,4 @@ def copy_prewrite_tree(basedir):
print "Copying pre-written files into %s" % basedir
#subprocess.call("cd java_gen/pre-written && tar cpf - pom.xml | ( cd ../../%s && tar xvpf - )" % basedir,
# shell=True)
os.symlink(os.path.abspath("java_gen/pre-written/pom.xml"), "%s/pom.xml" % basedir)
os.symlink(os.path.abspath("%s/pre-written/pom.xml" % os.path.dirname(__file__)), "%s/pom.xml" % basedir)
22 changes: 1 addition & 21 deletions lang_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,5 @@


targets = {
'base_java': java_codegen.gen_all_java
'openflowj/README': java_codegen.gen_all_java
}

##
# The list of files to produce. These are the keywords used to index
# the arrays below giving the external file names, the subdirectory locations
# and the generating functions.

target_files = ["base_java" ]
# Internal file name references to actual file names
file_to_name_map = dict(
# LOCI source
base_java="README.openflowj", # not really used by java generator
)

##
# The map from the internal file identifier to the function name
# that generates the content of the file

file_gen_map = dict(
base_java=java_codegen.gen_all_java,
)

0 comments on commit d83883e

Please sign in to comment.