Skip to content

Commit

Permalink
Run default task from compiler plugin and wait to finish
Browse files Browse the repository at this point in the history
  • Loading branch information
doublerebel committed Sep 17, 2013
1 parent d047985 commit 8b383c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions etc/Jakefile.coffee
Expand Up @@ -5,4 +5,5 @@
tintan = require('tintan')

# Make the default task depend on build.
# Default task is invoked by compiler plugin (plugin.py)
task 'default', ['build']
16 changes: 13 additions & 3 deletions etc/plugins/tintan/plugin.py
Expand Up @@ -44,19 +44,29 @@ def compile(config):
tintan = temp
break

if not os.path.isfile(tintan):
print "[WARN] Tintan not found, skipping tintan"
return

print "[INFO] Executing Tintan"
print " node", tintan, "-C", project_dir, 'tintan'

env = os.environ.copy()
env['TINTAN'] = to_json(c)
env['PATH'] = os.environ['PATH'] + ':/usr/local/bin'
env['NODE_PATH'] = node_path

# Flush the above print calls before opening the subprocess
sys.stdout.flush()
proc = subprocess.Popen(['node', tintan, '-C', project_dir, 'tintan'],
env={'TINTAN': to_json(c),
'PATH': os.environ['PATH'] + ':/usr/local/bin',
'NODE_PATH': node_path},
env = env,
stderr = sys.stderr, stdout = sys.stdout)
proc.communicate();
ret = proc.wait()

if ret != 0:
raise Exception('Tintan terminated with exitcode: '+str(ret))
sys.exit(0)

if __name__ == '__main__':
proj_dir = None
Expand Down
5 changes: 4 additions & 1 deletion src/tintan/tasks.coffee
Expand Up @@ -14,6 +14,9 @@ module.exports = (tintan)->

require(file) tintan for file in files

task 'tintan', ->
task 'showenv', ->
console.log tintan.constructor.env

# Called by the compiler plugin (plugin.py)
task 'tintan', ['showenv', 'default'], ->
console.log 'done'.green + ' building ' + tintan.constructor.appXML().name()

0 comments on commit 8b383c3

Please sign in to comment.