Skip to content

Commit 22c62e5

Browse files
authored
chore(๐Ÿงน): remove what the in-repo Dawn build left behind (#610)
Dawn comes from react-native-webgpu-dawn since #507 and the codegen went in #424. Drop the gitignore rules, cpplint excludes and devDependencies that only served them, and make check-dawn fail on header copies left over from the old build: they sit before the package's include directory on every include path and silently shadow the headers the binaries were built from.
1 parent fd27a5d commit 22c62e5

4 files changed

Lines changed: 58 additions & 478 deletions

File tree

โ€Ž.gitignoreโ€Ž

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
!packages/webgpu/scripts/build
21
# Yarn
3-
.package/.yarn/*
42
.yarn/*
53
!.yarn/patches
64
!.yarn/plugins
@@ -59,23 +57,9 @@ buck-out/
5957

6058
# Build
6159
dist
62-
package/lib
6360
.vscode
6461
*.tgz
6562

66-
67-
# Externals
68-
packages/webgpu/libs
69-
# Dawn headers used to be copied here; the directory only holds the
70-
# vendored Dawn sources under common/ now (see scripts/check-dawn.ts).
71-
packages/webgpu/cpp/dawn/*
72-
!packages/webgpu/cpp/dawn/common/
73-
packages/webgpu/cpp/webgpu/
74-
packages/webgpu/lib
75-
!packages/webgpu/scripts/build
76-
artifacts/
77-
78-
7963
# Cocoapods
8064
#
8165
apps/example/**/Pods

โ€Žpackages/webgpu/package.jsonโ€Ž

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"clang-format-ios": "find apple/ -iname \"*.h\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i",
4242
"clang-format-android": "find android/cpp/ -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
4343
"clang-format-common": "find cpp/rnwgpu -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
44-
"cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=example --exclude=android/.cxx --exclude=cpp/webgpu --exclude=cpp/dawn --exclude=ios --exclude=android/build --exclude=node_modules --recursive .",
44+
"cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=android/.cxx --exclude=cpp/dawn --exclude=libs --exclude=android/build --exclude=node_modules --recursive .",
4545
"check-dawn": "tsx scripts/check-dawn.ts"
4646
},
4747
"keywords": [
@@ -80,9 +80,7 @@
8080
"@types/seedrandom": "^3.0.8",
8181
"@types/ws": "^8.5.10",
8282
"@webgpu/types": "0.1.65",
83-
"baseline-browser-mapping": "^2.9.14",
8483
"clang-format": "^1.8.0",
85-
"del-cli": "^5.1.0",
8684
"eslint": "9.35.0",
8785
"eslint-config-react-native-wcandillon": "5.0.1",
8886
"eslint-plugin-import": "2.32.0",
@@ -99,7 +97,6 @@
9997
"react-native-reanimated": "4.6.0",
10098
"react-native-web": "^0.21.2",
10199
"react-native-worklets": "0.12.2",
102-
"rimraf": "^5.0.7",
103100
"seedrandom": "^3.0.5",
104101
"semantic-release": "^25.0.9",
105102
"semantic-release-yarn": "^3.0.2",
@@ -108,8 +105,7 @@
108105
"typescript": "^5.2.2",
109106
"webgpu": "0.4.0",
110107
"wgpu-matrix": "^3.0.2",
111-
"ws": "^8.18.0",
112-
"yargs": "^17.7.2"
108+
"ws": "^8.18.0"
113109
},
114110
"dependencies": {
115111
"react-native-webgpu-dawn": "157.1.0"

โ€Žpackages/webgpu/scripts/check-dawn.tsโ€Ž

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
// Runs from `yarn check-dawn`, in CI right after `yarn install`.
1313

14-
import { existsSync, readFileSync } from "fs";
14+
import { existsSync, readFileSync, readdirSync } from "fs";
1515
import { dirname, join } from "path";
1616

1717
const dawnPackageJson =
@@ -49,6 +49,27 @@ const dawnWorkarounds = [
4949
];
5050

5151
const root = join(__dirname, "..");
52+
53+
// Until #507 the build copied Dawn's headers into cpp/webgpu and cpp/dawn.
54+
// Both come before the package's include directory on every include path
55+
// (podspec HEADER_SEARCH_PATHS, android/CMakeLists.txt), so a copy left over
56+
// from that build silently shadows the headers the binaries were built from.
57+
// cpp/dawn/common is vendored on purpose (see the entry above).
58+
const staleHeaderDirs = [
59+
"cpp/webgpu",
60+
...(existsSync(join(root, "cpp/dawn"))
61+
? readdirSync(join(root, "cpp/dawn"))
62+
.filter((entry) => entry !== "common" && !entry.startsWith("."))
63+
.map((entry) => `cpp/dawn/${entry}`)
64+
: []),
65+
].filter((dir) => existsSync(join(root, dir)));
66+
if (staleHeaderDirs.length > 0) {
67+
console.error(
68+
`โŒ Stale Dawn header copies shadow react-native-webgpu-dawn's include directory: ${staleHeaderDirs.join(", ")}. Delete them; Dawn's headers come from the package since #507.`,
69+
);
70+
process.exit(1);
71+
}
72+
5273
let failed = false;
5374
for (const workaround of dawnWorkarounds) {
5475
const present = workaround.files.filter((file) => {

0 commit comments

Comments
ย (0)