diff --git a/.github/workflows/build-and-make.yaml b/.github/workflows/build-and-make.yaml index e5914bbe5..bd0abee32 100644 --- a/.github/workflows/build-and-make.yaml +++ b/.github/workflows/build-and-make.yaml @@ -323,6 +323,12 @@ jobs: ;; win32) test -f dist/apps/electron-backend/native/lib/mpv-2.dll || test -f dist/apps/electron-backend/native/lib/libmpv-2.dll || test -f dist/apps/electron-backend/native/lib/mpv.dll || test -f dist/apps/electron-backend/native/lib/libmpv.dll + # Frame-copy engine artifacts ship on Windows. The helper + # resolves the mpv DLL from its own directory, so the DLL + # must sit beside it at the native/ top level too. + test -f dist/apps/electron-backend/native/iptvnator_mpv_helper.exe + test -f dist/apps/electron-backend/native/embedded_mpv_frame_reader.node + find dist/apps/electron-backend/native -maxdepth 1 \( -name 'mpv-2.dll' -o -name 'libmpv-2.dll' -o -name 'mpv.dll' -o -name 'libmpv.dll' \) -print -quit | grep -q . ;; linux) node -e "const manifest = require('./dist/apps/electron-backend/native/embedded-mpv-runtime.json'); if (manifest.origin !== 'external-mpv-process') { throw new Error('Linux embedded MPV manifest must use external-mpv-process origin.'); }" diff --git a/apps/electron-backend/project.json b/apps/electron-backend/project.json index ec1cff48d..fc23eea78 100644 --- a/apps/electron-backend/project.json +++ b/apps/electron-backend/project.json @@ -52,7 +52,16 @@ ".deps/**", "obj.target/**", "**/.deps/**", - "**/obj.target/**" + "**/obj.target/**", + "obj/**", + "**/obj/**", + "**/*.pdb", + "**/*.iobj", + "**/*.ipdb", + "**/*.ilk", + "**/*.exp", + "**/*.lib", + "**/*.dll.a" ] } ] @@ -105,7 +114,16 @@ ".deps/**", "obj.target/**", "**/.deps/**", - "**/obj.target/**" + "**/obj.target/**", + "obj/**", + "**/obj/**", + "**/*.pdb", + "**/*.iobj", + "**/*.ipdb", + "**/*.ilk", + "**/*.exp", + "**/*.lib", + "**/*.dll.a" ] } ] diff --git a/tools/packaging/electron-package-identity.test.mjs b/tools/packaging/electron-package-identity.test.mjs index bbfaf132e..809ff4231 100644 --- a/tools/packaging/electron-package-identity.test.mjs +++ b/tools/packaging/electron-package-identity.test.mjs @@ -119,8 +119,10 @@ test('Linux package identity does not expose the internal Electron backend proje }); test('GitHub Releases auto-update metadata is generated and uploaded', () => { + // \r?\n keeps this host-agnostic: Windows checkouts with autocrlf see + // CRLF in the workflow file. const releaseFiles = buildAndMakeWorkflow.match( - /files: \|\n([\s\S]*?)\n\s+env:/ + /files: \|\r?\n([\s\S]*?)\r?\n\s+env:/ )?.[1]; assert.ok(releaseFiles, 'release upload files block must exist'); @@ -307,7 +309,13 @@ test('embedded MPV package validation accepts Windows runtime files and Linux pr ['windows', join('lib', 'mpv.dll')], ['windows', join('lib', 'libmpv.dll')], ]) { - const resourceDir = join(tempDir, platform); + // One fixture dir per runtime-file scenario: the frame-copy + // artifacts written below must not leak into the next + // iteration's missing-artifact assertions. + const resourceDir = join( + tempDir, + `${platform}-${runtimeFile.replace(/[\\/]/g, '_')}` + ); const nativeDir = join( resourceDir, 'app.asar.unpacked', @@ -322,6 +330,29 @@ test('embedded MPV package validation accepts Windows runtime files and Linux pr ); fs.writeFileSync(join(nativeDir, runtimeFile), ''); + // Windows packages that ship the addon must also ship the + // frame-copy engine artifacts built by the same binding.gyp run. + const missingWindowsFrameCopyErrors = validatePackagedEmbeddedMpv( + resourceDir, + { platform, required: true } + ); + assert.ok( + missingWindowsFrameCopyErrors.some((error) => + error.includes('iptvnator_mpv_helper.exe') + ) + ); + assert.ok( + missingWindowsFrameCopyErrors.some((error) => + error.includes('embedded_mpv_frame_reader.node') + ) + ); + + fs.writeFileSync(join(nativeDir, 'iptvnator_mpv_helper.exe'), ''); + fs.writeFileSync( + join(nativeDir, 'embedded_mpv_frame_reader.node'), + '' + ); + assert.deepEqual( validatePackagedEmbeddedMpv(resourceDir, { platform, diff --git a/tools/packaging/embedded-mpv-packaging.cjs b/tools/packaging/embedded-mpv-packaging.cjs index 3516e2950..afb376c8e 100644 --- a/tools/packaging/embedded-mpv-packaging.cjs +++ b/tools/packaging/embedded-mpv-packaging.cjs @@ -540,12 +540,16 @@ function validatePackagedEmbeddedMpv(resourceDir, options = {}) { return errors; } - if (platform === 'darwin') { + if (platform === 'darwin' || platform === 'win32') { // The frame-copy engine artifacts are built by the same binding.gyp - // run as the addon; a macOS package that ships the addon without - // them would silently lose the engine (support probe hides it). + // run as the addon; a macOS/Windows package that ships the addon + // without them would silently lose the engine (support probe hides + // it). Linux packages intentionally strip the helper until the + // bundled-libmpv runtime lands (see electron-after-pack.cjs). const missingFrameCopyArtifacts = [ - 'iptvnator_mpv_helper', + platform === 'win32' + ? 'iptvnator_mpv_helper.exe' + : 'iptvnator_mpv_helper', 'embedded_mpv_frame_reader.node', ] .map((name) => path.join(unpackedNativeDir, name))