Skip to content

Conversation

@pavelsavara
Copy link
Member

  • make JS files to trigger browserhost CMake
  • do not touch _version.c where there is no change on Windows.
    • there are 2 loads of the a file in copy_version_files.ps1. One was with -Raw and the other without.
    • That causes superfluous detection of a delta. (newline at the end of the file)
    • That makes the native files to recompile every time
  • remove browserhost sample

@pavelsavara pavelsavara added this to the 11.0.0 milestone Dec 31, 2025
@pavelsavara pavelsavara self-assigned this Dec 31, 2025
Copilot AI review requested due to automatic review settings December 31, 2025 13:42
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Dec 31, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes incremental build issues for browser/CoreCLR by addressing build trigger dependencies and file comparison problems on Windows. The changes ensure that JavaScript file modifications properly trigger CMake rebuilds and prevent unnecessary recompilation due to spurious file differences.

Key changes:

  • Added JS file dependencies to browserhost CMakeLists to trigger rebuilds when JavaScript files change
  • Fixed version file comparison in PowerShell script to prevent false positives from newline inconsistencies
  • Removed obsolete browserhost sample code that was no longer needed

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/native/libs/Common/JavaScript/CMakeLists.txt Removed reference to obsolete sample file dotnet.boot.js from ROLLUP_TS_SOURCES
src/native/corehost/browserhost/CMakeLists.txt Added set_source_files_properties to make browserhost sources depend on JS files, triggering rebuild when they change; removed sample subdirectory
eng/native/version/copy_version_files.ps1 Changed version file reading to remove -Raw parameter to fix newline comparison issue
docs/workflow/building/coreclr/wasm.md Removed documentation reference to obsolete sample dotnet.boot.js file
src/native/corehost/browserhost/sample/* Removed all obsolete sample files (main.mjs, index.html, dotnet.boot.js, ReadMe.md, HelloWorld.csproj, HelloWorld.cs, CMakeLists.txt)
Comments suppressed due to low confidence (1)

eng/native/version/copy_version_files.ps1:21

  • Removing the -Raw parameter changes how the file content is read. Without -Raw, Get-Content returns an array of lines, while with -Raw it returns a single string. This creates an array-to-string comparison issue on line 21 where $version_file_contents (now an array) is compared to $current_contents (also an array).

In PowerShell, when comparing arrays with -ne, the operator acts as a filter returning elements that are not equal to the comparison value, rather than returning a boolean. This means the condition will behave unexpectedly.

To fix this while maintaining the goal of consistent newline handling, consider using -join "n"to convert both arrays to strings for comparison, or use-Raw` for both reads with proper string normalization.

            $current_contents = Get-Content -Path $version_file_destination
            $is_placeholder_file = $current_contents -match "@\(#\)Version N/A @Commit:"
        } else {
            $is_placeholder_file = $true
        }
        if ($is_placeholder_file -and $version_file_contents -ne $current_contents) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Host os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants