-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
NativeAOT builds aren't updated when rebuilding with different MSBuild options #88725
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDescription
While working on Sergio0694/ComputeSharp#542, I noticed that rebuilding my CLI sample with NAOT using different MSBuild options was just... Not doing anything. And the resulting binary was exactly the same. I have configured a bunch of MSBuild options to build my sample with or without some more size saving options, and my assumptions was that rebuilding after setting up those new environment variables would do "the right thing", but it seems it doesn't 😅 Reproduction Steps
$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -c Release -f net7.0 -r win-x64
$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
$env:COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED='true';
$env:COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION='true';
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -c Release -f net7.0 -r win-x64
Expected behaviorThe build should be retriggered with the right properties. The resulting binary should be the same you would get if you tried building with the same exact commands but from a freshly cloned repo instead, not affected by previous builds. Actual behaviorThe resulting binary doesn't change. Known WorkaroundsYou can run
|
There are multiple options available for helping ensure that property inputs impact the rerunability of targets. What a lot of the SDK does is similar to the following handling for You can see that there is the main target That target itself has the inputs/outputs where one of the inputs is The There are of course other options as well, but having the input properties somehow written to a file that is an "input" to the main target is the basic principle behind which it typically operates. |
Incremental build wouldn't consider things like `OptimizationPreference` property changing as a thing that should trigger a rebuild. I feel like this is more a MSBuild bug, but it has been like this for a long time. Turns out we can use `WriteIlcRspFileForCompilation` target as a sentinel: * Run the target always. We only actually write out the file if it's different (`WriteOnlyWhenDifferent` is already set to `true`). * ILC execution already specifies the RSP as one of its inputs. So if the RSP is more recent than the output, it will trigger a build. Fixes #88725.
Incremental build wouldn't consider things like `OptimizationPreference` property changing as a thing that should trigger a rebuild. I feel like this is more a MSBuild bug, but it has been like this for a long time. Turns out we can use `WriteIlcRspFileForCompilation` target as a sentinel: * Run the target always. We only actually write out the file if it's different (`WriteOnlyWhenDifferent` is already set to `true`). * ILC execution already specifies the RSP as one of its inputs. So if the RSP is more recent than the output, it will trigger a build. Fixes #88725.
Description
While working on Sergio0694/ComputeSharp#542, I noticed that rebuilding my CLI sample with NAOT using different MSBuild options was just... Not doing anything. And the resulting binary was exactly the same. I have configured a bunch of MSBuild options to build my sample with or without some more size saving options, and my assumptions was that rebuilding after setting up those new environment variables would do "the right thing", but it seems it doesn't 😅
Reproduction Steps
Expected behavior
The build should be retriggered with the right properties. The resulting binary should be the same you would get if you tried building with the same exact commands but from a freshly cloned repo instead, not affected by previous builds.
Actual behavior
The resulting binary doesn't change.
Known Workarounds
You can run
git clean -fdx
before the second build. That works, but isn't ideal.The text was updated successfully, but these errors were encountered: