|
5 | 5 |
|
6 | 6 | from shutil import move, rmtree |
7 | 7 | from optparse import OptionParser |
| 8 | +from os import path |
8 | 9 |
|
9 | 10 | from tools.paths import EXPORT_DIR, EXPORT_WORKSPACE, EXPORT_TMP |
10 | 11 | from tools.paths import MBED_BASE, MBED_LIBRARIES |
11 | 12 | from tools.export import export, setup_user_prj, EXPORTERS, mcu_ide_matrix |
12 | | -from tools.utils import args_error |
| 13 | +from tools.utils import args_error, mkdir |
13 | 14 | from tools.tests import TESTS, Test, TEST_MAP |
14 | 15 | from tools.targets import TARGET_NAMES |
15 | 16 | from tools.libraries import LIBRARIES |
|
136 | 137 | zip = True |
137 | 138 | clean = True |
138 | 139 |
|
| 140 | + # source_dir = use relative paths, otherwise sources are copied |
| 141 | + sources_relative = True if options.source_dir else False |
| 142 | + |
139 | 143 | for mcu in mcus.split(','): |
140 | 144 | # Program Number or name |
141 | | - p, n, src = options.program, options.program_name, options.source_dir |
| 145 | + p, n, src, ide = options.program, options.program_name, options.source_dir, options.ide |
142 | 146 |
|
143 | 147 | if src is not None: |
144 | 148 | # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file |
145 | 149 | project_dir = options.source_dir |
146 | 150 | project_name = basename(project_dir) |
147 | | - project_temp = project_dir |
| 151 | + project_temp = path.join(options.source_dir, 'projectfiles', ide) |
| 152 | + mkdir(project_temp) |
148 | 153 | lib_symbols = [] |
149 | 154 | if options.macros: |
150 | 155 | lib_symbols += options.macros |
|
204 | 209 | setup_user_prj(project_dir, test.source_dir, test.dependencies) |
205 | 210 |
|
206 | 211 | # Export to selected toolchain |
207 | | - tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir, project_temp, clean=clean, zip=zip, extra_symbols=lib_symbols) |
| 212 | + tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir, project_temp, clean=clean, zip=zip, extra_symbols=lib_symbols, relative=sources_relative) |
208 | 213 | print tmp_path |
209 | 214 | if report['success']: |
210 | 215 | zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu)) |
|
0 commit comments