Skip to content

Commit

Permalink
build(compiler): fix cfg condition for dep (#223)
Browse files Browse the repository at this point in the history
* build(compiler): fix cfg condition for dep
  + `cfg(target = "")` not works at all

* dev: print features

* dev: force resolver = 2 for workspace

* fix: broken feature dep
  • Loading branch information
Myriad-Dreamin authored Jul 5, 2023
1 parent 31ee537 commit 5a2bba6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 76 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ jobs:
target: ${{ matrix.platform }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: Simulate itarget feature (Darwin)
if: matrix.platform == 'darwin'
run: python3 scripts/itarget.py ${{ matrix.rust-target }}
- name: Simulate itarget feature (Others)
if: matrix.platform != 'darwin'
run: python scripts/itarget.py ${{ matrix.rust-target }}
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: rust toolchain
Expand All @@ -76,6 +70,9 @@ jobs:
run: |
sudo apt-get update -y
sudo apt-get install gcc-arm-linux-gnueabihf
- name: List Depenedencies
run: |
cargo tree -e features --target ${{ matrix.rust-target }}
- name: Run Native Build
shell: pwsh
run: |
Expand Down Expand Up @@ -106,16 +103,17 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.rust-target }}
- name: Simulate itarget feature
run: python scripts/itarget.py ${{ matrix.rust-target }}
- name: Build cross image
run: |
docker build -t typst-ts/riscv64 ${GITHUB_WORKSPACE}/.github/cross-linux-riscv64/
env:
CROSS_DOCKER_IN_DOCKER: true
- name: Run Cross Build
- name: List Depenedencies
run: |
echo "docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo"
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo tree -e features --target ${CARGO_TARGET}
- name: Run Cross Build
run: |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo run --bin typst-ts-fontctl
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo build -p typst-ts-fontctl --release --target ${CARGO_TARGET}
docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project typst-ts/riscv64:latest cargo build --manifest-path cli/Cargo.toml --release --target ${CARGO_TARGET} --bin typst-ts-cli
Expand Down Expand Up @@ -143,16 +141,17 @@ jobs:
RUSTFLAGS: '-C link-arg=-fuse-ld=lld -C target-feature=-crt-static'
steps:
- name: Install dependencies
run: apk add --no-cache git clang lld musl-dev npm python3
run: apk add --no-cache git clang lld musl-dev npm
- name: Checkout repository
uses: actions/checkout@v3
- name: Simulate itarget feature
run: python3 scripts/itarget.py alpine-x64
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Configure git
run: |
git config --global --add safe.directory $PWD
- name: List Depenedencies
run: |
cargo tree -e features --target $RUST_TARGET
- name: build binaries
run: |
cargo run --release --bin typst-ts-fontctl
Expand Down
26 changes: 6 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ homepage = "https://myriad-dreamin.github.io/typst.ts/"
repository = "https://github.com/Myriad-Dreamin/typst.ts"

[workspace]
resolver = "2"
members = [
"cli",
"core",
Expand Down
13 changes: 2 additions & 11 deletions compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,20 @@ typst-ts-svg-exporter = { workspace = true, optional = true, features = [

typst-ts-core.workspace = true

# begin itarget-region
[target.'cfg(not(any(target_arch = "riscv64", target_arch = "wasm32", target = "aarch64-pc-windows-msvc")))'.dependencies]
[target.'cfg(not(any(target_arch = "riscv64", target_arch = "wasm32", all(target_os = "windows", target_arch = "aarch64"))))'.dependencies]
reqwest = { version = "^0.11", default-features = false, features = [
"rustls-tls",
"blocking",
"multipart",
] }

[target.'cfg(target_arch = "riscv64")'.dependencies]
[target.'cfg(any(target_arch = "riscv64", all(target_os = "windows", target_arch = "aarch64")))'.dependencies]
reqwest = { version = "^0.11", default-features = false, features = [
"native-tls",
"blocking",
"multipart",
] }

[target.aarch64-pc-windows-msvc.dependencies]
reqwest = { version = "^0.11", default-features = false, features = [
"native-tls",
"blocking",
"multipart",
] }
# end itarget-region

[dev-dependencies]
serde.workspace = true

Expand Down
1 change: 1 addition & 0 deletions packages/renderer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ web-sys = { workspace = true, features = [
"Window",
"Blob",
"ImageData",
"HtmlDivElement",
] }

typst-ts-core.workspace = true
Expand Down
33 changes: 0 additions & 33 deletions scripts/itarget.py

This file was deleted.

0 comments on commit 5a2bba6

Please sign in to comment.