diff --git a/.gitmodules b/.gitmodules index 53aed4f760..7fd7bd83d8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "externals/skia"] path = externals/skia url = https://chromium.googlesource.com/skia/ - branch = chrome/m121 + branch = chrome/m119 [submodule "externals/depot_tools"] path = externals/depot_tools url = https://chromium.googlesource.com/chromium/tools/depot_tools.git diff --git a/docs/static/img/paragraph/boundingbox-ios.png b/docs/static/img/paragraph/boundingbox-ios.png deleted file mode 100644 index 9d970dc3f9..0000000000 Binary files a/docs/static/img/paragraph/boundingbox-ios.png and /dev/null differ diff --git a/externals/skia b/externals/skia index e8d7db9fac..89907a0ce7 160000 --- a/externals/skia +++ b/externals/skia @@ -1 +1 @@ -Subproject commit e8d7db9facb4f23ab15d6205204d9b4bb61fe538 +Subproject commit 89907a0ce7c0c883898b8c88b55b7b7f733f7058 diff --git a/package/src/__tests__/snapshots/paragraph/paragraph-bounding-box-ios.png b/package/src/__tests__/snapshots/paragraph/paragraph-bounding-box-ios.png index 177833769e..70b373201a 100644 Binary files a/package/src/__tests__/snapshots/paragraph/paragraph-bounding-box-ios.png and b/package/src/__tests__/snapshots/paragraph/paragraph-bounding-box-ios.png differ diff --git a/package/src/__tests__/snapshots/svg/text.png b/package/src/__tests__/snapshots/svg/text.png deleted file mode 100644 index 70383cf077..0000000000 Binary files a/package/src/__tests__/snapshots/svg/text.png and /dev/null differ diff --git a/package/src/renderer/__tests__/e2e/SVG.spec.tsx b/package/src/renderer/__tests__/e2e/SVG.spec.tsx index 94f70c47fb..9fb174b5d9 100644 --- a/package/src/renderer/__tests__/e2e/SVG.spec.tsx +++ b/package/src/renderer/__tests__/e2e/SVG.spec.tsx @@ -55,15 +55,6 @@ const tiger = new SVGAsset( 800 ); -// const text = new SVGAsset( -// ` -// -// My Text -// `, -// 290, -// 500 -// ); - const svgWithoutSize = { __typename__: "SVG" as const, width() { @@ -75,7 +66,7 @@ const svgWithoutSize = { dispose() {}, source() { return ` - + `; }, }; @@ -204,14 +195,4 @@ describe("Displays SVGs", () => { ); checkImage(image, docPath("opacity-tiger.png")); }); - - // itRunsE2eOnly("can render text", async () => { - // const image = await surface.draw( - // <> - // - // - // - // ); - // checkImage(image, "snapshots/svg/text.png"); - // }); }); diff --git a/scripts/build-libgrapheme-ios.ts b/scripts/build-libgrapheme-ios.ts new file mode 100644 index 0000000000..7d21e64457 --- /dev/null +++ b/scripts/build-libgrapheme-ios.ts @@ -0,0 +1,48 @@ +import os from "os"; +import fs from "fs"; +import { executeCmdSync } from "./utils"; + +// Build instructions for building build-libgrapheme-ios +export const buildLibGraphemeiOS = async () => { + // Empty the generate_headers.py file + console.log("Patching the Skia buildscript 'generate_headers.py'..."); + const file = fs.openSync( + "./third_party/libgrapheme/generate_headers.py", + "w" + ); + fs.writeSync( + file, + "print('[generate_headers.py] This file has been patched by the RN Skia build script.')" + ); + fs.closeSync(file); + console.log("Finished patching generate_headers.py."); + + console.log("Building libgrapheme for iOS..."); + + // Change to the third_party/libgrapheme directory + const currentDir = process.cwd(); + try { + process.chdir("./third_party/externals/libgrapheme"); + // Check if the output has been created - if so skip the build + if (!fs.existsSync("./gen/case.o")) { + // Run configure + console.log("Configuring libgrapheme..."); + executeCmdSync("./configure"); + // Up the file handle limit on mac: + if (os.platform() === "darwin") { + console.log( + "Extending file handle count on Mac to avoid `Too many open files` error..." + ); + executeCmdSync("ulimit -n 4096"); + } + // Run make + console.log("Building libgrapheme..."); + executeCmdSync("make"); + console.log("libgrapheme successfully built."); + } else { + console.log("Skipping configuring libgrapheme as it is already built."); + } + } finally { + process.chdir(currentDir); + } +}; diff --git a/scripts/build-skia-ios.ts b/scripts/build-skia-ios.ts index 8d12620676..20bab85771 100644 --- a/scripts/build-skia-ios.ts +++ b/scripts/build-skia-ios.ts @@ -1,8 +1,9 @@ import { configurations } from "./skia-configuration"; -import { executeCmd, executeCmdSync } from "./utils"; +import { executeCmd } from "./utils"; const configuration = configurations.ios; +console.log("Building skia for iOS..."); let command = ""; Object.keys(configuration.targets).forEach((targetKey) => { @@ -11,7 +12,6 @@ Object.keys(configuration.targets).forEach((targetKey) => { `yarn ts-node ./scripts/build-skia.ts ios ${targetKey}`; }); -console.log("Building skia for iOS..."); executeCmd(command, "iOS", () => { console.log(`Done building skia for iOS.`); }); diff --git a/scripts/build-skia.ts b/scripts/build-skia.ts index 5074a14af7..c5a3a72216 100644 --- a/scripts/build-skia.ts +++ b/scripts/build-skia.ts @@ -1,7 +1,6 @@ import { executeCmd, executeCmdSync } from "./utils"; import { exit } from "process"; import { commonArgs, configurations, PlatformName } from "./skia-configuration"; - const fs = require("fs"); const typedKeys = (obj: T) => Object.keys(obj) as (keyof T)[]; @@ -190,12 +189,13 @@ try { executeCmdSync("PATH=../depot_tools/:$PATH python3 tools/git-sync-deps"); console.log("gclient sync done"); - - // Generate libgrapheme headers - if (SelectedPlatform === "ios") { - console.log("Generating libgrapheme headers..."); - const libgraphemeDir = `./third_party/externals/libgrapheme`; - executeCmdSync(`cd ${libgraphemeDir} && ./configure && make clean && make`); + // lets check for any dependencies + if (platform.dependencies) { + console.log(`Found dependencies for platform ${SelectedPlatform}`); + platform.dependencies.forEach((dep) => { + console.log(`Running dependency ${dep.name}`); + dep.executable(); + }); } try { diff --git a/scripts/skia-configuration.ts b/scripts/skia-configuration.ts index 8cd2d9acfa..f00e7bd5c5 100644 --- a/scripts/skia-configuration.ts +++ b/scripts/skia-configuration.ts @@ -1,3 +1,6 @@ +import { buildLibGraphemeiOS } from "./build-libgrapheme-ios"; +import { executeCmdSync } from "./utils"; + const NdkDir: string = process.env.ANDROID_NDK ?? ""; export const BUILD_WITH_PARAGRAPH = true; @@ -70,6 +73,7 @@ export type Platform = { outputRoot: string; outputNames: string[]; options?: Arg[]; + dependencies?: { name: string; executable: () => void }[]; }; export const configurations: Configuration = { @@ -160,5 +164,11 @@ export const configurations: Configuration = { "libsksg.a", ...ParagraphOutputs, ], + dependencies: [ + { + name: "libgrapheme", + executable: buildLibGraphemeiOS, + }, + ], }, };