Skip to content
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

Resources: Avoid assuming that deps have a sane name #8696

Merged
merged 2 commits into from
Nov 14, 2018

Conversation

theotherjimmy
Copy link
Contributor

Description

The prior fix assume that the dependencies through .lib references
would have a "sane" name. My definition of "sane" here is that the
reference will have a path that starts with the path to the .lib file
and removes the .lib suffix. The online compiler does not remove the
.lib suffix. Instead, it keeps it. This makes the string replacement
in the prior PR fail.

Also, this is faster, and simpler.

Pull request type

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

### Description

The prior fix assume that the dependencies through `.lib` references
would have a "sane" name. My definition of "sane" here is that the
reference will have a path that starts with the path to the `.lib` file
and _removes_ the `.lib` suffix. The online compiler does not remove the
`.lib` suffix. Instead, it keeps it. This makes the string replacement
in the prior PR fail.

Also, this is faster, and simpler.

### Pull request type

    [x] Fix
    [ ] Refactor
    [ ] Target update
    [ ] Functionality change
    [ ] Docs update
    [ ] Test update
    [ ] Breaking change
@@ -254,35 +254,15 @@ def add_file_ref(self, file_type, file_name, file_path):
ref = FileRef(file_name.replace(sep, self._sep), file_path)
else:
ref = FileRef(file_name, file_path)
self._file_refs[file_type].add(ref)
if file_type:
self._file_refs[file_type].add(ref)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any purpose of constructing the FileRef if file_type is falsey? If not, you might consider moving the file_type check to the top, so something like this (I also suggested a few other changes/refactors, feel free to ignore them if they don't make sense):

def add_file_ref(self, file_type, file_name, file_path):
    if not file_type:
        return
    if sep != self._sep:
        file_name = file_name.replace(sep, self._sep)
    self._file_refs[file_type].add(FileRef(file_name, file_path))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is not. I'll update it in a bit.

Copy link
Contributor

@bridadan bridadan left a comment

Choose a reason for hiding this comment

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

Looks ok!

@cmonr
Copy link
Contributor

cmonr commented Nov 13, 2018

Fixes #8716

@cmonr
Copy link
Contributor

cmonr commented Nov 13, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 13, 2018

Build : SUCCESS

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

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Nov 14, 2018

@mbed-ci
Copy link

mbed-ci commented Nov 14, 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.

5 participants