Skip to content

Commit c8469f5

Browse files
authored
Merge pull request #2105 from Shopify/revert-2103-m121
Revert "⬆️ m121"
2 parents 11bfece + e001159 commit c8469f5

File tree

10 files changed

+70
-31
lines changed

10 files changed

+70
-31
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "externals/skia"]
22
path = externals/skia
33
url = https://chromium.googlesource.com/skia/
4-
branch = chrome/m121
4+
branch = chrome/m119
55
[submodule "externals/depot_tools"]
66
path = externals/depot_tools
77
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
-25.2 KB
Binary file not shown.

externals/skia

Submodule skia updated from e8d7db9 to 89907a0
2.75 KB
Loading
-9.94 KB
Binary file not shown.

package/src/renderer/__tests__/e2e/SVG.spec.tsx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,6 @@ const tiger = new SVGAsset(
5555
800
5656
);
5757

58-
// const text = new SVGAsset(
59-
// `<svg viewBox='0 0 290 500' width='290' height='325' xmlns='http://www.w3.org/2000/svg'>
60-
// <circle cx='31' cy='325' r='120px' fill='#c02aaa'/>
61-
// <text x="20" y="35" fill="black">My Text</text>
62-
// </svg>`,
63-
// 290,
64-
// 500
65-
// );
66-
6758
const svgWithoutSize = {
6859
__typename__: "SVG" as const,
6960
width() {
@@ -75,7 +66,7 @@ const svgWithoutSize = {
7566
dispose() {},
7667
source() {
7768
return `<svg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'>
78-
<circle cx='10' cy='10' r='10' fill='#00FFFF' />
69+
<circle cx='10' cy='10' r='10' fill='#00FFFF'/>
7970
</svg>`;
8071
},
8172
};
@@ -204,14 +195,4 @@ describe("Displays SVGs", () => {
204195
);
205196
checkImage(image, docPath("opacity-tiger.png"));
206197
});
207-
208-
// itRunsE2eOnly("can render text", async () => {
209-
// const image = await surface.draw(
210-
// <>
211-
// <Fill color="white" />
212-
// <ImageSVG svg={text} x={0} y={0} width={800} height={800} />
213-
// </>
214-
// );
215-
// checkImage(image, "snapshots/svg/text.png");
216-
// });
217198
});

scripts/build-libgrapheme-ios.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os from "os";
2+
import fs from "fs";
3+
import { executeCmdSync } from "./utils";
4+
5+
// Build instructions for building build-libgrapheme-ios
6+
export const buildLibGraphemeiOS = async () => {
7+
// Empty the generate_headers.py file
8+
console.log("Patching the Skia buildscript 'generate_headers.py'...");
9+
const file = fs.openSync(
10+
"./third_party/libgrapheme/generate_headers.py",
11+
"w"
12+
);
13+
fs.writeSync(
14+
file,
15+
"print('[generate_headers.py] This file has been patched by the RN Skia build script.')"
16+
);
17+
fs.closeSync(file);
18+
console.log("Finished patching generate_headers.py.");
19+
20+
console.log("Building libgrapheme for iOS...");
21+
22+
// Change to the third_party/libgrapheme directory
23+
const currentDir = process.cwd();
24+
try {
25+
process.chdir("./third_party/externals/libgrapheme");
26+
// Check if the output has been created - if so skip the build
27+
if (!fs.existsSync("./gen/case.o")) {
28+
// Run configure
29+
console.log("Configuring libgrapheme...");
30+
executeCmdSync("./configure");
31+
// Up the file handle limit on mac:
32+
if (os.platform() === "darwin") {
33+
console.log(
34+
"Extending file handle count on Mac to avoid `Too many open files` error..."
35+
);
36+
executeCmdSync("ulimit -n 4096");
37+
}
38+
// Run make
39+
console.log("Building libgrapheme...");
40+
executeCmdSync("make");
41+
console.log("libgrapheme successfully built.");
42+
} else {
43+
console.log("Skipping configuring libgrapheme as it is already built.");
44+
}
45+
} finally {
46+
process.chdir(currentDir);
47+
}
48+
};

scripts/build-skia-ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { configurations } from "./skia-configuration";
2-
import { executeCmd, executeCmdSync } from "./utils";
2+
import { executeCmd } from "./utils";
33

44
const configuration = configurations.ios;
55

6+
console.log("Building skia for iOS...");
67
let command = "";
78

89
Object.keys(configuration.targets).forEach((targetKey) => {
@@ -11,7 +12,6 @@ Object.keys(configuration.targets).forEach((targetKey) => {
1112
`yarn ts-node ./scripts/build-skia.ts ios ${targetKey}`;
1213
});
1314

14-
console.log("Building skia for iOS...");
1515
executeCmd(command, "iOS", () => {
1616
console.log(`Done building skia for iOS.`);
1717
});

scripts/build-skia.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { executeCmd, executeCmdSync } from "./utils";
22
import { exit } from "process";
33
import { commonArgs, configurations, PlatformName } from "./skia-configuration";
4-
54
const fs = require("fs");
65
const typedKeys = <T extends object>(obj: T) => Object.keys(obj) as (keyof T)[];
76

@@ -190,12 +189,13 @@ try {
190189
executeCmdSync("PATH=../depot_tools/:$PATH python3 tools/git-sync-deps");
191190
console.log("gclient sync done");
192191

193-
194-
// Generate libgrapheme headers
195-
if (SelectedPlatform === "ios") {
196-
console.log("Generating libgrapheme headers...");
197-
const libgraphemeDir = `./third_party/externals/libgrapheme`;
198-
executeCmdSync(`cd ${libgraphemeDir} && ./configure && make clean && make`);
192+
// lets check for any dependencies
193+
if (platform.dependencies) {
194+
console.log(`Found dependencies for platform ${SelectedPlatform}`);
195+
platform.dependencies.forEach((dep) => {
196+
console.log(`Running dependency ${dep.name}`);
197+
dep.executable();
198+
});
199199
}
200200

201201
try {

scripts/skia-configuration.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { buildLibGraphemeiOS } from "./build-libgrapheme-ios";
2+
import { executeCmdSync } from "./utils";
3+
14
const NdkDir: string = process.env.ANDROID_NDK ?? "";
25

36
export const BUILD_WITH_PARAGRAPH = true;
@@ -70,6 +73,7 @@ export type Platform = {
7073
outputRoot: string;
7174
outputNames: string[];
7275
options?: Arg[];
76+
dependencies?: { name: string; executable: () => void }[];
7377
};
7478

7579
export const configurations: Configuration = {
@@ -160,5 +164,11 @@ export const configurations: Configuration = {
160164
"libsksg.a",
161165
...ParagraphOutputs,
162166
],
167+
dependencies: [
168+
{
169+
name: "libgrapheme",
170+
executable: buildLibGraphemeiOS,
171+
},
172+
],
163173
},
164174
};

0 commit comments

Comments
 (0)