Skip to content

Commit 5800af1

Browse files
committed
Exporters - add source_relative flag
if we work with relative sources, the flag should be set to True, otherwise False. This fixes wrong paths when exporting with --source argument. The exporter would assume sources were copied, and thus reference them all within the root of the generated project.
1 parent 703aee4 commit 5800af1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tools/export/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def export(project_path, project_name, ide, target, destination='/tmp/',
101101
if supported:
102102
# target checked, export
103103
try:
104-
exporter = Exporter(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols)
104+
exporter = Exporter(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols, sources_relative=relative)
105105
exporter.scan_and_copy_resources(project_path, tempdir, relative)
106106
exporter.generate()
107107
report['success'] = True

tools/export/exporters.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Exporter(object):
2525
TEMPLATE_DIR = dirname(__file__)
2626
DOT_IN_RELATIVE_PATH = False
2727

28-
def __init__(self, target, inputDir, program_name, build_url_resolver, extra_symbols=None):
28+
def __init__(self, target, inputDir, program_name, build_url_resolver, extra_symbols=None, sources_relative=True):
2929
self.inputDir = inputDir
3030
self.target = target
3131
self.program_name = program_name
@@ -35,6 +35,7 @@ def __init__(self, target, inputDir, program_name, build_url_resolver, extra_sym
3535
self.jinja_environment = Environment(loader=jinja_loader)
3636
self.extra_symbols = extra_symbols
3737
self.config_macros = []
38+
self.sources_relative = sources_relative
3839

3940
def get_toolchain(self):
4041
return self.TOOLCHAIN
@@ -109,7 +110,7 @@ def progen_gen_file(self, tool_name, project_data):
109110
# TODO: Fix this, the inc_dirs are not valid (our scripts copy files), therefore progen
110111
# thinks it is not dict but a file, and adds them to workspace.
111112
project.project['common']['include_paths'] = self.resources.inc_dirs
112-
project.generate(tool_name, copied=True)
113+
project.generate(tool_name, copied=not self.sources_relative)
113114

114115
def __scan_all(self, path):
115116
resources = []

0 commit comments

Comments
 (0)