-
Notifications
You must be signed in to change notification settings - Fork 3k
Exporter for Netbeans GCC_ARM #5532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e linking still not works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit.
tools/export/nb/__init__.py
Outdated
@@ -207,11 +211,19 @@ def create_jinja_ctx(self): | |||
sources = [self.filter_dot(field) for field in sources] | |||
include_paths = [self.filter_dot(field) for field in self.resources.inc_dirs] | |||
|
|||
sys_libs = [self.prepare_sys_lib(lib) for lib | |||
in self.toolchain.sys_libs] | |||
preproc = " ".join([part for part |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this list comprehension. Could you remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand. Could you please more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preproc = " ".join([part for part
in ([basename(self.toolchain.preproc[0])] +
self.toolchain.preproc[1:] +
self.toolchain.ld[1:])])
==
preproc = " ".join([basename(self.toolchain.preproc[0])] +
self.toolchain.preproc[1:] +
self.toolchain.ld[1:])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed!
@cmens23 Why did you add your own Makefile exporter? could you have imported a Makefile exporter from the makefile module and inherited from that instead? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More nits. I apparently only reviewed the last commit last time. huh.
def prepare_sys_lib(libname): | ||
return "-l" + libname | ||
|
||
def toolchain_flags(self, toolchain): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as the Exporter.flags
attribute. Is there some reason that you could not use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I just done this, because in 'tools/exporter/gnuarmeclipse/__init.py' it is the same: https://github.com/cmens23/mbed-os/blob/e423947af35a024abdf12cdadce077810cf52398/tools/export/gnuarmeclipse/__init__.py#L78
tools/export/nb/__init__.py
Outdated
def generate(self): | ||
"""Generate Makefile, configurations.xml & project.xml Netbeans project file | ||
""" | ||
# super(Netbeans, self).generate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove this commented out code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
tools/export/nb/__init__.py
Outdated
|
||
# profile_names = [basename(fn).replace(".json", "") | ||
# for fn in file_names] | ||
# print profile_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove commented out code? (5 lines)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
tools/export/nb/__init__.py
Outdated
prev_dir = cur_dir | ||
output.append('<itemPath>' + str(item) + '</itemPath>') | ||
# if last iteration close all open tags | ||
if idx == len(file_list) - 1 and cur_dir != '': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a refactor proposal:
Remove the enumerate
from the loop, move dir_depth
out of the loop and close all open tags after the loop. I think that may make for clearer code. For example:
for item in file_list:
...
last_dir_len = len(os.path.dirname(file_list[-1]).split(os.path.sep))
output.append('</logicalFolder>' * last_dir_len)
return output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed!
@cmens23 I'm excited to see net beans become an Mbed OS exporter! Please let me know if I can help with the porting effort. |
@theotherjimmy Are you happy with the rework ? |
Automatic CI verification build not done, please verify manually. |
tools/export/nb/__init__.py
Outdated
c_sources = [self.filter_dot(field) for field in getattr(self.resources, 'c_sources')] | ||
cpp_sources = [self.filter_dot(field) for field in getattr(self.resources, 'cpp_sources')] | ||
s_sources = [self.filter_dot(field) for field in getattr(self.resources, 's_sources')] | ||
headers = [self.filter_dot(field) for field in getattr(self.resources, 'headers')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use getattr
when you don't need to. It can make the code much harder to follow. This applies to the preceding 4 lines.
tools/export/nb/__init__.py
Outdated
sys_libs = [self.prepare_sys_lib(lib) for lib | ||
in self.toolchain.sys_libs] | ||
preproc = " ".join([basename(self.toolchain.preproc[0])] + | ||
self.toolchain.preproc[1:] + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indentation looks off. I think the s
in self
should line up with the [
in the previous line.
@theotherjimmy Thoughts on the latest commits? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the exporter.
@cmens23 If there is a method to build an exported project from the command line, we can put this in our CI to prevent subsequent PRs from breaking this exporter. |
/morph build |
1 similar comment
/morph build |
Build : SUCCESSBuild number : 862 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 533 |
@theotherjimmy regarding your question about a method to build from command line...: unfortunately, the needed sub-makefiles are only generated if one starts a build from within the netbeans IDE at least once. From this time on, the sub-makefiles are present in the nbproject directory, and one can issue a simple "make" from the project root. In MPLAB-X, which is basically a microchip-specific fork of netbeans, there is a .jar file which does exactly what we would need: generate the sub-makefiles from the command line ... but unfortunately this looks like something microchip did only for their MPLAB-X IDE ... I cannot find similar tool in vanilla netbeans :( |
Test : SUCCESSBuild number : 708 |
/morph build |
Build : SUCCESSBuild number : 868 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 540 |
Test : SUCCESSBuild number : 716 |
Description
Added a Netbeans Exporter which creates following items:
nbproject
Directorynbproject/configurations.xml
nbproject/project.xml
./.mbedignore
(which contains the nbproject Folder)./Makefile
(Netbeans Makefile)Status
READY
mbed-os/rtos/TARGET_CORTEX/rtx5/core_cm.h
-> Line 57: #error "Unknown ARM Architecture!"Migrations
File
__init__.py
inmbed-os\tools\export
is modified and has a new configuration:Related PRs
NONE
Todos
Deploy notes
NONE
Steps to test or reproduce
Execute following command to get a Netbeans Project:
mbed-cli export -i netbeans