Skip to content

Commit

Permalink
Node.js: Refine features for binary npm packages
Browse files Browse the repository at this point in the history
Use the same features as for the the lsp.
  • Loading branch information
tronical committed Jan 26, 2024
1 parent 4ae87c3 commit c10f0c7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpp_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
# Keep in sync with features in nightly_snapshot.yaml and slint_tool_binary.yaml
# Keep in sync with features in nightly_snapshot.yaml, slint_tool_binary.yaml, and api/node/Cargo.toml
SLINT_BINARY_FEATURES: "-DSLINT_FEATURE_BACKEND_WINIT=ON -DSLINT_FEATURE_RENDERER_FEMTOVG=ON -DSLINT_FEATURE_RENDERER_SKIA=ON -DSLINT_FEATURE_RENDERER_SOFTWARE=ON"

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
- cron: '0 4 * * *'

env:
# Keep in sync with features in slint_tool_binary.yaml and cpp_package.yaml
# Keep in sync with features in slint_tool_binary.yaml, cpp_package.yaml, and api/node/Cargo.toml
SLINT_BINARY_FEATURES: "backend-winit,renderer-femtovg,renderer-skia,renderer-software"
MACOSX_DEPLOYMENT_TARGET: "11.0"

Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/publish_npm_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,23 @@ jobs:
- os: ubuntu-20.04
rust-target: x86_64-unknown-linux-gnu
napi-rs-target: linux-x64-gnu
defaults-tag: binaries-linux
- os: macos-latest
rust-target: x86_64-apple-darwin
napi-rs-target: darwin-x64
defaults-tag: binaries
- os: macos-latest
rust-target: aarch64-apple-darwin
napi-rs-target: darwin-arm64
defaults-tag: binaries
- os: windows-2022
rust-target: x86_64-pc-windows-msvc
napi-rs-target: win32-x64-msvc
defaults-tag: binaries
- os: windows-2022
rust-target: i686-pc-windows-msvc
napi-rs-target: win32-ia32-msvc
defaults-tag: binaries
needs: determine_version
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -92,7 +97,15 @@ jobs:
run: |
if [ "$RELEASE_INPUT" != "true" ]; then
npm version $PKG_VERSION
fi
fi
- name: Prepare feature config for binaries
working-directory: api/node
shell: bash
run: |
perl -pi -e 's,^default =.*,,' Cargo.toml
perl -pi -e 's,# ${{ matrix.defaults-tag }}:,,' Cargo.toml
echo "New defaults:"
grep "^\s*default =" Cargo.toml
- name: Build binary
shell: bash
working-directory: api/node
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/slint_tool_binary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
features:
type: string
description: features to enable for build
# Keep in sync with features in nightly_snapshot.yaml and cpp_package.yaml
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, and api/node/Cargo.toml
default: "backend-winit,renderer-femtovg,renderer-skia,renderer-software"
codesign:
type: boolean
Expand All @@ -30,7 +30,7 @@ on:
features:
type: string
description: features to enable for build
# Keep in sync with features in nightly_snapshot.yaml and cpp_package.yaml
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, and api/node/Cargo.toml
default: "backend-winit,renderer-femtovg,renderer-skia,renderer-software"
codesign:
type: boolean
Expand Down
21 changes: 20 additions & 1 deletion api/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,32 @@ build = "build.rs"
[lib]
crate-type = ["cdylib"]

[features]
default = ["backend-winit", "renderer-femtovg", "backend-qt", "accessibility"]
# Keep in sync with features in nightly_snapshot.yaml, cpp_package.yaml, and slint_tool_binary.yaml
# binaries: default = ["backend-winit", "renderer-femtovg", "renderer-skia", "accessibility"]
# binaries-linux: default = ["backend-linuxkms-noseat", "backend-winit", "renderer-femtovg", "renderer-skia", "accessibility"]

backend-qt = ["slint-interpreter/backend-qt"]
backend-winit = ["slint-interpreter/backend-winit"]
backend-winit-x11 = ["slint-interpreter/backend-winit-x11"]
backend-winit-wayland = ["slint-interpreter/backend-winit-wayland"]
backend-linuxkms = ["slint-interpreter/backend-linuxkms"]
backend-linuxkms-noseat = ["slint-interpreter/backend-linuxkms-noseat"]
renderer-femtovg = ["slint-interpreter/renderer-femtovg"]
renderer-skia = ["slint-interpreter/renderer-skia"]
renderer-skia-opengl = ["slint-interpreter/renderer-skia-opengl"]
renderer-skia-vulkan = ["slint-interpreter/renderer-skia-vulkan"]
renderer-software = ["slint-interpreter/renderer-software"]
accessibility = ["slint-interpreter/accessibility"]

[dependencies]
napi = { version = "2.14.0", default-features = false, features = ["napi8"] }
napi-derive = "2.14.0"
i-slint-compiler = { workspace = true, features = ["default"] }
i-slint-core = { workspace = true, features = ["default"] }
i-slint-backend-selector = { workspace = true }
slint-interpreter = { workspace = true, features = ["default", "display-diagnostics", "internal"] }
slint-interpreter = { workspace = true, default-features = false, features = ["display-diagnostics", "internal", "compat-1-2"] }
spin_on = "0.1"
css-color-parser2 = { workspace = true }
itertools = { workspace = true }
Expand Down

0 comments on commit c10f0c7

Please sign in to comment.