Add simple ZIP exporter for the mbed Online IDE

pull/917/head
Mihail Stoyanov 2015-02-13 22:01:24 +02:00
parent fba1390241
commit 4585f8aa11
3 changed files with 55 additions and 8 deletions

View File

@ -19,7 +19,7 @@ from os.path import join, exists, basename
from shutil import copytree, rmtree
from workspace_tools.utils import mkdir
from workspace_tools.export import uvision4, codesourcery, codered, gccarm, ds5_5, iar, emblocks, coide, kds
from workspace_tools.export import uvision4, codesourcery, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip
from workspace_tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException
from workspace_tools.targets import TARGET_NAMES, EXPORT_MAP
@ -58,14 +58,17 @@ def export(project_path, project_name, ide, target, destination='/tmp/',
if tempdir is None:
tempdir = tempfile.mkdtemp()
if ide is None:
# Simply copy everything, no project files to be generated
for d in ['src', 'lib']:
os.system("cp -r %s/* %s" % (join(project_path, d), tempdir))
report = {'success': True}
report = {'success': False}
if ide is None or ide == "zip":
# Simple ZIP exporter
try:
exporter = zip.ZIP(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols)
exporter.scan_and_copy_resources(project_path, tempdir)
exporter.generate()
report['success'] = True
except OldLibrariesException, e:
report['errormsg'] = ERROR_MESSAGE_NOT_EXPORT_LIBS
else:
report = {'success': False}
if ide not in EXPORTERS:
report['errormsg'] = "Unsupported toolchain"
else:

View File

@ -0,0 +1,41 @@
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from exporters import Exporter
from os.path import basename
class ZIP(Exporter):
NAME = 'ZIP'
TARGETS = [
]
USING_MICROLIB = [
]
FILE_TYPES = {
'c_sources':'1',
'cpp_sources':'8',
's_sources':'2'
}
def get_toolchain(self):
return 'uARM' if (self.target in self.USING_MICROLIB) else 'ARM'
def generate(self):
return True

View File

@ -76,6 +76,8 @@ if __name__ == '__main__':
setup_test_user_prj()
for toolchain, target in [
('zip', 'LPC1768'),
('emblocks', 'LPC1768'),
('emblocks', 'LPC1549'),
('emblocks', 'LPC1114'),
@ -189,6 +191,7 @@ if __name__ == '__main__':
('iar', 'MTS_MDOT_F405RG'),
('iar', 'MTS_MDOT_F411RE'),
(None, None),
]:
print '\n=== Exporting to "%s::%s" ===' % (toolchain, target)