mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #3486 from theotherjimmy/clean-export-fix
Move clean functionality out of the export apipull/3490/head
commit
cb39663b2a
|
@ -11,6 +11,7 @@ from argparse import ArgumentParser
|
|||
from os.path import normpath, realpath
|
||||
|
||||
from tools.paths import EXPORT_DIR, MBED_HAL, MBED_LIBRARIES, MBED_TARGETS_PATH
|
||||
from tools.settings import BUILD_DIR
|
||||
from tools.export import EXPORTERS, mcu_ide_matrix
|
||||
from tools.tests import TESTS, TEST_MAP
|
||||
from tools.tests import test_known, test_name_known, Test
|
||||
|
@ -66,8 +67,7 @@ def setup_project(ide, target, program=None, source_dir=None, build=None, export
|
|||
|
||||
|
||||
def export(target, ide, build=None, src=None, macros=None, project_id=None,
|
||||
clean=False, zip_proj=False, build_profile=None, export_path=None,
|
||||
silent=False):
|
||||
zip_proj=False, build_profile=None, export_path=None, silent=False):
|
||||
"""Do an export of a project.
|
||||
|
||||
Positional arguments:
|
||||
|
@ -89,9 +89,9 @@ def export(target, ide, build=None, src=None, macros=None, project_id=None,
|
|||
|
||||
zip_name = name+".zip" if zip_proj else None
|
||||
|
||||
return export_project(src, project_dir, target, ide, clean=clean, name=name,
|
||||
macros=macros, libraries_paths=lib, zip_proj=zip_name,
|
||||
build_profile=build_profile, silent=silent)
|
||||
return export_project(src, project_dir, target, ide, name=name,
|
||||
macros=macros, libraries_paths=lib, zip_proj=zip_name,
|
||||
build_profile=build_profile, silent=silent)
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -238,10 +238,12 @@ def main():
|
|||
if options.mcu not in exporter.TARGETS:
|
||||
args_error(parser, "%s not supported by %s"%(options.mcu,options.ide))
|
||||
profile = extract_profile(parser, options, toolchain_name)
|
||||
if options.clean:
|
||||
rmtree(BUILD_DIR)
|
||||
export(options.mcu, options.ide, build=options.build,
|
||||
src=options.source_dir, macros=options.macros,
|
||||
project_id=options.program, clean=options.clean,
|
||||
zip_proj=zip_proj, build_profile=profile)
|
||||
project_id=options.program, zip_proj=zip_proj,
|
||||
build_profile=profile)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -134,11 +134,10 @@ def zip_export(file_name, prefix, resources, project_files, inc_repos):
|
|||
|
||||
|
||||
|
||||
def export_project(src_paths, export_path, target, ide,
|
||||
libraries_paths=None, linker_script=None, clean=False,
|
||||
notify=None, verbose=False, name=None, inc_dirs=None,
|
||||
jobs=1, silent=False, extra_verbose=False, config=None,
|
||||
macros=None, zip_proj=None, inc_repos=False,
|
||||
def export_project(src_paths, export_path, target, ide, libraries_paths=None,
|
||||
linker_script=None, notify=None, verbose=False, name=None,
|
||||
inc_dirs=None, jobs=1, silent=False, extra_verbose=False,
|
||||
config=None, macros=None, zip_proj=None, inc_repos=False,
|
||||
build_profile=None):
|
||||
"""Generates a project file and creates a zip archive if specified
|
||||
|
||||
|
@ -151,7 +150,6 @@ def export_project(src_paths, export_path, target, ide,
|
|||
Keyword Arguments:
|
||||
libraries_paths - paths to additional libraries
|
||||
linker_script - path to the linker script for the specified target
|
||||
clean - removes the export_path if it exists
|
||||
notify - function is passed all events, and expected to handle notification
|
||||
of the user, emit the events to a log, etc.
|
||||
verbose - assigns the notify function to toolchains print_notify_verbose
|
||||
|
@ -183,19 +181,16 @@ def export_project(src_paths, export_path, target, ide,
|
|||
src_paths = {"": paths}
|
||||
|
||||
# Export Directory
|
||||
if exists(export_path) and clean:
|
||||
rmtree(export_path)
|
||||
if not exists(export_path):
|
||||
makedirs(export_path)
|
||||
|
||||
_, toolchain_name = get_exporter_toolchain(ide)
|
||||
|
||||
# Pass all params to the unified prepare_resources()
|
||||
toolchain = prepare_toolchain(paths, target, toolchain_name,
|
||||
macros=macros, clean=clean, jobs=jobs,
|
||||
notify=notify, silent=silent, verbose=verbose,
|
||||
extra_verbose=extra_verbose, config=config,
|
||||
build_profile=build_profile)
|
||||
toolchain = prepare_toolchain(paths, target, toolchain_name, macros=macros,
|
||||
jobs=jobs, notify=notify, silent=silent,
|
||||
verbose=verbose, extra_verbose=extra_verbose,
|
||||
config=config, build_profile=build_profile)
|
||||
# The first path will give the name to the library
|
||||
if name is None:
|
||||
name = basename(normpath(abspath(src_paths[0])))
|
||||
|
|
Loading…
Reference in New Issue