Skip to content

Commit 1041eef

Browse files
committed
Fix CI + GH deploy
1 parent 2d949ae commit 1041eef

File tree

5 files changed

+14
-24
lines changed

5 files changed

+14
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,7 @@ jobs:
3535
uses: egor-tensin/setup-mingw@v2
3636
with:
3737
platform: "${{ contains(matrix.target-sys, 'x86_64') && 'x64' || 'i686' }}"
38-
version: 12.2.0
39-
- name: Uninstall MinGW if installed
40-
if: ${{ matrix.target-abi == 'gnu' }}
41-
shell: pwsh
42-
run: |
43-
if (choco list --local-only | Select-String "mingw") {
44-
choco uninstall mingw -y
45-
} else {
46-
Write-Output "mingw is not installed"
47-
exit 0
48-
}
38+
version: 13.2.0
4939
- name: Install toolchain for ${{ matrix.target-sys }}-${{ matrix.target-abi }}
5040
uses: dtolnay/rust-toolchain@stable
5141
with:

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pub fn main() {
2+
if std::env::var("TARGET").expect("Unable to get TARGET").contains("wasm") {
3+
println!("cargo:rustc-cfg=feature=\"wasm\"");
4+
}
5+
}

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::collections::BTreeMap;
44

55
use serde_derive::{Deserialize, Serialize};
66

7-
// #[cfg(target_family = "wasm")]
87
/// Link / bookmark annotation handling
98
pub mod annotation;
109
pub mod wasm;

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ pub(crate) fn to_pdf_time_stamp_metadata(date: &OffsetDateTime) -> String {
7070
)
7171
}
7272

73-
#[cfg(target_arch = "wasm")]
73+
#[cfg(target_family = "wasm")]
7474
pub(crate) fn to_pdf_xmp_date(_date: &OffsetDateTime) -> String {
7575
"D:1970-01-01T00:00:00+00'00'".to_string()
7676
}
7777

7878
// D:2018-09-19T10:05:05+00'00'
79-
#[cfg(not(target_arch = "wasm"))]
79+
#[cfg(not(target_family = "wasm"))]
8080
pub(crate) fn to_pdf_xmp_date(date: &OffsetDateTime) -> String {
8181
// Since the time is in UTC, we know that the time zone
8282
// difference to UTC is 0 min, 0 sec, hence the 00'00

src/wasm.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub struct PrintPdfApiReturn<T: serde::Serialize> {
7575
/// Data or error of the output of the function.
7676
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
7777
#[serde(untagged)]
78-
enum StatusOrData<T: serde::Serialize> {
78+
pub enum StatusOrData<T: serde::Serialize> {
7979
Ok(T),
8080
Error(String),
8181
}
@@ -99,7 +99,7 @@ enum StatusOrData<T: serde::Serialize> {
9999
/// // }
100100
/// ```
101101
#[allow(non_snake_case)]
102-
#[cfg_attr(feature = "wasm", wasm_bindgen::prelude::wasm_bindgen)]
102+
#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)]
103103
pub fn Pdf_HtmlToPdfDocument(input: String) -> String {
104104
let input = match serde_json::from_str::<PrintPdfHtmlInput>(&input) {
105105
Ok(o) => o,
@@ -197,9 +197,8 @@ pub struct PrintPdfParseOutput {
197197
/// // }
198198
/// // }
199199
/// ```
200-
#[cfg(feature = "wasm")]
201200
#[allow(non_snake_case)]
202-
#[wasm_bindgen::prelude::wasm_bindgen]
201+
#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)]
203202
pub fn Pdf_BytesToPdfDocument(input: String) -> String {
204203
let input = match serde_json::from_str::<PrintPdfParseInput>(&input) {
205204
Ok(o) => o,
@@ -269,9 +268,8 @@ pub struct PrintPdfPageGetResourcesOutput {
269268
/// Helper function that takes a PDF page and outputs a list of all
270269
/// images IDs / fonts IDs that have to be gathered from the documents
271270
/// resources in order to render this page.
272-
#[cfg(feature = "wasm")]
273271
#[allow(non_snake_case)]
274-
#[wasm_bindgen::prelude::wasm_bindgen]
272+
#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)]
275273
pub fn Pdf_GetResourcesForPage(input: String) -> String {
276274
let input = match serde_json::from_str::<PrintPdfPageGetResourcesInput>(&input) {
277275
Ok(o) => o,
@@ -316,9 +314,8 @@ pub struct PrintPdfPageToSvgOutput {
316314
}
317315

318316
/// Takes a `PdfPage` JS object and outputs the SVG string for that page
319-
#[cfg(feature = "wasm")]
320317
#[allow(non_snake_case)]
321-
#[wasm_bindgen::prelude::wasm_bindgen]
318+
#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)]
322319
pub fn Pdf_PdfPageToSvg(input: String) -> String {
323320
let input = match serde_json::from_str::<PrintPdfPageToSvgInput>(&input) {
324321
Ok(o) => o,
@@ -356,9 +353,8 @@ pub struct PrintPdfToBytesOutput {
356353
}
357354

358355
/// Takes a `PdfDocument` JS object and returns the base64 PDF bytes
359-
#[cfg(feature = "wasm")]
360356
#[allow(non_snake_case)]
361-
#[wasm_bindgen::prelude::wasm_bindgen]
357+
#[cfg_attr(target_family = "wasm", wasm_bindgen::prelude::wasm_bindgen)]
362358
pub fn Pdf_PdfDocumentToBytes(input: String) -> String {
363359
let input = match serde_json::from_str::<PrintPdfToBytesInput>(&input) {
364360
Ok(o) => o,

0 commit comments

Comments
 (0)