Skip to content

Ensure that no spurious file is added to AdditionalFiles #299

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

facchinm
Copy link
Member

@facchinm facchinm commented Oct 5, 2018

If the build is executed "in place" (inside the sketch folder) intermediate cpp files were added to the AdditionaFiles list.
This was solved (badly) in 849faa1#diff-b54df391d234f64238253f1d968e2e39R89 .

This patch fixes the issue by not including these files in the list in the first place, so we can avoid removing them later.

If the build is executed "in place" (inside the sketch folder) intermediate cpp files were added to the AdditionaFiles list.
This was solved (badly) in arduino@849faa1#diff-b54df391d234f64238253f1d968e2e39R89 .

This patch fixes the issue by not including these files in the list in the first place, so we can avoid removing them later.
additionalFiles = append(additionalFiles, sketchFile)
if !strings.Contains(filepath.Dir(sketchFile.Name), buildLocation) {
additionalFiles = append(additionalFiles, sketchFile)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is not necessary, as recursive compilation is already limited to the src/ subdirectory. Have you confirmed that this check ever returns false with a build dir inside the sketch dir?

Copy link
Member Author

Choose a reason for hiding this comment

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

I checked and if I only remove the other line all temporary cpp files get added top the list (even if not in src)

Copy link
Member Author

Choose a reason for hiding this comment

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

There's also a test that should not pass if files outside src were not added to the list (https://github.com/arduino/arduino-builder/blob/master/test/sketch_loader_test.go#L129) . Is it intended @cmaglie ?

Copy link
Member

Choose a reason for hiding this comment

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

If the test is there it probably means something. you should go back to the commit that added those lines and check why they have been added...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps there's a difference between the files that end up in the "additional files" list and the files that end up being compiled?

Copy link
Member

Choose a reason for hiding this comment

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

This is the commit that added the "extra" files to the test: 9d7d1d7

@ArduinoBot
Copy link
Contributor

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/arduino-builder/arduino-builder-299.zip

ℹ️ To test this build:

  1. Replace arduino-builder binary (you can find it where you installed the IDE) with the provided one

@facchinm
Copy link
Member Author

Merged manually

@facchinm facchinm closed this Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants