Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/actions/quarto-dev/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ runs:
restore-keys: |
${{ runner.os }}-deno_std-2-

- name: Install Rust for typst-gather
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@ jobs:
if: ${{ inputs.publish-release }}
uses: ./.github/workflows/actions/prevent-rerun

- name: Install Rust for typst-gather
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Configure
run: |
./configure.sh
Expand Down Expand Up @@ -266,11 +261,6 @@ jobs:
if: ${{ inputs.publish-release }}
uses: ./.github/workflows/actions/prevent-rerun

- name: Install Rust for typst-gather
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Configure
run: |
./configure.sh
Expand Down Expand Up @@ -370,11 +360,6 @@ jobs:
if: ${{ inputs.publish-release }}
uses: ./.github/workflows/actions/prevent-rerun

- name: Install Rust for typst-gather and launcher
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Configure
run: |
.\configure.cmd
Expand Down Expand Up @@ -503,11 +488,6 @@ jobs:
if: ${{ inputs.publish-release }}
uses: ./.github/workflows/actions/prevent-rerun

- name: Install Rust for typst-gather
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Configure
run: |
./configure.sh
Expand Down
13 changes: 4 additions & 9 deletions configure.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,10 @@ IF EXIST !QUARTO_BIN_PATH!\quarto.cmd (
ECHO NOTE: To use quarto please use quarto.cmd (located in this folder) or add the following path to your PATH
ECHO !QUARTO_BIN_PATH!

REM Build typst-gather if cargo is available
where cargo >nul 2>nul
if %ERRORLEVEL% EQU 0 (
ECHO Building typst-gather...
cargo build --release --manifest-path package\typst-gather\Cargo.toml
) else (
ECHO Note: Rust/cargo not found, skipping typst-gather build
ECHO Install Rust to use 'quarto call typst-gather'
)
REM Build typst-gather and install to tools directory
ECHO Building typst-gather...
cargo build --release --manifest-path package\typst-gather\Cargo.toml
COPY package\typst-gather\target\release\typst-gather.exe "!QUARTO_BIN_PATH!\tools\x86_64\"

endlocal & set QUARTO_BIN_DEV=%QUARTO_BIN_PATH%

Expand Down
12 changes: 4 additions & 8 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ else
quarto --version
fi

# Build typst-gather if cargo is available
if command -v cargo &> /dev/null; then
echo "Building typst-gather..."
cargo build --release --manifest-path package/typst-gather/Cargo.toml
else
echo "Note: Rust/cargo not found, skipping typst-gather build"
echo "Install Rust to use 'quarto call typst-gather'"
fi
# Build typst-gather and install to tools directory
echo "Building typst-gather..."
cargo build --release --manifest-path package/typst-gather/Cargo.toml
cp package/typst-gather/target/release/typst-gather "$QUARTO_BIN_PATH/tools/$DENO_ARCH_DIR/"
20 changes: 11 additions & 9 deletions package/src/common/prepare-dist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function prepareDist(
}
}

// Stage typst-gather binary if it exists (built by configure.sh)
// Stage typst-gather binary (built by configure.sh)
// Only stage if the build machine architecture matches the target architecture
// (cross-compilation is not currently supported)
const buildArch = Deno.build.arch === "aarch64" ? "aarch64" : "x86_64";
Expand All @@ -111,15 +111,17 @@ export async function prepareDist(
"package/typst-gather/target/release",
typstGatherBinaryName,
);
if (existsSync(typstGatherSrc)) {
info("\nStaging typst-gather binary");
const typstGatherDest = join(targetDir, config.arch, typstGatherBinaryName);
ensureDirSync(join(targetDir, config.arch));
copySync(typstGatherSrc, typstGatherDest, { overwrite: true });
info(`Copied ${typstGatherSrc} to ${typstGatherDest}`);
} else {
info("\nNote: typst-gather binary not found, skipping staging");
if (!existsSync(typstGatherSrc)) {
throw new Error(
`typst-gather binary not found at ${typstGatherSrc}\n` +
"Run ./configure.sh to build it.",
);
}
info("\nStaging typst-gather binary");
const typstGatherDest = join(targetDir, config.arch, typstGatherBinaryName);
ensureDirSync(join(targetDir, config.arch));
copySync(typstGatherSrc, typstGatherDest, { overwrite: true });
info(`Copied ${typstGatherSrc} to ${typstGatherDest}`);
} else {
info(`\nNote: Skipping typst-gather staging (build arch ${buildArch} != target arch ${config.arch})`);
}
Expand Down
37 changes: 8 additions & 29 deletions src/command/call/typst-gather/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,36 +452,15 @@ export const typstGatherCommand = new Command()
Deno.exit(1);
}

// Find typst-gather binary
// First try architecture-specific path, then fall back to PATH
let typstGatherBinary: string;
// Find typst-gather binary in standard tools location
const binaryName = isWindows ? "typst-gather.exe" : "typst-gather";

const archPath = architectureToolsPath(binaryName);
if (existsSync(archPath)) {
typstGatherBinary = archPath;
} else {
// Try to find in PATH or use development location
const quartoRoot = Deno.env.get("QUARTO_ROOT");
if (quartoRoot) {
const devPath = join(
quartoRoot,
"package/typst-gather/target/release",
binaryName,
);
if (existsSync(devPath)) {
typstGatherBinary = devPath;
} else {
console.error(
`typst-gather binary not found.\n` +
`Build it with: cd package/typst-gather && cargo build --release`,
);
Deno.exit(1);
}
} else {
console.error("typst-gather binary not found.");
Deno.exit(1);
}
const typstGatherBinary = architectureToolsPath(binaryName);
if (!existsSync(typstGatherBinary)) {
console.error(
`typst-gather binary not found.\n` +
`Run ./configure.sh to build and install it.`,
);
Deno.exit(1);
}

// Determine config file to use
Expand Down
20 changes: 7 additions & 13 deletions src/command/dev-call/typst-gather/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*/

import { Command } from "cliffy/command/mod.ts";
import { existsSync } from "../../../deno_ral/fs.ts";
import { error, info } from "../../../deno_ral/log.ts";
import { join } from "../../../deno_ral/path.ts";
import { isWindows } from "../../../deno_ral/platform.ts";
import { architectureToolsPath } from "../../../core/resources.ts";

export const typstGatherCommand = new Command()
.name("typst-gather")
Expand All @@ -33,21 +35,13 @@ export const typstGatherCommand = new Command()
"src/command/dev-call/typst-gather/typst-gather.toml",
);

// Path to the typst-gather binary
// Find typst-gather binary in standard tools location
const binaryName = isWindows ? "typst-gather.exe" : "typst-gather";
const typstGatherBinary = join(
quartoRoot,
"package/typst-gather/target/release",
binaryName,
);

// Check if binary exists
try {
await Deno.stat(typstGatherBinary);
} catch {
const typstGatherBinary = architectureToolsPath(binaryName);
if (!existsSync(typstGatherBinary)) {
error(
`typst-gather binary not found at ${typstGatherBinary}\n` +
"Build it with: cd package/typst-gather && cargo build --release",
`typst-gather binary not found.\n` +
"Run ./configure.sh to build and install it.",
);
Deno.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/docs/smoke-all/pdf-standard/pdfversion-numeric.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "PDF version (numeric YAML)"
lang: en
pdf-standard: 2.0
pdf-standard: "2.0"
keep-tex: true
keep-typ: true
_quarto:
Expand Down
Loading