diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 537edca74de8..df51ce767c61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -232,31 +232,82 @@ jobs: path: ${{runner.temp}}/bun-webkit.tar.gz windows: + name: Windows strategy: matrix: include: - runner: windows - build-type: Release + configuration: Release package_json_arch: "x64" label: bun-webkit-windows-amd64 - runner: windows - build-type: Debug + configuration: Debug package_json_arch: "x64" label: bun-webkit-windows-amd64-debug + - runner: windows + configuration: ASAN + package_json_arch: "x64" + label: bun-webkit-windows-amd64-asan runs-on: ${{ matrix.runner }} timeout-minutes: 90 steps: + - name: "Set LLVM version" + if: github.event == 'workflow_dispatch' + run: echo "LLVM_VERSION=${{inputs.llvm_version}}" >> $env:GITHUB_ENV - name: Install Scoop run: | Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH - - name: Install LLVM and Ninja + - name: Install LLVM 19, Ruby, and Ninja run: | + # Install Ninja build system scoop install ninja - scoop install llvm@19.1.7 - Join-Path (Resolve-Path ~).Path "scoop\apps\llvm\current\bin" >> $Env:GITHUB_PATH - - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 + + # Install LLVM 19.x (clang-cl) + scoop install llvm@${{env.LLVM_VERSION}}.1.7 + + # Install Ruby (required for WebKit build) + scoop install ruby + + # Add all tools to PATH + $ScoopPath = Join-Path (Resolve-Path ~).Path "scoop\shims" + $LLVMPath = Join-Path (Resolve-Path ~).Path "scoop\apps\llvm\current\bin" + $RubyPath = Join-Path (Resolve-Path ~).Path "scoop\apps\ruby\current\bin" + + echo $ScoopPath >> $Env:GITHUB_PATH + echo $LLVMPath >> $Env:GITHUB_PATH + echo $RubyPath >> $Env:GITHUB_PATH + - name: Clone and Setup vcpkg + run: | + # Clone vcpkg if it doesn't exist + if (!(Test-Path "C:\vcpkg")) { + Write-Host ":: Cloning vcpkg" + git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg + } else { + Write-Host ":: vcpkg already exists, updating" + cd C:\vcpkg + git pull + } + + # Bootstrap vcpkg + Write-Host ":: Bootstrapping vcpkg" + C:\vcpkg\bootstrap-vcpkg.bat + + # Integrate vcpkg with MSBuild/CMake + Write-Host ":: Integrating vcpkg" + C:\vcpkg\vcpkg.exe integrate install + + # Set environment variable for the build script + echo "VCPKG_ROOT=C:\vcpkg" >> $env:GITHUB_ENV + - name: Install ICU via vcpkg + run: | + # Install ICU using dynamic linkage (x64-windows triplet, not x64-windows-static) + Write-Host ":: Installing ICU via vcpkg (dynamic linkage)" + C:\vcpkg\vcpkg.exe install icu:x64-windows + + # Verify installation + C:\vcpkg\vcpkg.exe list icu - uses: actions/checkout@v4 with: sparse-checkout-cone-mode: false @@ -264,21 +315,49 @@ jobs: /* !LayoutTests/ !JSTests/ + - name: Verify Build Tools + run: | + Write-Host ":: Verifying build tools" + + # Verify clang-cl version + clang-cl.exe --version + + # Verify Ruby + ruby --version + + # Verify Ninja + ninja --version + + # Verify vcpkg + C:\vcpkg\vcpkg.exe version + + # Show PATH for debugging + Write-Host ":: Current PATH:" + $env:PATH -split ';' | ForEach-Object { Write-Host " $_" } - name: Build WebKit + env: + WEBKIT_OUTPUT_DIR: "bun-webkit" + BUN_WEBKIT_VERSION: "${{ github.sha }}" + PACKAGE_JSON_LABEL: "${{matrix.label}}" + GITHUB_SHA: "${{ github.sha }}" + PACKAGE_JSON_ARCH: "${{matrix.package_json_arch}}" + GITHUB_REPOSITORY: "${{ github.repository }}" + VCPKG_ROOT: "C:\\vcpkg" run: | + # Ensure Windows SDK tools are in PATH $env:Path = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\;" + $env:Path - $env:WEBKIT_OUTPUT_DIR = "bun-webkit" - $env:BUN_WEBKIT_VERSION = "${{ github.sha }}" - $env:CMAKE_BUILD_TYPE = "${{matrix.build-type}}" - $env:PACKAGE_JSON_LABEL = "${{matrix.label}}" - $env:GITHUB_SHA = "${{ github.sha }}" - $env:PACKAGE_JSON_ARCH = "${{matrix.package_json_arch}}" - $env:GITHUB_REPOSITORY = "${{ github.repository }}" - ./windows-release.ps1 + + Write-Host ":: Starting WebKit build with configuration: ${{matrix.configuration}}" + Write-Host ":: Using vcpkg at: $env:VCPKG_ROOT" + Write-Host ":: Output directory: $env:WEBKIT_OUTPUT_DIR" + Write-Host ":: BUN_WEBKIT_VERSION: $env:BUN_WEBKIT_VERSION" + + # Run the build script + ./windows-release-vcpkg.ps1 -Configuration "${{matrix.configuration}}" - uses: actions/upload-artifact@v4 with: name: ${{matrix.label}} - path: bun-webkit.tar.gz + path: bun-webkit*.tar.gz linux-musl: name: Linux @@ -440,6 +519,10 @@ jobs: with: name: bun-webkit-windows-amd64-debug path: ${{runner.temp}}/bun-webkit-windows-amd64-debug + - uses: actions/download-artifact@v4 + with: + name: bun-webkit-windows-amd64-asan + path: ${{runner.temp}}/bun-webkit-windows-amd64-asan - uses: actions/download-artifact@v4 with: name: bun-webkit-linux-amd64-musl @@ -491,6 +574,7 @@ jobs: mv ${{runner.temp}}/bun-webkit-linux-arm64-musl-lto/bun-webkit.tar.gz ./out/bun-webkit-linux-arm64-musl-lto.tar.gz mv ${{runner.temp}}/bun-webkit-windows-amd64/bun-webkit.tar.gz ./out/bun-webkit-windows-amd64.tar.gz mv ${{runner.temp}}/bun-webkit-windows-amd64-debug/bun-webkit.tar.gz ./out/bun-webkit-windows-amd64-debug.tar.gz + mv ${{runner.temp}}/bun-webkit-windows-amd64-asan/bun-webkit.tar.gz ./out/bun-webkit-windows-amd64-asan.tar.gz - name: Release uses: softprops/action-gh-release@v1 with: @@ -540,3 +624,4 @@ jobs: files: | ./out/bun-webkit-windows-amd64.tar.gz ./out/bun-webkit-windows-amd64-debug.tar.gz + ./out/bun-webkit-windows-amd64-asan.tar.gz diff --git a/windows-release-vcpkg.ps1 b/windows-release-vcpkg.ps1 new file mode 100644 index 000000000000..62da1f85e6eb --- /dev/null +++ b/windows-release-vcpkg.ps1 @@ -0,0 +1,374 @@ +param( + # Configuration type: Debug, Release, or ASAN + [ValidateSet("Debug", "Release", "ASAN")] + [string]$Configuration = "Release" +) + +$ErrorActionPreference = "Stop" + +# Set up MSVC environment variables. This is taken from Bun's 'scripts\env.ps1' +if ($env:VSINSTALLDIR -eq $null) { + Write-Host "Loading Visual Studio environment, this may take a second..." + $vsDir = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\2022" -Directory + if ($vsDir -eq $null) { + throw "Visual Studio directory not found." + } + Push-Location $vsDir.FullName + try { + . (Join-Path -Path $vsDir.FullName -ChildPath "Common7\Tools\Launch-VsDevShell.ps1") -Arch amd64 -HostArch amd64 + } + finally { Pop-Location } +} + +if ($Env:VSCMD_ARG_TGT_ARCH -eq "x86") { + # Please do not try to compile Bun for 32 bit. It will not work. I promise. + throw "Visual Studio environment is targetting 32 bit. This configuration is definitely a mistake." +} + +# Fix up $PATH - remove problematic paths +$SplitPath = $env:PATH -split ";" +$MSVCPaths = $SplitPath | Where-Object { $_ -like "*Microsoft Visual Studio*" } +$CleanPaths = $SplitPath | Where-Object { + $_ -notlike "*mingw*" -and + $_ -notlike "*strawberry*" -and + $_ -notlike "*cygwin*" +} +$env:PATH = ($MSVCPaths + $CleanPaths) -join ';' + +Write-Host "Cleaned PATH: $env:PATH" + +# Verify tools +(Get-Command link).Path +clang-cl.exe --version + +# Detect LLVM installation for ASAN support +$ASANLibPath = $null +$ClangPath = (Get-Command clang-cl -ErrorAction SilentlyContinue).Path +if ($ClangPath) { + $LLVMRoot = Split-Path (Split-Path $ClangPath) + $LLVMLib = Join-Path $LLVMRoot "lib" + $ClangLib = Join-Path $LLVMLib "clang" + + # Find clang version directory (e.g., "19" or "19.1.7") + if (Test-Path $ClangLib) { + $ClangVersion = Get-ChildItem $ClangLib | Select-Object -First 1 + $ASANLibPath = Join-Path $ClangVersion.FullName "lib\windows" + + if (Test-Path $ASANLibPath) { + Write-Host ":: Found ASAN libraries at $ASANLibPath" + + # Set environment variables for the linker to find ASAN libraries + $env:LIB = "$ASANLibPath;$env:LIB" + $env:LINK = "/LIBPATH:`"$ASANLibPath`" $env:LINK" + + # Also set for CMake + $env:CMAKE_PREFIX_PATH = "$LLVMRoot;$env:CMAKE_PREFIX_PATH" + + # For ASAN builds, we need to link the ASAN runtime explicitly + if ($Configuration -eq "ASAN") { + $env:LDFLAGS = "/LIBPATH:`"$ASANLibPath`" -fsanitize=address $env:LDFLAGS" + $env:CFLAGS = "-fsanitize=address $env:CFLAGS" + $env:CXXFLAGS = "-fsanitize=address $env:CXXFLAGS" + } + } else { + Write-Warning "ASAN library path not found at $ASANLibPath" + $ASANLibPath = $null + } + } +} + +$env:CC = "clang-cl" +$env:CXX = "clang-cl" + +# Configuration variables +$output = if ($env:WEBKIT_OUTPUT_DIR) { $env:WEBKIT_OUTPUT_DIR } else { "bun-webkit" } +$WebKitBuild = if ($env:WEBKIT_BUILD_DIR) { $env:WEBKIT_BUILD_DIR } else { "WebKitBuild" } +$CMAKE_BUILD_TYPE = $Configuration +$BUN_WEBKIT_VERSION = if ($env:BUN_WEBKIT_VERSION) { $env:BUN_WEBKIT_VERSION } else { $(git rev-parse HEAD) } + +# Handle ASAN builds +$EnableSanitizers = $false +if ($Configuration -eq "ASAN") { + $EnableSanitizers = $true + $CMAKE_BUILD_TYPE = "Release" # ASAN uses Release mode for better performance + Write-Host ":: Building with AddressSanitizer enabled (Release)" +} + +$null = mkdir $WebKitBuild -ErrorAction SilentlyContinue + +# vcpkg setup - prefer standalone installation over Visual Studio integrated one +$VcpkgRoot = if ($env:VCPKG_ROOT) { + $env:VCPKG_ROOT +} elseif (Test-Path "C:\vcpkg\vcpkg.exe") { + "C:\vcpkg" +} else { + "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcpkg" +} +$VcpkgExe = Join-Path $VcpkgRoot "vcpkg.exe" + +if (!(Test-Path $VcpkgExe)) { + throw "vcpkg not found at $VcpkgExe. Please install vcpkg and set VCPKG_ROOT environment variable." +} + +Write-Host ":: Using vcpkg at $VcpkgRoot" +Write-Host ":: VcpkgExe is $VcpkgExe" +Write-Host ":: VCPKG_ROOT env var is $env:VCPKG_ROOT" + +# Ensure Ruby is in PATH if installed via scoop +$RubyPath = "C:\Users\window\scoop\apps\ruby\current\bin" +if (Test-Path $RubyPath) { + if ($env:PATH -notlike "*$RubyPath*") { + $env:PATH = "$RubyPath;$env:PATH" + Write-Host ":: Added Ruby to PATH: $RubyPath" + } +} else { + Write-Warning "Ruby not found at expected scoop path: $RubyPath" +} + +# Use dynamic triplet to avoid ICU linking issues with static libraries +$VcpkgTriplet = "x64-windows" + +# Install dependencies via vcpkg (manifest mode) +Write-Host ":: Checking ICU installation via vcpkg" + +# In manifest mode, vcpkg install without arguments installs dependencies from vcpkg.json +# The vcpkg.json in the root already has ICU as a dependency +Write-Host ":: Installing dependencies from vcpkg.json (including ICU)" +Push-Location $PSScriptRoot +try { + & $VcpkgExe install --triplet=$VcpkgTriplet + if ($LASTEXITCODE -ne 0) { + Write-Warning "vcpkg install returned exit code $LASTEXITCODE - attempting to continue" + } +} finally { + Pop-Location +} + +# Verify ICU is installed +$IcuCheck = & $VcpkgExe list 2>&1 | Select-String "icu:" +if ($IcuCheck) { + Write-Host ":: ICU confirmed installed via vcpkg" +} else { + Write-Warning "Could not confirm ICU installation - build may fail" +} + +# vcpkg toolchain file +$VcpkgToolchain = Join-Path $VcpkgRoot "scripts/buildsystems/vcpkg.cmake" + +Write-Host ":: Configuring WebKit with vcpkg" + +# Set compiler flags for static runtime linking +$env:CFLAGS = "/Zi" +$env:CXXFLAGS = "/Zi" + +# Determine MSVC runtime library setting - use dynamic runtime since we're using dynamic ICU +$CmakeMsvcRuntimeLibrary = "MultiThreadedDLL" +if ($CMAKE_BUILD_TYPE -eq "Debug") { + $CmakeMsvcRuntimeLibrary = "MultiThreadedDebugDLL" +} + +# ASAN-specific flags +$AsanFlags = "" +if ($EnableSanitizers) { + $AsanFlags = " -fsanitize=address" + # ASAN requires dynamic runtime and works best with release runtime + $CmakeMsvcRuntimeLibrary = "MultiThreadedDLL" # /MD +} + +$NoWebassembly = if ($env:NO_WEBASSEMBLY) { $env:NO_WEBASSEMBLY } else { $false } +$WebAssemblyState = if ($NoWebassembly) { "OFF" } else { "ON" } + +# Build CMake command +$CmakeArgs = @( + "-S", ".", + "-B", $WebKitBuild, + "-DPORT=JSCOnly", + "-DENABLE_STATIC_JSC=ON", + "-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON", + "-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE", + "-DUSE_THIN_ARCHIVES=OFF", + "-DENABLE_JIT=ON", + "-DENABLE_DFG_JIT=ON", + "-DENABLE_FTL_JIT=ON", + "-DENABLE_WEBASSEMBLY_BBQJIT=ON", + "-DENABLE_WEBASSEMBLY_OMGJIT=ON", + "-DENABLE_SAMPLING_PROFILER=ON", + "-DENABLE_WEBASSEMBLY=$WebAssemblyState", + "-DUSE_BUN_JSC_ADDITIONS=ON", + "-DUSE_BUN_EVENT_LOOP=ON", + "-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON", + "-DUSE_SYSTEM_MALLOC=ON", + "-DCMAKE_C_COMPILER=clang-cl", + "-DCMAKE_CXX_COMPILER=clang-cl", + "-DCMAKE_C_FLAGS_RELEASE=/Zi /O2 /Ob2 /DNDEBUG$AsanFlags", + "-DCMAKE_CXX_FLAGS_RELEASE=/Zi /O2 /Ob2 /DNDEBUG$AsanFlags -Xclang -fno-c++-static-destructors", + "-DCMAKE_C_FLAGS_DEBUG=/Zi /FS /O0 /Ob0$AsanFlags", + "-DCMAKE_CXX_FLAGS_DEBUG=/Zi /FS /O0 /Ob0$AsanFlags -Xclang -fno-c++-static-destructors", + "-DENABLE_REMOTE_INSPECTOR=ON", + "-DCMAKE_MSVC_RUNTIME_LIBRARY=$CmakeMsvcRuntimeLibrary", + "-DCMAKE_TOOLCHAIN_FILE=$VcpkgToolchain", + "-DVCPKG_TARGET_TRIPLET=$VcpkgTriplet", + "-G", "Ninja" +) + +# Add sanitizer flags if enabled +if ($EnableSanitizers) { + # For ASAN on Windows with Clang, we need to: + # 1. Use -fsanitize=address for compilation (already in AsanFlags) + # 2. Link against the ASAN runtime libraries + # 3. Use dynamic CRT (/MD) - already configured + + Write-Host ":: Configuring ASAN build with linker flags" + + $CmakeArgs += "-DENABLE_SANITIZERS=address" + + if ($ASANLibPath) { + # Set up linking flags with explicit ASAN library path + # The compiler flags already have -fsanitize=address from AsanFlags + # We just need to ensure the linker can find the ASAN runtime + + $ASANLinkFlags = "/LIBPATH:`"$ASANLibPath`"" + + # Add linker flags with ASAN library path + $CmakeArgs += "-DCMAKE_EXE_LINKER_FLAGS=$ASANLinkFlags" + $CmakeArgs += "-DCMAKE_SHARED_LINKER_FLAGS=$ASANLinkFlags" + $CmakeArgs += "-DCMAKE_MODULE_LINKER_FLAGS=$ASANLinkFlags" + + # Skip CMake's compiler test since it doesn't inherit our linker flags properly + $CmakeArgs += "-DCMAKE_C_COMPILER_WORKS=1" + $CmakeArgs += "-DCMAKE_CXX_COMPILER_WORKS=1" + + Write-Host ":: ASAN libraries configured at $ASANLibPath" + } else { + Write-Warning "ASAN library path not found - build may fail during linking" + } +} + +# Run CMake +& cmake @CmakeArgs +if ($LASTEXITCODE -ne 0) { throw "cmake failed with exit code $LASTEXITCODE" } + +# Workaround for what is probably a CMake bug +Write-Host ":: Applying batch file workaround" +$batFiles = Get-ChildItem -Path $WebKitBuild -Filter "*.bat" -File -Recurse +foreach ($file in $batFiles) { + $content = Get-Content $file.FullName -Raw + $newContent = $content -replace "(\|\| \(set FAIL_LINE=\d+& goto :ABORT\))", "" + if ($content -ne $newContent) { + Set-Content -Path $file.FullName -Value $newContent + Write-Host ":: Patched $($file.FullName)" + } +} + +Write-Host ":: Building WebKit ($CMAKE_BUILD_TYPE configuration)" +$BuildTarget = "jsc" +cmake --build $WebKitBuild --config $CMAKE_BUILD_TYPE --target $BuildTarget --verbose +if ($LASTEXITCODE -ne 0) { throw "cmake --build failed with exit code $LASTEXITCODE" } + +Write-Host ":: Packaging $output" + +# Dump the entire tree of files in $WebKitBuild to the console. +# This is useful for debugging. +Write-Host ":: Build output directory contents:" +Get-ChildItem -Recurse $WebKitBuild | Format-List -Force | Out-String | Write-Host + +# Clean and create output directories +Remove-Item -Recurse -ErrorAction SilentlyContinue $output +$null = mkdir -ErrorAction SilentlyContinue $output +$null = mkdir -ErrorAction SilentlyContinue $output/include +$null = mkdir -ErrorAction SilentlyContinue $output/include/JavaScriptCore +$null = mkdir -ErrorAction SilentlyContinue $output/include/wtf + +# Copy build artifacts +Copy-Item -Recurse $WebKitBuild/lib $output +Copy-Item -Recurse $WebKitBuild/bin $output + +# If there's a lib64, also copy it. +if (Test-Path -Path $WebKitBuild/lib64) { + Copy-Item -Recurse $WebKitBuild/lib64/* $output/lib +} + +Copy-Item $WebKitBuild/cmakeconfig.h $output/include/cmakeconfig.h + +# Add BUN_WEBKIT_VERSION to cmakeconfig.h +Add-Content -Path $output/include/cmakeconfig.h -Value "#define BUN_WEBKIT_VERSION `"$BUN_WEBKIT_VERSION`"" + +# Copy JavaScriptCore headers +Copy-Item -r -Force $WebKitBuild/JavaScriptCore/DerivedSources/* $output/include/JavaScriptCore +Copy-Item -r -Force $WebKitBuild/JavaScriptCore/Headers/JavaScriptCore/* $output/include/JavaScriptCore/ +Copy-Item -r -Force $WebKitBuild/JavaScriptCore/PrivateHeaders/JavaScriptCore/* $output/include/JavaScriptCore/ + +# Recursively copy all the .h files in DerivedSources to the root of include/JavaScriptCore, preserving the basename only. +Copy-Item -r -Force $WebKitBuild/JavaScriptCore/DerivedSources/*.h $output/include/JavaScriptCore/ +Copy-Item -r -Force $WebKitBuild/JavaScriptCore/DerivedSources/*/*.h $output/include/JavaScriptCore/ + +# Recursively copy all the .json files in DerivedSources to the root of the output directory, preserving the basename only. +Copy-Item -r -Force $WebKitBuild/JavaScriptCore/DerivedSources/*.json $output/ + +# Copy WTF headers +Copy-Item -r $WebKitBuild/WTF/DerivedSources/* $output/include/wtf/ +Copy-Item -r $WebKitBuild/WTF/Headers/wtf/* $output/include/wtf/ + +# Copy bmalloc headers if they exist (libpas support) +if (Test-Path -Path $WebKitBuild/bmalloc) { + $null = mkdir -ErrorAction SilentlyContinue $output/include/bmalloc + Copy-Item -r $WebKitBuild/bmalloc/Headers/bmalloc/* $output/include/bmalloc/ +} + +# Fix header import/include syntax +(Get-Content -Path $output/include/JavaScriptCore/JSValueInternal.h) ` + -replace "#import ", "#include " ` +| Set-Content -Path $output/include/JavaScriptCore/JSValueInternal.h + +# Copy ICU headers and libraries from vcpkg +$VcpkgInstalled = Join-Path $VcpkgRoot "installed/$VcpkgTriplet" +$IcuInclude = Join-Path $VcpkgInstalled "include" +$IcuLib = Join-Path $VcpkgInstalled "lib" + +if (Test-Path $IcuInclude) { + Copy-Item -r $IcuInclude/* $output/include/ + Write-Host ":: Copied ICU headers from vcpkg" +} else { + Write-Warning "ICU headers not found at $IcuInclude" +} + +if (Test-Path $IcuLib) { + # Copy ICU libraries + $IcuLibFiles = Get-ChildItem -Path $IcuLib -Filter "icu*.lib" + foreach ($lib in $IcuLibFiles) { + Copy-Item $lib.FullName $output/lib/ + } + Write-Host ":: Copied ICU libraries from vcpkg" +} else { + Write-Warning "ICU libraries not found at $IcuLib" +} + +# Create package.json for artifact identification +$ConfigSuffix = if ($EnableSanitizers) { "asan" } else { $CMAKE_BUILD_TYPE.ToLower() } +$packageJsonContent = @{ + name = if ($env:PACKAGE_JSON_LABEL) { $env:PACKAGE_JSON_LABEL } else { "webkit-$ConfigSuffix" } + version = "0.0.1-$env:GITHUB_SHA" + os = @("win32") + cpu = @(if ($env:PACKAGE_JSON_ARCH) { $env:PACKAGE_JSON_ARCH } else { "x64" }) + repository = "https://github.com/$($env:GITHUB_REPOSITORY)" + config = $ConfigSuffix + asan = $EnableSanitizers +} | ConvertTo-Json -Depth 2 + +Out-File -FilePath $output/package.json -InputObject $packageJsonContent + +# Create tarball +$OutputArchive = if ($EnableSanitizers) { "${output}-asan.tar.gz" } else { "${output}.tar.gz" } +tar -cz -f $OutputArchive $output +if ($LASTEXITCODE -ne 0) { throw "tar failed with exit code $LASTEXITCODE" } + +Write-Host "-> $OutputArchive" +Write-Host ":: Build completed successfully!" + +# Summary +Write-Host "" +Write-Host "=== Build Summary ===" +Write-Host "Configuration: $Configuration" +Write-Host "ASAN Enabled: $EnableSanitizers" +Write-Host "Output: $OutputArchive" +Write-Host "WebKit Version: $BUN_WEBKIT_VERSION" \ No newline at end of file