From fb718772a25e47876a713618a99bf785c5fabf8c Mon Sep 17 00:00:00 2001 From: underscorediscovery Date: Thu, 26 Nov 2015 13:45:18 -0330 Subject: [PATCH] flow; add `flow compile` step which runs hooks, haxe but doesn't run the build steps (i.e haxe compile only) --- src/flow/cmd/build/build.js | 2 ++ src/flow/cmd/build/builder.js | 4 ++++ src/flow/cmd/compile/compile.js | 21 +++++++++++++++++++++ src/flow/cmd/compile/usage.md | 17 +++++++++++++++++ src/flow/cmd/index.js | 1 + src/flow/cmd/run/usage.md | 4 ++-- src/flow/flow.js | 2 ++ src/flow/project/prepare/files.js | 2 +- src/flow/project/project.js | 1 + 9 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 src/flow/cmd/compile/compile.js create mode 100644 src/flow/cmd/compile/usage.md diff --git a/src/flow/cmd/build/build.js b/src/flow/cmd/build/build.js index 487c046..e80a99f 100644 --- a/src/flow/cmd/build/build.js +++ b/src/flow/cmd/build/build.js @@ -104,6 +104,8 @@ var internal = {}; //if build + run was asked if(flow.action == 'run') { flow.execute(flow, cmds['launch']); + } else { + return flow.finished(); } } else { //err diff --git a/src/flow/cmd/build/builder.js b/src/flow/cmd/build/builder.js index 9cca3dd..22a8b85 100644 --- a/src/flow/cmd/build/builder.js +++ b/src/flow/cmd/build/builder.js @@ -94,6 +94,10 @@ exports.run = function(flow, done) { internal.post_haxe = function(flow, done) { + if(flow.action == 'compile') { + return internal.complete(flow, done); + } + //on native targets we run hxcpp against the now //generated build files in the build output if(flow.target_cpp) { diff --git a/src/flow/cmd/compile/compile.js b/src/flow/cmd/compile/compile.js new file mode 100644 index 0000000..1575b3e --- /dev/null +++ b/src/flow/cmd/compile/compile.js @@ -0,0 +1,21 @@ + + var cmds = require('../') + + +exports.run = function run(flow, data) { + + //this is so build can use this to check if + //it should execute launch as well + flow.action = 'compile'; + + flow.execute(flow, cmds['build']); + +} //run + +exports.verify = function verify(flow, done) { + done(null,null); +} + +exports.error = function(flow, err) { + flow.log(1, 'run / error %s', err); +} \ No newline at end of file diff --git a/src/flow/cmd/compile/usage.md b/src/flow/cmd/compile/usage.md new file mode 100644 index 0000000..66682b1 --- /dev/null +++ b/src/flow/cmd/compile/usage.md @@ -0,0 +1,17 @@ +`flow compile [target] --options` + + [target] is implied as your current system if not specified. + + `flow compile` will execute a `build` command but stop after compiling the haxe output. + `--options` includes all options from the listed commands. + + for full info, `flow usage` and more specifically + `flow usage build` + + examples + + `flow compile` + build, and run the current system as the target + + `flow compile --clean` + compile against a clean bin/ path diff --git a/src/flow/cmd/index.js b/src/flow/cmd/index.js index 286d9e8..f3a389f 100644 --- a/src/flow/cmd/index.js +++ b/src/flow/cmd/index.js @@ -4,6 +4,7 @@ exports.run = require('./run/run'); exports.launch = require('./launch/launch'); exports.build = require('./build/build'); +exports.compile = require('./compile/compile'); exports.hooks = require('./hooks/hooks'); exports.clean = require('./clean/clean'); exports.package = require('./package/package'); diff --git a/src/flow/cmd/run/usage.md b/src/flow/cmd/run/usage.md index 04d4e2d..ae3df6a 100644 --- a/src/flow/cmd/run/usage.md +++ b/src/flow/cmd/run/usage.md @@ -2,12 +2,12 @@ [target] is implied as your current system if not specified. - `flow run` will execute `build`, `files`, `launch` in that order. + `flow run` will execute `files`, `build`, `launch` in that order. `--options` includes all options from the listed commands. for full info, `flow usage` and more specifically - `flow usage build` `flow usage files` + `flow usage build` `flow usage launch` examples diff --git a/src/flow/flow.js b/src/flow/flow.js index 82e1370..1445feb 100644 --- a/src/flow/flow.js +++ b/src/flow/flow.js @@ -194,6 +194,8 @@ internal.save_user_config = function(flow) { if(flow.flags._has('build')) { state.push('build only'); + } else if(flow.flags._has('compile')) { + state.push('compile only'); } if(flow.flags.debug) { diff --git a/src/flow/project/prepare/files.js b/src/flow/project/prepare/files.js index 35ae6bd..f58d864 100644 --- a/src/flow/project/prepare/files.js +++ b/src/flow/project/prepare/files.js @@ -8,7 +8,7 @@ var internal = {}; //returns an array of { source:dest } for the files in project exports.parse = function parse(flow, prepared, source, srcpath) { - flow.log(3, 'prepare - files'); + flow.log(4, 'prepare - files'); var project_file_list = []; var build_file_list = []; diff --git a/src/flow/project/project.js b/src/flow/project/project.js index 26e6d16..fb174aa 100644 --- a/src/flow/project/project.js +++ b/src/flow/project/project.js @@ -23,6 +23,7 @@ exports.init = function init(flow) { //but needs to watch for command lines calling target flow.target = flow.flags._next('build') || + flow.flags._next('compile') || flow.flags._next('launch') || flow.flags._next('run') || flow.flags._next('files') ||