mirror of https://github.com/ARMmbed/mbed-os.git
Move all generated file paths to FileRefs in the exporters.
The FileRefs allow you to preserve the correct file paths in the online compiler. It also allows you to preserve the correct file paths for generated files.pull/9967/head
parent
e239549585
commit
3b4a463dce
|
@ -164,7 +164,7 @@ def _inner_zip_export(resources, prj_files, inc_repos):
|
|||
to_zip = sum((resources.get_file_refs(ftype) for ftype
|
||||
in Resources.ALL_FILE_TYPES),
|
||||
[])
|
||||
to_zip.extend(FileRef(basename(pfile), pfile) for pfile in prj_files)
|
||||
to_zip.extend(prj_files)
|
||||
for dest, source in resources.get_file_refs(FileType.BLD_REF):
|
||||
target_dir, _ = splitext(dest)
|
||||
dest = join(target_dir, ".bld", "bldrc")
|
||||
|
|
|
@ -27,7 +27,7 @@ import copy
|
|||
|
||||
from tools.targets import TARGET_MAP
|
||||
from tools.utils import mkdir
|
||||
from tools.resources import FileType
|
||||
from tools.resources import FileType, FileRef
|
||||
|
||||
"""Just a template for subclassing"""
|
||||
|
||||
|
@ -95,9 +95,17 @@ class Exporter(object):
|
|||
resources.win_to_unix()
|
||||
self.resources = resources
|
||||
self.generated_files = []
|
||||
getting_started_name = "GettingStarted.html"
|
||||
dot_mbed_name = ".mbed"
|
||||
self.static_files = (
|
||||
join(self.TEMPLATE_DIR, "GettingStarted.html"),
|
||||
join(self.TEMPLATE_DIR, ".mbed"),
|
||||
FileRef(
|
||||
getting_started_name,
|
||||
join(self.TEMPLATE_DIR, getting_started_name)
|
||||
),
|
||||
FileRef(
|
||||
dot_mbed_name,
|
||||
join(self.TEMPLATE_DIR, dot_mbed_name)
|
||||
),
|
||||
)
|
||||
self.builder_files_dict = {}
|
||||
self.add_config()
|
||||
|
@ -204,7 +212,7 @@ class Exporter(object):
|
|||
mkdir(dirname(target_path))
|
||||
logging.debug("Generating: %s", target_path)
|
||||
open(target_path, "w").write(target_text)
|
||||
self.generated_files += [target_path]
|
||||
self.generated_files += [FileRef(target_file, target_path)]
|
||||
|
||||
def gen_file_nonoverwrite(self, template_file, data, target_file, **kwargs):
|
||||
"""Generates or selectively appends a project file from a template"""
|
||||
|
@ -221,7 +229,7 @@ class Exporter(object):
|
|||
else:
|
||||
logging.debug("Generating: %s", target_path)
|
||||
open(target_path, "w").write(target_text)
|
||||
self.generated_files += [target_path]
|
||||
self.generated_files += [FileRef(template_file, target_path)]
|
||||
|
||||
def _gen_file_inner(self, template_file, data, target_file, **kwargs):
|
||||
"""Generates a project file from a template using jinja"""
|
||||
|
@ -237,7 +245,7 @@ class Exporter(object):
|
|||
target_path = join(self.export_dir, target_file)
|
||||
logging.debug("Generating: %s", target_path)
|
||||
open(target_path, "w").write(target_text)
|
||||
self.generated_files += [target_path]
|
||||
self.generated_files += [FileRef(target_file, target_path)]
|
||||
|
||||
def make_key(self, src):
|
||||
"""From a source file, extract group name
|
||||
|
|
Loading…
Reference in New Issue