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

scons launcher and scons dist don't rebuild #13372

Closed
mltony opened this issue Feb 21, 2022 · 6 comments · Fixed by #15877
Closed

scons launcher and scons dist don't rebuild #13372

mltony opened this issue Feb 21, 2022 · 6 comments · Fixed by #15877
Labels
audience/nvda-dev PR or issue is relevant to NVDA / Add-on developers component/build triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@mltony
Copy link
Contributor

mltony commented Feb 21, 2022

TL;DR

scons launcher or scons dist commands don't seem to be able to pick up code changes after first execution. In other words, they can build successfully for the first time, but they cannot rebuild as they don't appear to see that code has changed.
As to why this can be useful, in my example, I have NVDA build environment on my personal laptop, but I am trying to debug an issue with MS WOrd, which is only installed on my work laptop. I cannot build NVDA on work laptop, nor can I install MS Word on my personal laptop. As a result I need to frequently repeat the cycle of making code change, rebuild and test on work laptop.

Steps to reproduce:

The following steps use scons launcher command but all the same applies to scons dist as well.

  1. Get a fresh copy of NVDA:
> git clone --recursive https://github.com/nvaccess/nvda.git
> ...
> cd nvda
  1. Build launcher:
> scons launcher
... many lines of actual building process omitted
scons: done building targets.
  1. Check that launcher was built successfully:
> output\nvda_snapshot_source-master-6310b86.exe
  1. Adding the following lines in core.py in def main right before app.MainLoop():
import tones
tones.beep(1000, 1000)
  1. Running NVDA from source to make sure beep can be heard:
> runnvda.bat
  1. Rebuild launcher:
> scons launcher
...
scons: `launcher' is up to date.
scons: done building targets.
  1. It appears scons didn't see any changes and didn't do anything, but let's try to run launcher again to see whether the beep can be heard:
$ output\nvda_snapshot_source-master-6310b86.exe

Actual behavior:

scons launcher doesn't see code changes and does not rebuild after code change. After my attempt to rebuild, no beep is heard when launching launcher.

Expected behavior:

scons launcher should be able to see code changes and rebuild launcher with code changes. Beep should be heard when launching launcher.

System configuration

NVDA installed/portable/running from source:

Running from source

NVDA version:

Commit 6310b86

Windows version:

Windows 11

Name and version of other software in use when reproducing the issue:

N/A

Other information about your system:

N/A

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

No

If NVDA add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

N/A

@mltony
Copy link
Contributor Author

mltony commented Feb 21, 2022

In the end I found a workaround to this issue (thanks @josephsl for suggesting this in #10833):

  1. Commit changes to a local commit.
  2. Run:
scons --clean
git reset --hard
scons launcher

Still it would be great if scons could work without manually cleaning the whole repository.
cc: @lukaszgo1

@lukaszgo1
Copy link
Contributor

In fact it is unnecessary to clean the whole repository - you just need to delete the dist and output directories.

@mltony
Copy link
Contributor Author

mltony commented Feb 21, 2022 via email

@lukaszgo1
Copy link
Contributor

Nope, scons launcher fails after that.

It does not fail for me. What error you get?

@mltony
Copy link
Contributor Author

mltony commented Feb 26, 2022

@lukaszgo1, Actually you're right, it appears to work. I was sure I tried that before though but must be in combination with scons --clean that apparently broke the build. So that is a valid work around. I would keep this issue open though, since I would expect a build system to track file changes and not require manual cleanup.

@seanbudd seanbudd added the triaged Has been triaged, issue is waiting for implementation. label Feb 28, 2022
@seanbudd seanbudd added the audience/nvda-dev PR or issue is relevant to NVDA / Add-on developers label Feb 28, 2022
@hwf1324
Copy link
Contributor

hwf1324 commented Dec 4, 2023

I spent a whole day investigating this issue. I'm sorry, but I actually have very little knowledge about building systems, so I could only look through some official documentation to find possible solutions.

Below are some of my survey results:

In SCons, using the --tree parameter allows you to observe the reference to the dependency core.py.

But in the result of the --debug=prepare parameter, it is missing again.

I don't understand why SCons doesn't check for changes in these files, the scripts in this repo are too complex for me.

Finally, I submitted a PR #15877, using the AlwaysBuild function to force the dist to be rebuilt every time the build is executed to solve this issue.

But there are still some flaws, I don't know how to make py2exe only replace the modified parts during construction
@LeonarddeR What is your opinion?

seanbudd pushed a commit that referenced this issue Dec 7, 2023
Fixes #13372

Summary of the issue:
When rebuilding dist, some code changes were not detected. SCons does not trigger a new build.

Description of user facing changes
None

Description of development approach
dist will always be considered obsolete.
@nvaccessAuto nvaccessAuto added this to the 2024.1 milestone Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audience/nvda-dev PR or issue is relevant to NVDA / Add-on developers component/build triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants