fix(make): dependencies are now per-program-type

Previously we put cli.py into the common lib folder, which caused the
API to be regenerated and rebuilt whenever we changed code that will
only affect the CLI, causing terrible turnaround times.

Now the dependency is fixed.
This commit is contained in:
Sebastian Thiel
2015-04-12 09:55:17 +02:00
parent 3e0a24db0d
commit acd42dfccc
4 changed files with 11 additions and 7 deletions

View File

@@ -28,7 +28,8 @@ endif
API_JSON_FILES = $(shell find etc -type f -name '*-api.json')
MAKO_LIB_DIR = $(MAKO_SRC)/lib
MAKO_LIB_FILES = $(shell find $(MAKO_LIB_DIR) -type f -name '*.*')
MAKO = PYTHONPATH=$(MAKO_LIB_DIR) $(TPL) --template-dir '.'
MAKO = $(TPL) --template-dir '.'
PYPATH = PYTHONPATH=$(MAKO_LIB_DIR)
MAKO_STANDARD_DEPENDENCIES = $(API_SHARED_INFO) $(MAKO_LIB_FILES) $(MAKO_RENDER)
help:
@@ -60,10 +61,10 @@ $(MAKO_RENDER): $(PYTHON)
# Explicitly NOT depending on $(MAKO_LIB_FILES), as it's quite stable and now takes 'too long' thanks
# to a URL get call to the google discovery service
$(API_DEPS): $(API_DEPS_TPL) $(API_SHARED_INFO) $(MAKO_RENDER) $(TYPE_API_INFO) $(API_LIST)
$(MAKO) -io $(API_DEPS_TPL)=$@ --data-files $(API_SHARED_INFO) $(TYPE_API_INFO) $(API_LIST)
$(PYPATH) $(MAKO) -io $(API_DEPS_TPL)=$@ --data-files $(API_SHARED_INFO) $(TYPE_API_INFO) $(API_LIST)
$(CLI_DEPS): $(API_DEPS_TPL) $(API_SHARED_INFO) $(MAKO_RENDER) $(TYPE_CLI_INFO) $(API_LIST)
$(MAKO) -io $(API_DEPS_TPL)=$@ --data-files $(API_SHARED_INFO) $(TYPE_CLI_INFO) $(API_LIST)
$(PYPATH) $(MAKO) -io $(API_DEPS_TPL)=$@ --data-files $(API_SHARED_INFO) $(TYPE_CLI_INFO) $(API_LIST)
deps: $(API_DEPS) $(CLI_DEPS)

View File

@@ -10,7 +10,7 @@ re_splitters = re.compile(r"%s ([\w\-\.]+)\n(.*?)\n%s" % (SPLIT_START, SPLIT_END
# transform name to be a suitable subcommand
def mangle_subcommand(name):
return util.camel_to_under(name).replace('_', '-').replace('.', '-')
return util.camel_to_under(util.singular(name)).replace('_', '-').replace('.', '-')
# transform the resource name into a suitable filename to contain the markdown documentation for it

View File

@@ -18,6 +18,7 @@ extern crate rustc_serialize;
${docopt.new(c)}\
fn main() {
let _: Args = Args::docopt().decode().unwrap_or_else(|e| e.exit());
let args: Args = Args::docopt().decode().unwrap_or_else(|e| e.exit());
println!("{:?}", args);
println!("Hello, ${id} !");
}

View File

@@ -32,9 +32,11 @@
if mako is not UNDEFINED:
post_processor_arg = '--post-process-python-module=%s' % mako.post_processor_module
python_path = 'PYTHONPATH=$(MAKO_LIB_DIR)'
try:
root = directories.mako_src + '/' + make.id + '/lib'
lib_files = [os.path.join(root, file_name) for file_name in os.listdir(root)]
python_path += ':%s' % root
except OSError:
lib_files = list()
%>\
@@ -89,7 +91,7 @@ ${api_common}: $(RUST_SRC)/${make.id}/cmn.rs $(lastword $(MAKEFILE_LIST)) ${gen_
${gen_root_stamp}: ${' '.join(i[0] for i in sds)} ${' '.join(lib_files)} ${api_json_inputs} $(MAKO_STANDARD_DEPENDENCIES) ${depends_on_target}
@echo Generating ${api_target}
@$(MAKO) -io ${' '.join("%s=%s" % (s, d) for s, d in sds)} ${post_processor_arg} --data-files ${api_json_inputs}
@${python_path} $(MAKO) -io ${' '.join("%s=%s" % (s, d) for s, d in sds)} ${post_processor_arg} --data-files ${api_json_inputs}
@touch $@
${api_target}: ${api_common}
@@ -134,7 +136,7 @@ gen-all${agsuffix}: ${space_join(0)}
% if global_targets:
${doc_index}: docs${agsuffix} ${type_specific_json} ## TODO: all type dependencies: docs-api, docs-cli
$(MAKO) --var DOC_ROOT=${doc_root} -io $(MAKO_SRC)/index.html.mako=$@ --data-files $(API_SHARED_INFO) $(API_LIST) ${type_specific_json}
$(PYPATH) $(MAKO) --var DOC_ROOT=${doc_root} -io $(MAKO_SRC)/index.html.mako=$@ --data-files $(API_SHARED_INFO) $(API_LIST) ${type_specific_json}
@echo Documentation index created at '$@'
docs-all: ${doc_index}
docs-all-clean: