예제 #1
0
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):
    """Do an export of a project.

    Positional arguments:
    target - MCU that the project will compile for
    ide - the IDE or project structure to export to

    Keyword arguments:
    build - to use the compiled mbed libraries or not
    src - directory or directories that contain the source to export
    macros - extra macros to add to the project
    project_id - the name of the project
    clean - start from a clean state before exporting
    zip_proj - create a zip file or not

    Returns an object of type Exporter (tools/exports/exporters.py)
    """
    project_dir, name, src, lib = setup_project(ide, target, program=project_id,
                                                source_dir=src, build=build, export_path=export_path)

    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)
예제 #2
0
def export(target, ide, build=None, src=None, macros=None, project_id=None,
           zip_proj=False, build_profile=None, export_path=None, silent=False):
    """Do an export of a project.

    Positional arguments:
    target - MCU that the project will compile for
    ide - the IDE or project structure to export to

    Keyword arguments:
    build - to use the compiled mbed libraries or not
    src - directory or directories that contain the source to export
    macros - extra macros to add to the project
    project_id - the name of the project
    clean - start from a clean state before exporting
    zip_proj - create a zip file or not

    Returns an object of type Exporter (tools/exports/exporters.py)
    """
    project_dir, name, src, lib = setup_project(ide, target, program=project_id,
                                                source_dir=src, build=build, export_path=export_path)

    zip_name = name+".zip" if zip_proj else None

    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)
예제 #3
0
    def generate_and_build(self, clean=False):
        """
        Generate the project file and build the project
        Args:
            clean: a boolean value determining whether to remove the
                   created project files

        Returns:
            successes: a list of strings that contain the mcu, ide, test
                       properties of a successful build test
            skips: a list of strings that contain the mcu, ide, test properties
                   of a skipped test (if the ide does not support mcu)
            failures: a list of strings that contain the mcu, ide, test
                       properties of a failed build test

        """
        successes = []
        failures = []
        skips = []
        for mcu, ide in self.mcu_ide_pairs:
            for test in self.tests:
                export_location, name, src, lib = setup_project(ide,
                                                                mcu,
                                                                program=test)
                test_name = Test(test).id
                try:
                    exporter = export_project(src,
                                              export_location,
                                              mcu,
                                              ide,
                                              clean=clean,
                                              name=name,
                                              libraries_paths=lib)
                    exporter.progen_build()
                    successes.append("%s::%s\t%s" % (mcu, ide, test_name))
                except FailedBuildException:
                    failures.append("%s::%s\t%s" % (mcu, ide, test_name))
                except TargetNotSupportedException:
                    skips.append("%s::%s\t%s" % (mcu, ide, test_name))

                ProgenBuildTest.handle_log_files(export_location, ide, name)
                if clean:
                    shutil.rmtree(export_location, ignore_errors=True)
        return successes, failures, skips