Merge pull request #618 from mesonbuild/rtrehaul
Rework run_target to mirror custom_target.pull/625/head
commit
cc775d64c9
8 changed files with 117 additions and 33 deletions
@ -0,0 +1,5 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import sys |
||||
|
||||
open(sys.argv[2], 'wb').write(open(sys.argv[1], 'rb').read()) |
@ -0,0 +1,13 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import sys |
||||
|
||||
plain_arg = sys.argv[1] |
||||
_, filename, _ = plain_arg.split(':') |
||||
try: |
||||
content = open(filename, 'rb').read() |
||||
except FileNotFoundError: |
||||
print('Could not open file. Missing dependency?') |
||||
sys.exit(1) |
||||
print('File opened, pretending to send it somewhere.') |
||||
print(len(content), 'bytes uploaded') |
@ -1,12 +1,36 @@ |
||||
project('run target', 'c') |
||||
|
||||
run_target('mycommand', 'scripts/script.sh') |
||||
# deprecated format, fix once we remove support for it. |
||||
run_target('mycommand','scripts/script.sh') |
||||
|
||||
# Make it possible to run built programs. |
||||
# In cross builds exe_wrapper should be added if it exists. |
||||
|
||||
exe = executable('helloprinter', 'helloprinter.c') |
||||
run_target('runhello', exe, 'argument') |
||||
run_target('runhello', |
||||
command : [exe, 'argument']) |
||||
|
||||
converter = find_program('converter.py') |
||||
|
||||
hex = custom_target('exe.hex', |
||||
input : exe, |
||||
output : 'exe.hex', |
||||
command : [converter, '@INPUT@', '@OUTPUT@', |
||||
], |
||||
) |
||||
|
||||
# These emulates the Arduino flasher application. It sandwiches the filename inside |
||||
# a packed argument. Thus we need to declare it manually. |
||||
run_target('upload', |
||||
command : ['fakeburner.py', 'x:@0@:y'.format(exe.full_path())], |
||||
depends : exe, |
||||
) |
||||
|
||||
run_target('upload2', |
||||
command : ['fakeburner.py', 'x:@0@:y'.format(hex.full_path())], |
||||
depends : hex, |
||||
) |
||||
|
||||
python3 = find_program('python3') |
||||
run_target('py3hi', python3, '-c', 'print("I am Python3.")') |
||||
run_target('py3hi', |
||||
command : [python3, '-c', 'print("I am Python3.")']) |
||||
|
Loading…
Reference in new issue