mirror of https://github.com/ARMmbed/mbed-os.git
Only enable uvision postbuild when in a non-zipped exported project.
Projects that are zipped are typically from the online compiler or they are meant to be used in a separate environment. Since the postbuild script requires the Mbed OS tools to present in the project, we will disable the postbuild script when the project is exported to a zipped project.pull/10021/head
parent
bbef60fbf2
commit
fb6fcc5324
|
@ -136,7 +136,7 @@ def get_exporter_toolchain(ide):
|
|||
|
||||
|
||||
def generate_project_files(resources, export_path, target, name, toolchain, ide,
|
||||
macros=None):
|
||||
zip, macros=None):
|
||||
"""Generate the project files for a project
|
||||
|
||||
Positional arguments:
|
||||
|
@ -147,13 +147,14 @@ def generate_project_files(resources, export_path, target, name, toolchain, ide,
|
|||
toolchain - a toolchain class that corresponds to the toolchain used by the
|
||||
IDE or makefile
|
||||
ide - IDE name to export to
|
||||
zip - True if the exported project will be zipped
|
||||
|
||||
Optional arguments:
|
||||
macros - additional macros that should be defined within the exported
|
||||
project
|
||||
"""
|
||||
exporter_cls, _ = get_exporter_toolchain(ide)
|
||||
exporter = exporter_cls(target, export_path, name, toolchain,
|
||||
exporter = exporter_cls(target, export_path, name, toolchain, zip,
|
||||
extra_symbols=macros, resources=resources)
|
||||
exporter.generate()
|
||||
files = exporter.generated_files
|
||||
|
@ -278,9 +279,9 @@ def export_project(src_paths, export_path, target, ide, libraries_paths=None,
|
|||
if toolchain.config.name:
|
||||
name = toolchain.config.name
|
||||
|
||||
files, exporter = generate_project_files(resources, export_path,
|
||||
target, name, toolchain, ide,
|
||||
macros=macros)
|
||||
files, exporter = generate_project_files(
|
||||
resources, export_path, target, name, toolchain, ide, zip_proj, macros=macros
|
||||
)
|
||||
if zip_proj:
|
||||
resources.add_features(ALLOWED_FEATURES)
|
||||
if isinstance(zip_proj, basestring):
|
||||
|
|
|
@ -73,7 +73,7 @@ class Exporter(object):
|
|||
CLEAN_FILES = ("GettingStarted.html",)
|
||||
|
||||
|
||||
def __init__(self, target, export_dir, project_name, toolchain,
|
||||
def __init__(self, target, export_dir, project_name, toolchain, zip,
|
||||
extra_symbols=None, resources=None):
|
||||
"""Initialize an instance of class exporter
|
||||
Positional arguments:
|
||||
|
@ -81,6 +81,7 @@ class Exporter(object):
|
|||
export_dir - the directory of the exported project files
|
||||
project_name - the name of the project
|
||||
toolchain - an instance of class toolchain
|
||||
zip - True if the exported project will be zipped
|
||||
|
||||
Keyword arguments:
|
||||
extra_symbols - a list of extra macros for the toolchain
|
||||
|
@ -94,6 +95,7 @@ class Exporter(object):
|
|||
self.jinja_environment = Environment(loader=jinja_loader)
|
||||
resources.win_to_unix()
|
||||
self.resources = resources
|
||||
self.zip = zip
|
||||
self.generated_files = []
|
||||
getting_started_name = "GettingStarted.html"
|
||||
dot_mbed_name = ".mbed"
|
||||
|
|
|
@ -2,7 +2,7 @@ from __future__ import print_function, absolute_import
|
|||
from builtins import str
|
||||
|
||||
import os
|
||||
from os.path import normpath, exists, dirname, join, abspath
|
||||
from os.path import normpath, exists, dirname, join, abspath, relpath
|
||||
import ntpath
|
||||
import copy
|
||||
from collections import namedtuple
|
||||
|
@ -247,7 +247,7 @@ class Uvision(Exporter):
|
|||
'postbuild_step_active': 0,
|
||||
}
|
||||
|
||||
if self.toolchain.config.has_regions:
|
||||
if self.toolchain.config.has_regions and not self.zip:
|
||||
# Serialize region information
|
||||
export_info = {}
|
||||
restrict_size = getattr(self.toolchain.config.target, "restrict_size")
|
||||
|
@ -262,8 +262,9 @@ class Uvision(Exporter):
|
|||
r._replace(filename=binary_path) if r.active else r for r in region_list
|
||||
]
|
||||
# Enable the post build step
|
||||
postbuild_script_path = join(relpath(dirname(__file__)), "postbuild.py")
|
||||
ctx['postbuild_step'] = (
|
||||
'python mbed-os/tools/export/uvision/postbuild.py "$K\\" "#L"'
|
||||
'python {} "$K\\" "#L"'.format(postbuild_script_path)
|
||||
)
|
||||
ctx['postbuild_step_active'] = 1
|
||||
ctx['export_info'] = json.dumps(export_info, indent=4)
|
||||
|
|
Loading…
Reference in New Issue