Skip to content

Fix for projects exported as a zip file (affects online compiler) #9967

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 8 commits into from
Apr 9, 2019

Conversation

bridadan
Copy link
Contributor

@bridadan bridadan commented Mar 6, 2019

Description

This is a follow up to #9947 in an attempt to fix #8411.

Currently depends on #9995 and #9964.

NOTE I do not have a vscode environment to test these changes, however I can see the .vscode directory is now being included correctly.

@janjongboom may have an interest in testing this as well.

To test this, you'll need to run the following command in an mbed-os project:

mbed export -m <target> -i vscode_gcc_arm -z

(The -z is so the project will be zipped up)

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@naveenkaje
@theotherjimmy (there was also an issue when Makefiles were zipped up, perhaps you can double check my resources change)

Release Notes

@ciarmcom
Copy link
Member

ciarmcom commented Mar 7, 2019

@bridadan, thank you for your changes.
@theotherjimmy @naveenkaje @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

@theotherjimmy
Copy link
Contributor

@bridadan Unless I'm mistaken, I think that the conditional exporting was a good thing, at least offline.

@bridadan
Copy link
Contributor Author

bridadan commented Mar 7, 2019

@theotherjimmy was the idea there that you wouldn't blow away your new configuration if you re-export?

The trouble there is if you re-zip and the files are present, then they will not be re-generated and therefore not re-zipped. Perhaps if you supply "export to a zip", it can always re-generate or something?

@bridadan
Copy link
Contributor Author

bridadan commented Mar 7, 2019

Oh dear I seem to have broken many a tools test.

@bridadan bridadan force-pushed the fix_vscode_makefile_zip branch from 811baaa to 3245192 Compare March 7, 2019 23:47
parent_name_parts = components[:n]
if into_path:
parent_name_parts.insert(0, into_path)
parent_name = self._sep.join(parent_name_parts)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@theotherjimmy I believe this is the correct fix (see my commit message). If you have any concerns about this let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're correct. That's the fix.

@bridadan
Copy link
Contributor Author

bridadan commented Mar 8, 2019

Also added dependency on #9995, though its not critical for this PR, just for my own testing of this PR. If ed2c2f5 needs to be kicked out just let me know.

@bridadan bridadan force-pushed the fix_vscode_makefile_zip branch from 3245192 to a86b4b9 Compare March 8, 2019 17:15
@bridadan
Copy link
Contributor Author

bridadan commented Mar 8, 2019

@theotherjimmy I've removed the commit that enabled unconditional generation of vscode files to ensure we don't wipe out any user-made changes. If we'd like to revisit that behavior in the future, we should probably do it for all exporters at the same time.

@ARMmbed/mbed-os-maintainers I'm done with my changes pending any other comments.

@@ -29,6 +29,7 @@
from copy import copy
from yaml import dump_all
import argparse
from past.builtins import basestring
Copy link
Contributor

Choose a reason for hiding this comment

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

is basestring being used? if so, please ignore this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't ignore your comments 😄 Yeah its used later in the file.

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2019

Note: Still waiting on #9995

bridadan added 8 commits April 8, 2019 13:07
The FileRefs allow you to preserve the correct file paths in the online
compiler. It also allows you to preserve the correct file paths for
generated files.
This file was being dumped to the filesystem without going through the
"gen_file" mechanism, thus it was missed when being zipped up.
When zipping up projects, the makefile exporter brings every directory
supplied as --source under the same directory, even if they are in a
parent directory. There was some code that was clearing the leading
"../" components. This lead to an empty string ("") being supplied to
the "into_path" arg for "resources.add_directory". Since "" is not None,
the default behavior to place it in the same directory was not being
used. The extra "" caused a leading "/" to be added, making everything
placed a the absolute root of the filesystem ("/").

Now we check to see if the "into_path" is an empty string and ignore it
if that's the case.
@bridadan bridadan force-pushed the fix_vscode_makefile_zip branch from a86b4b9 to 60910c0 Compare April 8, 2019 18:08
@bridadan
Copy link
Contributor Author

bridadan commented Apr 8, 2019

Rebased!

@bridadan
Copy link
Contributor Author

bridadan commented Apr 8, 2019

Also #9995 was merged some time ago.

@bridadan bridadan changed the title Fix for vscode export when zipped Fix for projects exported as a zip file (affects online compiler) Apr 8, 2019
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 9, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Apr 9, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@cmonr cmonr merged commit fba8156 into ARMmbed:master Apr 9, 2019
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.

VSCode exporter with zip option: .vscode directory not included in zipfile
7 participants