Skip to content

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

Merged
merged 12 commits into from
Jan 22, 2018
Merged

Exporter for Netbeans GCC_ARM #5532

merged 12 commits into from
Jan 22, 2018

Conversation

cmens23
Copy link

@cmens23 cmens23 commented Nov 20, 2017

Description

Added a Netbeans Exporter which creates following items:

  • nbproject Directory
  • nbproject/configurations.xml
  • nbproject/project.xml
  • ./.mbedignore (which contains the nbproject Folder)
  • ./Makefile (Netbeans Makefile)

Status

READY

  • Linking works and is using the Linker Script
  • Code Assistance works with one exclusion in mbed-os/rtos/TARGET_CORTEX/rtx5/core_cm.h -> Line 57: #error "Unknown ARM Architecture!"

Migrations

File __init__.py in mbed-os\tools\export is modified and has a new configuration:

  • netbeans

Related PRs

NONE

Todos

  • Tests
  • Documentation

Deploy notes

NONE

Steps to test or reproduce

Execute following command to get a Netbeans Project:
mbed-cli export -i netbeans

@cmens23 cmens23 changed the title Exporter for Netbeans Exporter for Netbeans GCC_ARM Nov 24, 2017
Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit.

@@ -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
Copy link
Contributor

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?

Copy link
Author

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?

Copy link
Contributor

@theotherjimmy theotherjimmy Nov 28, 2017

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:])

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed!

@theotherjimmy
Copy link
Contributor

@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?

Copy link
Contributor

@theotherjimmy theotherjimmy left a 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):
Copy link
Contributor

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?

Copy link
Author

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

def generate(self):
"""Generate Makefile, configurations.xml & project.xml Netbeans project file
"""
# super(Netbeans, self).generate()
Copy link
Contributor

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


# profile_names = [basename(fn).replace(".json", "")
# for fn in file_names]
# print profile_names
Copy link
Contributor

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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

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 != '':
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed!

@theotherjimmy
Copy link
Contributor

@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.

@adbridge
Copy link
Contributor

@theotherjimmy Are you happy with the rework ?

@mbed-ci
Copy link

mbed-ci commented Dec 29, 2017

Automatic CI verification build not done, please verify manually.

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')]
Copy link
Contributor

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.

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:] +
Copy link
Contributor

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.

@cmonr
Copy link
Contributor

cmonr commented Jan 12, 2018

@theotherjimmy Thoughts on the latest commits?

Copy link
Contributor

@theotherjimmy theotherjimmy left a 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.

@theotherjimmy
Copy link
Contributor

@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.

@cmonr
Copy link
Contributor

cmonr commented Jan 12, 2018

/morph build

1 similar comment
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

Build : SUCCESS

Build number : 862
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5532/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

@MikeDK
Copy link
Contributor

MikeDK commented Jan 15, 2018

@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 :(

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

Build : SUCCESS

Build number : 868
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5532/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

@mbed-ci
Copy link

mbed-ci commented Jan 15, 2018

@cmonr cmonr merged commit c2784c8 into ARMmbed:master Jan 22, 2018
@cmonr cmonr removed the needs: CI label Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants