mirror of https://github.com/ARMmbed/mbed-os.git
Remove progen and progen def dependencies.
parent
fdd7820832
commit
db696f8f4a
|
@ -3,8 +3,6 @@ PySerial>=2.7
|
||||||
PrettyTable>=0.7.2
|
PrettyTable>=0.7.2
|
||||||
Jinja2>=2.7.3
|
Jinja2>=2.7.3
|
||||||
IntelHex>=1.3
|
IntelHex>=1.3
|
||||||
project-generator==0.9.10
|
|
||||||
project_generator_definitions>=0.2.26,<0.3.0
|
|
||||||
junit-xml
|
junit-xml
|
||||||
pyYAML
|
pyYAML
|
||||||
requests
|
requests
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import os, tempfile
|
|
||||||
from os.path import join, exists, basename
|
|
||||||
from shutil import copytree, rmtree, copy
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
from tools.export import codered, ds5_5, iar, makefile
|
from tools.export import codered, ds5_5, iar, makefile
|
||||||
from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
|
from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
|
||||||
|
|
|
@ -9,10 +9,6 @@ from jinja2.environment import Environment
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from tools.targets import TARGET_MAP
|
from tools.targets import TARGET_MAP
|
||||||
from project_generator.tools import tool
|
|
||||||
from project_generator.tools_supported import ToolsSupported
|
|
||||||
from project_generator.settings import ProjectSettings
|
|
||||||
from project_generator_definitions.definitions import ProGenDef
|
|
||||||
|
|
||||||
|
|
||||||
class OldLibrariesException(Exception):
|
class OldLibrariesException(Exception):
|
||||||
|
@ -123,95 +119,11 @@ class Exporter(object):
|
||||||
source_files.extend(getattr(self.resources, key))
|
source_files.extend(getattr(self.resources, key))
|
||||||
return list(set([os.path.dirname(src) for src in source_files]))
|
return list(set([os.path.dirname(src) for src in source_files]))
|
||||||
|
|
||||||
def progen_get_project_data(self):
|
|
||||||
""" Get ProGen project data """
|
|
||||||
# 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))
|
|
||||||
if not key or relpath(key, self.export_dir) == '.':
|
|
||||||
key = self.project_name
|
|
||||||
return key
|
|
||||||
|
|
||||||
def grouped(sources):
|
|
||||||
"""Group the source files by their encompassing directory"""
|
|
||||||
data = sorted(sources, key=make_key)
|
|
||||||
return {k: list(g) for k, g in groupby(data, make_key)}
|
|
||||||
|
|
||||||
if self.toolchain.get_config_header():
|
|
||||||
config_header = self.toolchain.get_config_header()
|
|
||||||
config_header = relpath(config_header,
|
|
||||||
self.resources.file_basepath[config_header])
|
|
||||||
else:
|
|
||||||
config_header = None
|
|
||||||
|
|
||||||
# we want to add this to our include dirs
|
|
||||||
config_dir = os.path.dirname(config_header) if config_header else []
|
|
||||||
|
|
||||||
project_data = tool.get_tool_template()
|
|
||||||
|
|
||||||
project_data['target'] = TARGET_MAP[self.target].progen['target']
|
|
||||||
project_data['source_paths'] = self.get_source_paths()
|
|
||||||
project_data['include_paths'] = self.resources.inc_dirs + [config_dir]
|
|
||||||
project_data['include_files'] = grouped(self.resources.headers)
|
|
||||||
project_data['source_files_s'] = grouped(self.resources.s_sources)
|
|
||||||
project_data['source_files_c'] = grouped(self.resources.c_sources)
|
|
||||||
project_data['source_files_cpp'] = grouped(self.resources.cpp_sources)
|
|
||||||
project_data['source_files_obj'] = grouped(self.resources.objects)
|
|
||||||
project_data['source_files_lib'] = grouped(self.resources.libraries)
|
|
||||||
project_data['output_dir']['path'] = self.export_dir
|
|
||||||
project_data['linker_file'] = self.resources.linker_script
|
|
||||||
project_data['macros'] = []
|
|
||||||
project_data['build_dir'] = 'build'
|
|
||||||
project_data['template'] = None
|
|
||||||
project_data['name'] = self.project_name
|
|
||||||
project_data['output_type'] = 'exe'
|
|
||||||
project_data['debugger'] = None
|
|
||||||
return project_data
|
|
||||||
|
|
||||||
def progen_gen_file(self, project_data):
|
|
||||||
""" Generate project using ProGen Project API
|
|
||||||
Positional arguments:
|
|
||||||
tool_name - the tool for which to generate project files
|
|
||||||
project_data - a dict whose base key, values are specified in
|
|
||||||
progen_get_project_data, the items will have been
|
|
||||||
modified by Exporter subclasses
|
|
||||||
|
|
||||||
Keyword arguments:
|
|
||||||
progen_build - A boolean that determines if the tool will build the
|
|
||||||
project
|
|
||||||
"""
|
|
||||||
if not self.check_supported(self.NAME):
|
|
||||||
raise TargetNotSupportedException("Target not supported")
|
|
||||||
settings = ProjectSettings()
|
|
||||||
exporter = ToolsSupported().get_tool(self.NAME)
|
|
||||||
self.builder_files_dict = {self.NAME:exporter(project_data, settings).export_project()}
|
|
||||||
for middle in self.builder_files_dict.values():
|
|
||||||
for field, thing in middle.iteritems():
|
|
||||||
if field == "files":
|
|
||||||
for filename in thing.values():
|
|
||||||
self.generated_files.append(filename)
|
|
||||||
|
|
||||||
def progen_build(self):
|
|
||||||
"""Build a project that was already generated by progen"""
|
|
||||||
builder = ToolsSupported().get_tool(self.NAME)
|
|
||||||
result = builder(self.builder_files_dict[self.NAME], ProjectSettings()).build_project()
|
|
||||||
if result == -1:
|
|
||||||
raise FailedBuildException("Build Failed")
|
|
||||||
|
|
||||||
def check_supported(self, ide):
|
def check_supported(self, ide):
|
||||||
"""Indicated if this combination of IDE and MCU is supported"""
|
"""Indicated if this combination of IDE and MCU is supported"""
|
||||||
if self.target not in self.TARGETS or \
|
if self.target not in self.TARGETS or \
|
||||||
self.TOOLCHAIN not in TARGET_MAP[self.target].supported_toolchains:
|
self.TOOLCHAIN not in TARGET_MAP[self.target].supported_toolchains:
|
||||||
return False
|
return False
|
||||||
if not ProGenDef(ide).is_supported(
|
|
||||||
TARGET_MAP[self.target].progen['target']):
|
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def gen_file(self, template_file, data, target_file):
|
def gen_file(self, template_file, data, target_file):
|
||||||
|
|
Loading…
Reference in New Issue