Skip to content

Commit c5cfba6

Browse files
authored
Merge branch 'GraphiteEditor:master' into desktop-system-fonts
2 parents 6ca04e7 + ab7f59c commit c5cfba6

226 files changed

Lines changed: 11331 additions & 5550 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ rustflags = [
99
"-C",
1010
"link-arg=--max-memory=4294967296",
1111
"--cfg=web_sys_unstable_apis",
12+
# TODO: Remove this and find a better way to stay within the 25MB limit of cloudflare pages
13+
"-C",
14+
"opt-level=s",
1215
]
1316

1417
[env]

.github/workflows/build.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,22 +153,38 @@ jobs:
153153
if [ "${{ github.ref }}" = "refs/tags/latest-stable" ]; then
154154
REF="latest-stable"
155155
ENVIRONMENT="graphite-editor (Production)"
156+
AUTO_INACTIVE="true"
157+
TRANSIENT_ENVIRONMENT="false"
156158
elif [ "${{ github.event_name }}" = "push" ]; then
157159
REF="master"
158160
ENVIRONMENT="graphite-dev (Production)"
161+
AUTO_INACTIVE="true"
162+
TRANSIENT_ENVIRONMENT="false"
159163
else
160-
REF="$(git rev-parse HEAD)"
164+
REF="${{ inputs.checkout_ref || github.head_ref || github.ref_name }}"
161165
ENVIRONMENT="graphite-dev (Preview)"
166+
AUTO_INACTIVE="false"
167+
TRANSIENT_ENVIRONMENT="true"
162168
fi
163-
DEPLOY_ID=$(gh api \
164-
-X POST \
165-
-H "Accept: application/vnd.github+json" \
166-
repos/${{ github.repository }}/deployments \
167-
--input - \
168-
--jq '.id' <<EOF
169-
{"ref":"$REF","environment":"$ENVIRONMENT","auto_merge":false,"required_contexts":[]}
169+
create_deployment() {
170+
gh api \
171+
-X POST \
172+
-H "Accept: application/vnd.github+json" \
173+
repos/${{ github.repository }}/deployments \
174+
--input - \
175+
--jq '.id' <<EOF
176+
{
177+
"ref": "$1",
178+
"environment": "$ENVIRONMENT",
179+
"auto_merge": false,
180+
"required_contexts": [],
181+
"auto_inactive": $AUTO_INACTIVE,
182+
"transient_environment": $TRANSIENT_ENVIRONMENT
183+
}
170184
EOF
171-
)
185+
}
186+
# Try branch name first (needed for GitHub's PR "View deployment" button), fall back to commit SHA if the branch was deleted
187+
DEPLOY_ID=$(create_deployment "$REF" 2>/dev/null) || DEPLOY_ID=$(create_deployment "$(git rev-parse HEAD)")
172188
gh api \
173189
-X POST \
174190
-H "Accept: application/vnd.github+json" \
@@ -188,9 +204,19 @@ jobs:
188204
exit 0
189205
fi
190206
207+
size_of() { find frontend/dist/assets "$@" -printf '%s\n' | awk '{s+=$1} END {printf "%.2f MB", s/1048576}'; }
208+
WASM_SIZE=$(size_of -name '*.wasm')
209+
JS_SIZE=$(size_of -name '*.js')
210+
CSS_SIZE=$(size_of -name '*.css')
211+
FONT_SIZE=$(size_of \( -name '*.woff2' -o -name '*.woff' -o -name '*.ttf' -o -name '*.otf' \))
212+
IMAGE_SIZE=$(size_of \( -name '*.png' -o -name '*.jpg' -o -name '*.svg' \))
213+
ALL_SIZE=$(size_of -type f)
214+
191215
COMMENT_BODY="| 📦 **Web Build Complete for** $(git rev-parse HEAD) |
192216
|-|
193-
| $CF_URL |"
217+
| $CF_URL |
218+
219+
Wasm: **$WASM_SIZE** — JS: **$JS_SIZE** — CSS: **$CSS_SIZE** — Fonts: **$FONT_SIZE** — Images: **$IMAGE_SIZE** — All Assets: **$ALL_SIZE**"
194220
195221
if [ "${{ github.ref }}" = "refs/tags/latest-stable" ]; then
196222
# Push tag: skip commenting (commit was already commented on master merge)

.nix/default.nix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ let
3131

3232
deps = {
3333
crane = lib.call ./deps/crane.nix;
34-
cef = lib.call ./deps/cef.nix;
3534
rustGPU = lib.call ./deps/rust-gpu.nix;
3635
};
3736

@@ -63,12 +62,9 @@ in
6362
graphite-bundle-dev = (lib.call ./pkgs/graphite-bundle.nix) { graphite = graphite-dev; };
6463
graphite-flatpak-manifest = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { };
6564
graphite-flatpak-manifest-dev = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { graphite-bundle = graphite-bundle-dev; };
65+
graphite-cef = lib.call ./pkgs/graphite-cef.nix;
6666

6767
# TODO: graphene-cli = lib.call ./pkgs/graphene-cli.nix;
68-
69-
tools = {
70-
third-party-licenses = lib.call ./pkgs/tools/third-party-licenses.nix;
71-
};
7268
}
7369
);
7470

.nix/deps/cef.nix

Lines changed: 0 additions & 27 deletions
This file was deleted.

.nix/deps/rust-gpu.nix

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{ pkgs, ... }:
22

33
let
4-
extensions = [
5-
"rust-src"
6-
"rust-analyzer"
7-
"clippy"
8-
"cargo"
9-
"rustc-dev"
10-
"llvm-tools"
11-
];
12-
toolchain = pkgs.rust-bin.nightly."2025-06-23".default.override {
13-
inherit extensions;
4+
toolchain = pkgs.rust-bin.nightly."2026-04-11".default.override {
5+
extensions = [
6+
"rust-src"
7+
"rust-analyzer"
8+
"clippy"
9+
"cargo"
10+
"rustc-dev"
11+
"llvm-tools"
12+
];
1413
};
1514
cargo = pkgs.writeShellScriptBin "cargo" ''
1615
#!${pkgs.lib.getExe pkgs.bash}
@@ -32,14 +31,12 @@ let
3231
}).buildRustPackage
3332
(finalAttrs: {
3433
pname = "rustc_codegen_spirv";
35-
version = "0-unstable-2025-08-04";
36-
src = pkgs.fetchFromGitHub {
37-
owner = "Firestar99";
38-
repo = "rust-gpu-new";
39-
rev = "c12f216121820580731440ee79ebc7403d6ea04f";
40-
hash = "sha256-rG1cZvOV0vYb1dETOzzbJ0asYdE039UZImobXZfKIno=";
34+
version = "0.10.0-alpha.1";
35+
src = pkgs.fetchCrate {
36+
inherit (finalAttrs) pname version;
37+
sha256 = "sha256-zJEpExkPgYzwo7fR4ge4GxJNj7H5yo4bJ4eTOw36+7c=";
4138
};
42-
cargoHash = "sha256-AEigcEc5wiBd3zLqWN/2HSbkfOVFneAqNvg9HsouZf4=";
39+
cargoHash = "sha256-J1rtbfGqrL2NJ7Bu2pYfDwCdUmnECB/kzxrpYluA0kY=";
4340
cargoBuildFlags = [
4441
"-p"
4542
"rustc_codegen_spirv"

.nix/dev.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
{ pkgs, deps, ... }:
1+
{
2+
pkgs,
3+
deps,
4+
self,
5+
system,
6+
...
7+
}:
28

39
let
410
libs = [
@@ -22,7 +28,6 @@ pkgs.mkShell (
2228

2329
pkgs.lld
2430
pkgs.nodejs
25-
pkgs.nodePackages.npm
2631
pkgs.binaryen
2732
pkgs.wasm-bindgen-cli_0_2_100
2833
pkgs.wasm-pack
@@ -52,13 +57,10 @@ pkgs.mkShell (
5257
pkgs.graphviz
5358
];
5459

55-
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs}:${deps.cef.env.CEF_PATH}";
60+
CEF_PATH = self.packages.${system}.graphite-cef;
61+
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libs}:${self.packages.${system}.graphite-cef}";
5662
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
5763

58-
shellHook = ''
59-
alias cargo='mold --run cargo'
60-
'';
6164
}
62-
// deps.cef.env
6365
// deps.rustGPU.env
6466
)

.nix/pkgs/graphite-bundle.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
pkgs,
3+
deps,
34
self,
45
system,
56
...
@@ -33,7 +34,7 @@ let
3334
cp -r ${graphite}/share out/share
3435
mkdir -p out/lib/cef
3536
mkdir -p ./cef
36-
tar -xvf ${pkgs.cef-binary.src} -C ./cef --strip-components=1
37+
tar -xvf ${self.packages.${system}.graphite-cef.src} -C ./cef --strip-components=1
3738
cp -r ./cef/Release/* out/lib/cef/
3839
cp -r ./cef/Resources/* out/lib/cef/
3940
find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete

.nix/pkgs/graphite-cef.nix

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{ pkgs, ... }:
2+
3+
let
4+
version = "147.0.10+gd58e84d+chromium-147.0.7727.118";
5+
hashes = {
6+
aarch64-linux = "sha256-kaRijMDacPcoeCcS31zmRSNOvgozx+uq2M34mD28bu4=";
7+
x86_64-linux = "sha256-CHzPofBDhCniDZEpOxXK4I7p57SYjMAY1HVo3Vna0e8=";
8+
};
9+
10+
selectSystem =
11+
attrs:
12+
attrs.${pkgs.stdenv.hostPlatform.system}
13+
or (throw "Unsupported system ${pkgs.stdenv.hostPlatform.system}");
14+
15+
src = pkgs.fetchurl {
16+
url = "https://cef-builds.spotifycdn.com/cef_binary_${version}_${
17+
selectSystem {
18+
aarch64-linux = "linuxarm64";
19+
x86_64-linux = "linux64";
20+
}
21+
}_minimal.tar.bz2";
22+
hash = selectSystem hashes;
23+
};
24+
in
25+
pkgs.cef-binary.overrideAttrs (finalAttrs: {
26+
version = builtins.head (builtins.split "\\+" version);
27+
inherit src;
28+
postInstall = ''
29+
rm -r $out/* $out/.* || true
30+
strip ./Release/*.so*
31+
mv ./Release/* $out/
32+
find "./Resources/locales" -maxdepth 1 -type f ! -name 'en-US.pak' -delete
33+
mv ./Resources/* $out/
34+
mv ./include $out/
35+
36+
cat ./CREDITS.html | ${pkgs.xz}/bin/xz -9 -e -c > $out/CREDITS.html.xz
37+
38+
echo '${
39+
builtins.toJSON {
40+
type = "minimal";
41+
name = builtins.baseNameOf finalAttrs.src.url;
42+
sha1 = "";
43+
}
44+
}' > $out/archive.json
45+
'';
46+
})

.nix/pkgs/graphite.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let
5050
pkgs.pkg-config
5151
pkgs.lld
5252
];
53-
env = deps.cef.env;
53+
env.CEF_PATH = self.packages.${system}.graphite-cef;
5454
buildPhase =
5555
let
5656
profile = if dev then "dev" else "release";
@@ -82,7 +82,6 @@ deps.crane.lib.buildPackage (
8282
pkgs.pkg-config
8383
pkgs.lld
8484
pkgs.nodejs
85-
pkgs.nodePackages.npm
8685
pkgs.binaryen
8786
pkgs.wasm-bindgen-cli_0_2_100
8887
pkgs.wasm-pack
@@ -98,10 +97,11 @@ deps.crane.lib.buildPackage (
9897
npmConfigScript = "setup";
9998
makeCacheWritable = true;
10099

101-
env = deps.cef.env // {
100+
env = {
102101
RASTER_NODES_SHADER_PATH = self.packages.${system}.graphite-raster-nodes-shaders;
103102
GRAPHITE_GIT_COMMIT_HASH = self.rev or "unknown";
104103
GRAPHITE_GIT_COMMIT_DATE = self.lastModified or "unknown";
104+
CEF_PATH = self.packages.${system}.graphite-cef;
105105
};
106106

107107
postPatch = ''
@@ -150,8 +150,9 @@ deps.crane.lib.buildPackage (
150150
remove-references-to -t "${common.cargoVendorDir}" $out/bin/graphite
151151
152152
patchelf \
153-
--set-rpath "${pkgs.lib.makeLibraryPath libs}:${deps.cef.env.CEF_PATH}" \
153+
--set-rpath "${pkgs.lib.makeLibraryPath libs}:${self.packages.${system}.graphite-cef}" \
154154
--add-needed libGL.so \
155+
--add-needed libEGL.so \
155156
$out/bin/graphite
156157
'';
157158

.nix/pkgs/tools/third-party-licenses.nix

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)