|
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [main] |
| 5 | + branches: [main, cp936-ci-verification] |
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
8 | 8 |
|
|
79 | 79 | - uses: subosito/flutter-action@v2 |
80 | 80 | with: |
81 | 81 | channel: stable |
82 | | - - name: Verify /utf-8 is set for MSVC |
| 82 | + - uses: ilammy/msvc-dev-cmd@v1 |
| 83 | + |
| 84 | + - name: Verify /utf-8 is set for MSVC in windows/CMakeLists.txt |
83 | 85 | shell: bash |
84 | 86 | run: | |
85 | 87 | grep -q '/utf-8' windows/CMakeLists.txt \ |
86 | 88 | || { echo "::error::windows/CMakeLists.txt is missing /utf-8 — see chinese-pc-compat.md"; exit 1; } |
87 | | - - run: cd example && flutter build windows |
| 89 | +
|
| 90 | + - name: Verify ci/cp936_repro.cpp covers every non-ASCII char in windows/ |
| 91 | + shell: bash |
| 92 | + run: python ci/check_unicode_inventory.py |
| 93 | + |
| 94 | + - name: Verify ci/cp936_repro.cpp has no UTF-8 BOM |
| 95 | + shell: bash |
| 96 | + run: | |
| 97 | + bom=$(head -c 3 ci/cp936_repro.cpp | od -An -tx1 | tr -d ' \n') |
| 98 | + if [ "$bom" = "efbbbf" ]; then |
| 99 | + echo "::error::ci/cp936_repro.cpp must not have a BOM (MSVC would auto-detect UTF-8 and bypass /source-charset:.936)" |
| 100 | + exit 1 |
| 101 | + fi |
| 102 | + echo "OK: no BOM" |
| 103 | +
|
| 104 | + - name: CP936 simulation without /utf-8 must fail with C4819/C2220 |
| 105 | + shell: cmd |
| 106 | + run: | |
| 107 | + cl /c /WX /source-charset:.936 /execution-charset:.936 /nologo ci\cp936_repro.cpp > cl.log 2>&1 |
| 108 | + set CL_EXIT=%errorlevel% |
| 109 | + type cl.log |
| 110 | + if %CL_EXIT% equ 0 ( |
| 111 | + echo ::error::Expected C4819/C2220 but compile succeeded — CP936 simulation is not triggering the bug |
| 112 | + exit /b 1 |
| 113 | + ) |
| 114 | + findstr /c:"C4819" cl.log >nul |
| 115 | + if errorlevel 1 ( |
| 116 | + echo ::error::cl.exe failed but did not emit C4819 — test is not reproducing the real bug |
| 117 | + exit /b 1 |
| 118 | + ) |
| 119 | + findstr /c:"C2220" cl.log >nul |
| 120 | + if errorlevel 1 ( |
| 121 | + echo ::error::cl.exe failed but did not emit C2220 — /WX promotion is not working as expected |
| 122 | + exit /b 1 |
| 123 | + ) |
| 124 | + echo OK: CP936 simulation reproduced C4819/C2220 as expected |
| 125 | + exit /b 0 |
| 126 | +
|
| 127 | + - name: CP936 simulation with /utf-8 must succeed (proves the fix) |
| 128 | + shell: cmd |
| 129 | + run: cl /c /WX /source-charset:.936 /execution-charset:.936 /utf-8 /nologo ci\cp936_repro.cpp |
| 130 | + |
| 131 | + - name: Build the example (generates the plugin vcxproj) |
| 132 | + run: cd example && flutter build windows |
| 133 | + |
| 134 | + - name: Verify /utf-8 is threaded into the generated plugin vcxproj |
| 135 | + shell: bash |
| 136 | + run: | |
| 137 | + vcxproj=$(find example/build/windows -name 'camera_desktop_plugin.vcxproj' | head -n1) |
| 138 | + if [ -z "$vcxproj" ]; then |
| 139 | + echo "::error::camera_desktop_plugin.vcxproj not found under example/build/windows" |
| 140 | + find example/build/windows -name '*.vcxproj' || true |
| 141 | + exit 1 |
| 142 | + fi |
| 143 | + echo "Inspecting: $vcxproj" |
| 144 | + if ! grep -q '/utf-8' "$vcxproj"; then |
| 145 | + echo "::error::/utf-8 missing from $vcxproj — CMake did not thread the flag through" |
| 146 | + echo "--- vcxproj contents ---" |
| 147 | + cat "$vcxproj" |
| 148 | + exit 1 |
| 149 | + fi |
| 150 | + echo "OK: /utf-8 present in $vcxproj" |
0 commit comments