Skip to content

Commit

Permalink
Merge pull request #2754 from sarahmarshy/release_targets
Browse files Browse the repository at this point in the history
New exporter build tests
  • Loading branch information
sg- authored Sep 22, 2016
2 parents c1c1492 + 16913b9 commit 667c171
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 115 deletions.
6 changes: 3 additions & 3 deletions tools/export/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def progen_get_project_data(self):
# provide default data, some tools don't require any additional
# tool specific settings

if not self.check_supported(self.NAME):
raise TargetNotSupportedException("Target not supported")

def make_key(src):
"""turn a source file into it's group name"""
key = os.path.basename(os.path.dirname(src))
Expand Down Expand Up @@ -186,9 +189,6 @@ def progen_gen_file(self, project_data):

def progen_build(self):
"""Build a project that was already generated by progen"""
print("Project {} exported, building for {}...".format(
self.project_name, self.NAME))
sys.stdout.flush()
builder = ToolsSupported().get_tool(self.NAME)
result = builder(self.builder_files_dict[self.NAME], ProjectSettings()).build_project()
if result == -1:
Expand Down
15 changes: 9 additions & 6 deletions tools/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from tools.project_api import export_project


def setup_project(ide, target, program=None, source_dir=None, build=None):
def setup_project(ide, target, program=None, source_dir=None, build=None, export_path=None):
"""Generate a name, if not provided, and find dependencies
Positional arguments:
Expand All @@ -39,7 +39,7 @@ def setup_project(ide, target, program=None, source_dir=None, build=None):
if source_dir:
# --source is used to generate IDE files to toolchain directly
# in the source tree and doesn't generate zip file
project_dir = source_dir[0]
project_dir = export_path or source_dir[0]
if program:
project_name = TESTS[program]
else:
Expand All @@ -63,7 +63,7 @@ def setup_project(ide, target, program=None, source_dir=None, build=None):


def export(target, ide, build=None, src=None, macros=None, project_id=None,
clean=False, zip_proj=False, options=None):
clean=False, zip_proj=False, options=None, export_path=None, silent=False):
"""Do an export of a project.
Positional arguments:
Expand All @@ -77,14 +77,17 @@ def export(target, ide, build=None, src=None, macros=None, project_id=None,
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)
source_dir=src, build=build, export_path=export_path)

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

export_project(src, project_dir, target, ide, clean=clean, name=name,
macros=macros, libraries_paths=lib, zip_proj=zip_name, options=options)
return export_project(src, project_dir, target, ide, clean=clean, name=name,
macros=macros, libraries_paths=lib, zip_proj=zip_name,
options=options, silent=silent)


def main():
Expand Down
Loading

0 comments on commit 667c171

Please sign in to comment.