diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2022fbe..010a824 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -39,6 +39,7 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false + submodules: recursive - uses: actions/setup-dotnet@v6 with: @@ -74,6 +75,7 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false + submodules: recursive - uses: actions/setup-dotnet@v6 with: @@ -105,6 +107,7 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false + submodules: recursive # Wheel Wizard runs the downloaded setup with --version and refuses it when the reported # version differs from the release tag, so a tag that was pushed without bumping the pinned diff --git a/.github/workflows/recomp-test.yml b/.github/workflows/recomp-test.yml index 3a1244a..14a4797 100644 --- a/.github/workflows/recomp-test.yml +++ b/.github/workflows/recomp-test.yml @@ -16,6 +16,7 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false + submodules: recursive - uses: actions/setup-dotnet@v6 with: diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..32950b1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "aurora-main"] + path = aurora-main + url = https://github.com/patchzyy/aurora.git diff --git a/Launcher/Build-Installer.ps1 b/Launcher/Build-Installer.ps1 index 17f2b17..4469867 100644 --- a/Launcher/Build-Installer.ps1 +++ b/Launcher/Build-Installer.ps1 @@ -73,7 +73,16 @@ function Resolve-VcRuntimeDirectory([string]$RequestedPath) { function Copy-Directory([string]$Source, [string]$Destination) { Assert-Directory $Source "Source directory" [IO.Directory]::CreateDirectory($Destination) | Out-Null - Copy-Item -Path (Join-Path $Source '*') -Destination $Destination -Recurse -Force + # Source payloads are materialized trees, independent of Git checkout metadata. + foreach ($entry in Get-ChildItem -LiteralPath $Source -Force) { + if ($entry.Name -eq '.git') { continue } + $target = Join-Path $Destination $entry.Name + if ($entry.PSIsContainer) { + Copy-Directory $entry.FullName $target + } else { + Copy-Item -LiteralPath $entry.FullName -Destination $target -Force + } + } } function Compress-Zip([string]$Source, [string]$Destination, [string[]]$Entries) { $tar = Join-Path $env:SystemRoot 'System32\tar.exe' diff --git a/Launcher/NativeBuildFlags.ps1 b/Launcher/NativeBuildFlags.ps1 index 7d88f4b..070604e 100644 --- a/Launcher/NativeBuildFlags.ps1 +++ b/Launcher/NativeBuildFlags.ps1 @@ -244,13 +244,14 @@ function Get-MkwAuroraSourceFingerprint([string]$AuroraDirectory) { (Join-Path $root 'extern') + '\', (Join-Path $root 'build') + '\' ) - # Hidden files are skipped deliberately: Build-Installer.ps1 stages this tree - # with Copy-Item -Recurse (no -Force), so they never reach the payload and - # hashing them would make the two sides disagree by construction. + # Git metadata identifies a checkout location, not a source revision's bytes. + # Exclude it explicitly, including a submodule's non-hidden .git file. $files = Get-ChildItem -LiteralPath $root -Recurse -File | Where-Object { $full = $_.FullName - -not ($excludedPrefixes | Where-Object { $full.StartsWith($_, [StringComparison]::OrdinalIgnoreCase) }) + $relative = $full.Substring($root.Length + 1).Replace('\', '/') + ($relative -notmatch '(^|/)\.git(/|$)') -and + -not ($excludedPrefixes | Where-Object { $full.StartsWith($_, [StringComparison]::OrdinalIgnoreCase) }) } | Sort-Object { $_.FullName.Substring($root.Length + 1).Replace('\', '/') } $sha = [Security.Cryptography.SHA256]::Create() diff --git a/Launcher/Prepare-Dependencies.ps1 b/Launcher/Prepare-Dependencies.ps1 index 18a8e9a..01996ae 100644 --- a/Launcher/Prepare-Dependencies.ps1 +++ b/Launcher/Prepare-Dependencies.ps1 @@ -21,6 +21,9 @@ $auroraExtern = Join-Path $repoRoot 'aurora-main\extern\CMakeLists.txt' $auroraDawn = Join-Path $repoRoot 'aurora-main\cmake\AuroraDawnProvider.cmake' $auroraLibUsb = Join-Path $repoRoot 'aurora-main\cmake\AuroraLibUSB.cmake' $auroraSdl = Join-Path $repoRoot 'aurora-main\cmake\AuroraSDL3Provider.cmake' +if (-not (Test-Path -LiteralPath $auroraCMake -PathType Leaf)) { + throw 'Aurora sources are missing. Run git submodule update --init --recursive from the repository root first.' +} # Name = directory under the destination; FetchContent maps it back through # FETCHCONTENT_SOURCE_DIR_ (NativeBuildFlags.ps1), so the names are the declared diff --git a/Launcher/Prepare-NativePrebuilt.sh b/Launcher/Prepare-NativePrebuilt.sh index 7f31799..c5c9c6d 100755 --- a/Launcher/Prepare-NativePrebuilt.sh +++ b/Launcher/Prepare-NativePrebuilt.sh @@ -117,7 +117,7 @@ fingerprint_tree() { local root=$1; shift root=$(normalize "$root") [[ -d "$root" ]] || return 0 - local find_args=("$root") + local find_args=("$root" -name .git -prune -o) local ex for ex in "$@"; do find_args+=(-path "$root/$ex" -prune -o); done find_args+=(-type f -print) diff --git a/Launcher/Test-Recompilation.ps1 b/Launcher/Test-Recompilation.ps1 index 789e4dd..f30a77b 100644 --- a/Launcher/Test-Recompilation.ps1 +++ b/Launcher/Test-Recompilation.ps1 @@ -36,8 +36,17 @@ Write-Host "Synthetic recompilation workspace: $stage" # Copy current sources, including uncommitted edits, but no ignored build output. # An isolated workspace preserves the developer's real generated/ directory. -$sourceFiles = & git -C $repoRoot -c core.quotepath=false ls-files --cached --others --exclude-standard -- runtime aurora-main -if ($LASTEXITCODE -ne 0) { throw 'Could not enumerate runtime and Aurora sources.' } +$auroraRoot = Join-Path $repoRoot 'aurora-main' +if (-not (Test-Path -LiteralPath (Join-Path $auroraRoot '.git'))) { + throw 'Aurora submodule is not initialized. Run git submodule update --init --recursive first.' +} +# The parent tracks Aurora as one gitlink; enumerate its repository separately. +# Retain untracked source files so local development edits are still tested. +$sourceFiles = @(& git -C $repoRoot -c core.quotepath=false ls-files --cached --others --exclude-standard -- runtime) +if ($LASTEXITCODE -ne 0) { throw 'Could not enumerate runtime sources.' } +$auroraFiles = @(& git -C $auroraRoot -c core.quotepath=false ls-files --cached --others --exclude-standard) +if ($LASTEXITCODE -ne 0) { throw 'Could not enumerate Aurora sources.' } +$sourceFiles += @($auroraFiles | ForEach-Object { "aurora-main/$_" }) foreach ($relative in $sourceFiles | Sort-Object -Unique) { $destination = Join-Path $stage $relative [IO.Directory]::CreateDirectory([IO.Path]::GetDirectoryName($destination)) | Out-Null diff --git a/Launcher/build-appimage.sh b/Launcher/build-appimage.sh index d8c0a76..afe2b13 100755 --- a/Launcher/build-appimage.sh +++ b/Launcher/build-appimage.sh @@ -167,6 +167,8 @@ echo "Staging the bundled workspace snapshot..." for dir in runtime aurora-main projects; do cp -r "$workspace/$dir" "$appdir/workspace/$dir" done +# Ship source bytes, never submodule checkout pointers or embedded Git databases. +find "$appdir/workspace" -name .git -prune -exec rm -rf {} + # Mirrors Build-Installer.ps1's own staging exclusions exactly: aurora-main/extern/CMakeLists.txt # is the real FetchContent driver and must ship, but any already-fetched dependency *subdirectory* # a developer's local checkout accumulated under extern/ is stale/large build output, not a diff --git a/Launcher/macos/build-setup-pkg.command b/Launcher/macos/build-setup-pkg.command index 50082c9..2c3f910 100755 --- a/Launcher/macos/build-setup-pkg.command +++ b/Launcher/macos/build-setup-pkg.command @@ -98,6 +98,8 @@ for source in aurora-main projects runtime translator; do [[ -d "$workspace/$source" ]] || fail "required workspace directory is missing: $source" copy_clean "$workspace/$source" "$resources/workspace/$source" done +# Setup bundles contain materialized sources and must work without Git. +find "$resources/workspace" -name .git -prune -exec rm -rf {} + mkdir -p "$resources/workspace/Launcher/macos" copy_clean "$workspace/Launcher/local-build-macos.command" "$resources/workspace/Launcher/local-build-macos.command" copy_clean "$workspace/Launcher/macos/extract-disc.command" "$resources/workspace/Launcher/macos/extract-disc.command" diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 22537d3..d9bffb0 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -156,7 +156,14 @@ set(MKW_CPPWINRT_INCLUDE_DIR "" CACHE PATH "Optional self-contained C++/WinRT in # not compiled at all; imported targets with the same names are wired up from # the package instead, so this project's own code compiles and links exactly # as before. -set(MKW_AURORA_DIR "${CMAKE_CURRENT_LIST_DIR}/../aurora-main") +set(MKW_AURORA_DIR "${CMAKE_CURRENT_LIST_DIR}/../aurora-main" CACHE PATH + "Aurora source directory") +if(NOT EXISTS "${MKW_AURORA_DIR}/CMakeLists.txt" + OR NOT EXISTS "${MKW_AURORA_DIR}/include/aurora/aurora.h") + message(FATAL_ERROR + "Aurora sources are missing at ${MKW_AURORA_DIR}. From the repository root, run " + "git submodule update --init --recursive, or set MKW_AURORA_DIR to an initialized Aurora checkout.") +endif() # The translator's explicit float casts are PPC single-precision rounding points. # Fast-math may erase them and change guest-visible integer conversions. @@ -171,9 +178,6 @@ if(MKW_NATIVE_PREBUILT_DIR) # not compiled here. include("${CMAKE_CURRENT_LIST_DIR}/cmake/NativePrebuilt.cmake") else() - if(NOT EXISTS ${MKW_AURORA_DIR}/CMakeLists.txt) - message(FATAL_ERROR "Requested aurora-main but ${MKW_AURORA_DIR} is missing") - endif() set(DAWN_ENABLE_D3D11 OFF CACHE BOOL "" FORCE) if(MKW_PLATFORM_WINDOWS) set(DAWN_ENABLE_D3D12 ON CACHE BOOL "" FORCE) @@ -423,7 +427,7 @@ else() add_library(mkw_macos_native_compile OBJECT ${MKW_MACOS_NATIVE_AUDIT_SOURCES}) target_include_directories(mkw_macos_native_compile PRIVATE "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_CURRENT_LIST_DIR}/src" - "${CMAKE_CURRENT_LIST_DIR}/.." "${CMAKE_CURRENT_LIST_DIR}/../aurora-main/include") + "${CMAKE_CURRENT_LIST_DIR}/.." "${MKW_AURORA_DIR}/include") target_compile_features(mkw_macos_native_compile PRIVATE cxx_std_20) target_compile_definitions(mkw_macos_native_compile PRIVATE SDL_MAIN_HANDLED TARGET_PC) target_link_libraries(mkw_macos_native_compile PRIVATE diff --git a/runtime/cmake/PublicProducts.cmake b/runtime/cmake/PublicProducts.cmake index e76e75a..2b7af0f 100644 --- a/runtime/cmake/PublicProducts.cmake +++ b/runtime/cmake/PublicProducts.cmake @@ -46,7 +46,7 @@ function(mkw_configure_object_target target) # Workspace root, so translator output is spelled "generated/.h" # instead of a ../ chain whose depth depends on the includer. "${MKW_RUNTIME_SOURCE_DIR}/.." - "${MKW_RUNTIME_SOURCE_DIR}/../aurora-main/include") + "${MKW_AURORA_DIR}/include") target_compile_definitions(${target} PRIVATE TARGET_PC) set_target_properties(${target} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) @@ -190,7 +190,7 @@ function(mkw_configure_product target) # Workspace root, so translator output is spelled "generated/.h" # instead of a ../ chain whose depth depends on the includer. "${MKW_RUNTIME_SOURCE_DIR}/.." - "${MKW_RUNTIME_SOURCE_DIR}/../aurora-main/include") + "${MKW_AURORA_DIR}/include") target_compile_definitions(${target} PRIVATE SDL_MAIN_HANDLED _DISABLE_STRING_ANNOTATION _DISABLE_VECTOR_ANNOTATION TARGET_PC) target_compile_features(${target} PRIVATE cxx_std_20)