Skip to content

Commit eb6420a

Browse files
authored
chore(🏗️): Automatic detection of duplicate header files (#3212)
1 parent 48e2349 commit eb6420a

File tree

3 files changed

+48
-25
lines changed

3 files changed

+48
-25
lines changed

packages/skia/cpp/api/JsiSkPath.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
#include "include/core/SkStrokeRec.h"
2525
#include "include/effects/SkDashPathEffect.h"
2626
#include "include/effects/SkTrimPathEffect.h"
27-
#include "include/pathops/SkPathOps.h"
2827
#include "include/utils/SkParsePath.h"
2928
#include "include/utils/SkTextUtils.h"
3029

30+
#include "modules/pathops/include/SkPathOps.h"
31+
3132
#pragma clang diagnostic pop
3233

3334
namespace RNSkia {

packages/skia/cpp/api/JsiSkPathFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "RNSkLog.h"
1515
#include "include/core/SkPath.h"
16-
#include "include/pathops/SkPathOps.h"
16+
#include "modules/pathops/include/SkPathOps.h"
1717

1818
#pragma clang diagnostic pop
1919

packages/skia/scripts/skia-configuration.ts

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -320,32 +320,54 @@ export const copyHeaders = () => {
320320
"mkdir -p ./cpp/skia/modules/skunicode/include/",
321321
"cp -a ../../externals/skia/modules/skunicode/include/SkUnicode.h ./cpp/skia/modules/skunicode/include/.",
322322

323-
// Remove migrated headers
324-
//grep -R "Delete this after migrating clients" cpp
325-
"rm -rf ./cpp/skia/include/gpu/GrContextThreadSafeProxy.h",
326-
"rm -rf ./cpp/skia/include/gpu/GrDirectContext.h",
327-
"rm -rf ./cpp/skia/include/gpu/GrBackendSemaphore.h",
328-
"rm -rf ./cpp/skia/include/gpu/mock/GrMockTypes.h",
329-
"rm -rf ./cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h",
330-
"rm -rf ./cpp/skia/include/gpu/GrTypes.h",
331-
"rm -rf ./cpp/skia/include/gpu/vk/GrVkTypes.h",
332-
"rm -rf ./cpp/skia/include/gpu/GrDriverBugWorkarounds.h",
333-
"rm -rf ./cpp/skia/include/gpu/GrContextOptions.h",
334-
"rm -rf ./cpp/skia/include/gpu/gl/GrGLExtensions.h",
335-
"rm -rf ./cpp/skia/include/gpu/gl/GrGLAssembleInterface.h",
336-
"rm -rf ./cpp/skia/include/gpu/gl/GrGLTypes.h",
337-
"rm -rf ./cpp/skia/include/gpu/gl/GrGLConfig.h",
338-
"rm -rf ./cpp/skia/include/gpu/gl/GrGLFunctions.h",
339-
"rm -rf ./cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h",
340-
"rm -rf ./cpp/skia/include/gpu/gl/GrGLInterface.h",
341-
"rm -rf ./cpp/skia/include/gpu/GrYUVABackendTextures.h",
342-
"rm -rf ./cpp/skia/include/gpu/GrRecordingContext.h",
343-
"rm -rf ./cpp/skia/include/gpu/GrBackendSurface.h",
344-
"rm -rf ./cpp/skia/include/gpu/d3d/GrD3DBackendContext.h",
345-
"rm -rf ./cpp/skia/include/gpu/d3d/GrD3DTypes.h",
346323
"rm -rf ./cpp/skia/include/pathops/SkPathOps.h",
347324
].map((cmd) => {
348325
console.log(cmd);
349326
$(cmd);
350327
});
328+
329+
// Check for duplicate header names and issue warnings
330+
const duplicateHeaders = $(
331+
"find ./cpp -name '*.h' -type f | sed 's/.*\\///' | sort | uniq -d"
332+
).toString();
333+
if (duplicateHeaders.trim()) {
334+
console.warn("⚠️ WARNING: Found duplicate header names:");
335+
let hasNonGraphiteDuplicates = false;
336+
337+
duplicateHeaders
338+
.split("\n")
339+
.filter(Boolean)
340+
.forEach((filename: string) => {
341+
const fullPaths = $(
342+
`find ./cpp -name "${filename}" -type f`
343+
).toString();
344+
const paths = fullPaths.split("\n").filter(Boolean);
345+
346+
// Check if any of the paths contain 'graphite'
347+
const hasGraphitePath = paths.some((filePath: string) =>
348+
filePath.includes("graphite")
349+
);
350+
351+
console.warn(` ${filename}:`);
352+
paths.forEach((filePath: string) => {
353+
console.warn(` ${filePath}`);
354+
});
355+
356+
// If it's a Graphite-related duplicate and GRAPHITE is false, don't count it as an error
357+
if (!hasGraphitePath || GRAPHITE) {
358+
hasNonGraphiteDuplicates = true;
359+
} else {
360+
console.warn(
361+
` (Graphite-related duplicate - ignoring since GRAPHITE=${GRAPHITE})`
362+
);
363+
}
364+
});
365+
366+
if (hasNonGraphiteDuplicates) {
367+
console.error(
368+
"❌ ERROR: Duplicate headers found that will cause iOS build conflicts!"
369+
);
370+
process.exit(1);
371+
}
372+
}
351373
};

0 commit comments

Comments
 (0)