Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 6 additions & 67 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -580,36 +580,16 @@ jobs:
yarn ci:windows --arch ${{ matrix.platform }}
}
working-directory: packages/example-windows
continue-on-error: true
# GitHub Actions currently does not support outputs from jobs with matrices
# The workaround is to upload artifacts to communicate between jobs
- name: Set build result
id: build_result
if: ${{ steps.affected.outputs.windows != '' }}
run: |
path=${{ format('windows-build.{0}.{1}.result', matrix.platform, matrix.configuration) }}
echo "${{ steps.build.outcome }}" >> $path
echo "path=$path" >> "$GITHUB_OUTPUT"
shell: bash
- name: Upload build result
if: ${{ steps.affected.outputs.windows != '' }}
uses: actions/upload-artifact@v7
with:
name: ${{ steps.build_result.outputs.path }}
path: ${{ steps.build_result.outputs.path }}
retention-days: 1
archive: false
overwrite: true
- name: Upload build logs
if: ${{ steps.affected.outputs.windows != '' && steps.build.outcome != 'success' }}
if: failure()
uses: actions/upload-artifact@v7
with:
name: windows-msbuild.binlog
path: packages/example-windows/windows/*.binlog
retention-days: 14
overwrite: true
- name: Test
if: ${{ steps.affected.outputs.windows != '' && matrix.platform == 'x64' && steps.build.outcome == 'success' }}
if: ${{ steps.affected.outputs.windows != '' && matrix.platform == 'x64' }}
run: |
../../../app/scripts/build/MSBuild.ps1 -Configuration ${{ matrix.configuration }} -Platform ${{ matrix.platform }} -Target Build ReactAppTests.vcxproj
../../../app/scripts/build/VSTest.ps1 ${{ matrix.platform }}\${{ matrix.configuration }}\ReactAppTests.dll
Expand All @@ -634,7 +614,7 @@ jobs:
- name: Initialize test app
uses: ./.github/actions/init-test-app
with:
arguments: -p windows --version 0.82.1
arguments: -p windows --version 0.83.0
- name: Bundle JavaScript
run: |
yarn build:windows
Expand All @@ -652,57 +632,15 @@ jobs:
run: |
yarn windows --logging --no-packager --no-launch --no-deploy
working-directory: template-example
continue-on-error: true
# GitHub Actions currently does not support outputs from jobs with matrices
# The workaround is to upload artifacts to communicate between jobs
- name: Set build result
id: build_result
if: ${{ steps.affected.outputs.windows != '' }}
run: |
path=${{ format('windows-template-build.{0}.result', matrix.template) }}
echo "${{ steps.build.outcome }}" >> $path
echo "path=$path" >> "$GITHUB_OUTPUT"
shell: bash
- name: Upload build result
if: ${{ steps.affected.outputs.windows != '' }}
uses: actions/upload-artifact@v7
with:
name: ${{ steps.build_result.outputs.path }}
path: ${{ steps.build_result.outputs.path }}
retention-days: 1
archive: false
overwrite: true
- name: Upload build logs
if: ${{ steps.affected.outputs.windows != '' && steps.build.outcome != 'success' }}
if: failure()
uses: actions/upload-artifact@v7
with:
name: windows-template-msbuild.binlog
path: template-example/windows/*.binlog
retention-days: 14
overwrite: true
timeout-minutes: 60
windows-result:
name: "Windows [result]"
permissions: {}
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'schedule' }}
needs:
- windows
- windows-template
steps:
- name: Download build results
uses: actions/download-artifact@v8
with:
path: results
pattern: "windows-*.result"
merge-multiple: true
- name: Warn if Windows builds failed
run: |
for file in results/*; do
if grep -q fail "$file"; then
echo "::warning::$(basename $file .result): $(cat $file) (this is non-blocking but should be investigated)"
fi
done
release:
permissions:
contents: write # create releases (Nx Release)
Expand All @@ -715,7 +653,8 @@ jobs:
- android-template
- macos
- macos-template
- windows-result
- windows
- windows-template
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'schedule' }}
steps:
Expand Down
48 changes: 24 additions & 24 deletions packages/app/test/pack.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -284,35 +284,35 @@ describe("npm pack", () => {
"windows/Win32/AutolinkedNativeModules.g.h",
"windows/Win32/DevMenu.cpp",
"windows/Win32/DevMenu.h",
"windows/Win32/Images/SplashScreen.scale-100.png",
"windows/Win32/Images/SplashScreen.scale-200.png",
"windows/Win32/Images/SplashScreen.scale-400.png",
"windows/Win32/Images/Square150x150Logo.scale-100.png",
"windows/Win32/Images/Square150x150Logo.scale-200.png",
"windows/Win32/Images/Square150x150Logo.scale-400.png",
"windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png",
"windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png",
"windows/Win32/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png",
"windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-16.png",
"windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-256.png",
"windows/Win32/Images/Square44x44Logo.altform-unplated_targetsize-48.png",
"windows/Win32/Images/Square44x44Logo.scale-100.png",
"windows/Win32/Images/Square44x44Logo.scale-200.png",
"windows/Win32/Images/Square44x44Logo.scale-400.png",
"windows/Win32/Images/Square44x44Logo.targetsize-16.png",
"windows/Win32/Images/Square44x44Logo.targetsize-256.png",
"windows/Win32/Images/Square44x44Logo.targetsize-48.png",
"windows/Win32/Images/StoreLogo.scale-100.png",
"windows/Win32/Images/StoreLogo.scale-200.png",
"windows/Win32/Images/StoreLogo.scale-400.png",
"windows/Win32/Images/Wide310x150Logo.scale-200.png",
"windows/Win32/Main.cpp",
"windows/Win32/Main.h",
"windows/Win32/Main.ico",
"windows/Win32/Main.rc",
"windows/Win32/Main.small.ico",
"windows/Win32/Package.appxmanifest",
"windows/Win32/ReactApp.Package.wapproj",
"windows/Win32/ReactApp.Package/Images/SplashScreen.scale-100.png",
"windows/Win32/ReactApp.Package/Images/SplashScreen.scale-200.png",
"windows/Win32/ReactApp.Package/Images/SplashScreen.scale-400.png",
"windows/Win32/ReactApp.Package/Images/Square150x150Logo.scale-100.png",
"windows/Win32/ReactApp.Package/Images/Square150x150Logo.scale-200.png",
"windows/Win32/ReactApp.Package/Images/Square150x150Logo.scale-400.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.altform-unplated_targetsize-16.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.altform-unplated_targetsize-256.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.altform-unplated_targetsize-48.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.scale-100.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.scale-200.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.scale-400.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.targetsize-16.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.targetsize-256.png",
"windows/Win32/ReactApp.Package/Images/Square44x44Logo.targetsize-48.png",
"windows/Win32/ReactApp.Package/Images/StoreLogo.scale-100.png",
"windows/Win32/ReactApp.Package/Images/StoreLogo.scale-200.png",
"windows/Win32/ReactApp.Package/Images/StoreLogo.scale-400.png",
"windows/Win32/ReactApp.Package/Images/Wide310x150Logo.scale-200.png",
"windows/Win32/ReactApp.Package/Package.appxmanifest",
"windows/Win32/ReactApp.Package/ReactApp.Package.wapproj",
"windows/Win32/ReactApp.vcxproj",
"windows/Win32/ReactApp.vcxproj.filters",
"windows/Win32/pch.cpp",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/test/windows/copyAndReplace.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { fs, setMockFiles } from "../fs.mock.mts";

describe("copyAndReplace()", () => {
const copyAndReplace: typeof copyAndReplaceActual = (src, dst, r) =>
copyAndReplaceActual(src, dst, r, fs.promises);
copyAndReplaceActual(src, dst, r, fs);

const readTextFile: typeof readTextFileActual = (p) =>
readTextFileActual(p, fs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ProjectGuid>{b44cead7-fbff-4a17-95eb-ff5434bbd79d}</ProjectGuid>
<TargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)'!=''">$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<EntryPointProjectUniqueName>ReactApp.vcxproj</EntryPointProjectUniqueName>
<EntryPointProjectUniqueName>..\ReactApp.vcxproj</EntryPointProjectUniqueName>
<DebuggerType>NativeOnly</DebuggerType>
<BackgroundTaskDebugEngines>NativeOnly</BackgroundTaskDebugEngines>
</PropertyGroup>
Expand Down Expand Up @@ -87,7 +87,7 @@
<!-- ReactApp content items -->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="ReactApp.vcxproj">
<ProjectReference Include="..\ReactApp.vcxproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
Expand Down
23 changes: 12 additions & 11 deletions packages/app/windows/app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,19 @@ export async function copyAndReplace(
srcPath,
destPath,
replacements,
fs = nodefs.promises
fs = nodefs
) {
mkdir_p(path.dirname(destPath), fs);

if (!replacements) {
return cp_r(srcPath, destPath, nodefs);
return cp_r(srcPath, destPath, fs);
}

const fsp = fs.promises;

// Treat as text file
const data = await fs.readFile(srcPath, { encoding: "utf-8" });
return writeTextFile(destPath, replaceContent(data, replacements), fs);
const data = await fsp.readFile(srcPath, { encoding: "utf-8" });
return writeTextFile(destPath, replaceContent(data, replacements), fsp);
}

/**
Expand Down Expand Up @@ -185,8 +189,7 @@ export async function generateSolution(destPath, options, fs = nodefs) {
mkdir_p(destPath, fs);

/** @type {typeof copyAndReplace} */
const copyAndReplaceAsync = (src, dst, r) =>
copyAndReplace(src, dst, r, fs.promises);
const copyAndReplaceAsync = (src, dst, r) => copyAndReplace(src, dst, r, fs);

const copyTasks = projectFiles.map(([file, replacements]) =>
copyAndReplaceAsync(
Expand All @@ -208,6 +211,7 @@ export async function generateSolution(destPath, options, fs = nodefs) {
const slnPath = path.join(destPath, `${info.bundle.appName}.sln`);
const vcxprojPath = path.join(projectFilesDestPath, projectFileName);
const vcxprojLocalPath = path.relative(destPath, vcxprojPath);
const wapprojPath = "ReactApp.Package\\ReactApp.Package.wapproj";
copyTasks.push(
writeTextFile(
slnPath,
Expand All @@ -230,11 +234,8 @@ export async function generateSolution(destPath, options, fs = nodefs) {
`"${path.relative(destPath, rnWindowsPath)}\\`
)
.replace(
"ReactApp.Package\\ReactApp.Package.wapproj", // Win32
vcxprojLocalPath.replace(
"ReactApp.vcxproj",
"ReactApp.Package.wapproj"
)
wapprojPath, // Win32
vcxprojLocalPath.replace("ReactApp.vcxproj", wapprojPath)
)
.replace("ReactApp\\ReactApp.vcxproj", vcxprojLocalPath) // Win32
.replace("ReactTestApp\\ReactTestApp.vcxproj", vcxprojLocalPath) // UWP
Expand Down
6 changes: 3 additions & 3 deletions packages/app/windows/win32.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export function configureForWin32({
projectFileName: "ReactApp.vcxproj",
projectFiles: [
["AutolinkedNativeModules.g.cpp"],
["Images"],
["Main.ico"],
["Main.rc"],
["Main.small.ico"],
["Package.appxmanifest"],
["ReactApp.Package/Images"],
["ReactApp.Package/Package.appxmanifest"],
[
"ReactApp.Package.wapproj",
"ReactApp.Package/ReactApp.Package.wapproj",
{
"<!-- ReactApp content items -->": bundle.contentItems,
},
Expand Down
Loading