Skip to content

Commit 3cf6e22

Browse files
authored
fix(🍏): fix duplicate header names for iOS (#261)
1 parent d0e4dbe commit 3cf6e22

4 files changed

Lines changed: 45 additions & 5 deletions

File tree

apps/example/ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ PODS:
14071407
- ReactCommon/turbomodule/bridging
14081408
- ReactCommon/turbomodule/core
14091409
- Yoga
1410-
- react-native-skia (2.0.0):
1410+
- react-native-skia (2.2.14):
14111411
- DoubleConversion
14121412
- glog
14131413
- hermes-engine
@@ -1433,7 +1433,7 @@ PODS:
14331433
- ReactCommon/turbomodule/bridging
14341434
- ReactCommon/turbomodule/core
14351435
- Yoga
1436-
- react-native-wgpu (0.2.5):
1436+
- react-native-wgpu (0.2.6):
14371437
- DoubleConversion
14381438
- glog
14391439
- hermes-engine
@@ -2245,8 +2245,8 @@ SPEC CHECKSUMS:
22452245
React-Mapbuffer: c3f4b608e4a59dd2f6a416ef4d47a14400194468
22462246
React-microtasksnativemodule: 054f34e9b82f02bd40f09cebd4083828b5b2beb6
22472247
react-native-safe-area-context: 562163222d999b79a51577eda2ea8ad2c32b4d06
2248-
react-native-skia: 99362ce77dff006719636c97f16c9713e3ec221e
2249-
react-native-wgpu: 091c71fc96e5470bdc69b5b9f1bc632540cd8a06
2248+
react-native-skia: a00cb2132c9f8a90d3dade66c56c2325c28a9fb6
2249+
react-native-wgpu: 770f8c16bebe46a176a14f16d1058ed6f6cf14b8
22502250
React-NativeModulesApple: 2c4377e139522c3d73f5df582e4f051a838ff25e
22512251
React-oscompat: ef5df1c734f19b8003e149317d041b8ce1f7d29c
22522252
React-perflogger: 9a151e0b4c933c9205fd648c246506a83f31395d

packages/webgpu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-wgpu",
3-
"version": "0.2.5",
3+
"version": "0.2.6",
44
"description": "React Native WebGPU",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

packages/webgpu/scripts/build/dawn-configuration.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable max-len */
22
import { $, checkFileExists, runAsync } from "./util";
3+
import { checkDuplicateHeaders } from "../codegen/util";
34

45
export const libs = ["libwebgpu_dawn"] as const;
56

@@ -32,8 +33,12 @@ export const copyHeaders = () => {
3233
`rm -rf ${projectRoot}/cpp/dawn/webgpu.h`,
3334
`rm -rf ${projectRoot}/cpp/dawn/webgpu_cpp.h`,
3435
`rm -rf ${projectRoot}/cpp/dawn/wire`,
36+
`rm -rf ${projectRoot}/cpp/webgpu/webgpu_cpp_print.h`,
3537
`cp externals/dawn/src/dawn/dawn.json ${projectRoot}/libs`,
3638
].map((cmd) => $(cmd));
39+
40+
// Check for duplicate header names and issue warnings
41+
checkDuplicateHeaders(`${projectRoot}/cpp`);
3742
};
3843

3944
const serializeCMakeArgs = (args: Record<string, string>) => {

packages/webgpu/scripts/codegen/util.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,38 @@ export const writeFile = (
3535
`${labels[label]} ${file.substring(file.indexOf("/package/") + "/package/".length)}`,
3636
);
3737
};
38+
39+
export const checkDuplicateHeaders = (cppPath: string) => {
40+
// Check for duplicate header names and issue warnings
41+
const duplicateHeaders = $(
42+
`find ${cppPath} -name '*.h' -type f | sed 's/.*\\///' | sort | uniq -d`,
43+
).toString();
44+
if (duplicateHeaders.trim()) {
45+
console.warn("⚠️ WARNING: Found duplicate header names:");
46+
let hasConflicts = false;
47+
48+
duplicateHeaders
49+
.split("\n")
50+
.filter(Boolean)
51+
.forEach((filename: string) => {
52+
const fullPaths = $(
53+
`find ${cppPath} -name "${filename}" -type f`,
54+
).toString();
55+
const paths = fullPaths.split("\n").filter(Boolean);
56+
57+
console.warn(` ${filename}:`);
58+
paths.forEach((filePath: string) => {
59+
console.warn(` ${filePath}`);
60+
});
61+
62+
hasConflicts = true;
63+
});
64+
65+
if (hasConflicts) {
66+
console.error(
67+
"❌ ERROR: Duplicate headers found that will cause iOS build conflicts!",
68+
);
69+
exit(1);
70+
}
71+
}
72+
};

0 commit comments

Comments
 (0)