Skip to content

Commit

Permalink
Merge branch 'main' into feat/app-bundle-cross-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
amr-crabnebula committed Apr 15, 2024
2 parents 817805c + 4c4d919 commit ecf5868
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/error-out-if-no-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cargo-packager": patch
---

Error out if we cannot find a configuration file.
5 changes: 5 additions & 0 deletions .changes/ignore-empty-files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cargo-packager": patch
---

Fixes a crash when packaging `.app` if an empty file is included in the bundle.
43 changes: 43 additions & 0 deletions bindings/packager/nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,49 @@ switch (platform) {
loadError = e
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'packager.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./packager.linux-riscv64-musl.node')
} else {
nativeBinding = require('@crabnebula/packager-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'packager.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./packager.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@crabnebula/packager-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'packager.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./packager.linux-s390x-gnu.node')
} else {
nativeBinding = require('@crabnebula/packager-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/packager/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ fn run_cli(cli: Cli) -> Result<()> {
};

if configs.is_empty() {
tracing::debug!("Couldn't detect a valid configuration file or all configurations are disabled! Nothing to do here.");
return Ok(());
tracing::error!("Couldn't detect a valid configuration file or all configurations are disabled! Nothing to do here.");
std::process::exit(1);
}

let cli_out_dir = cli.out_dir.as_ref().map(dunce::canonicalize).transpose()?;
Expand Down
5 changes: 3 additions & 2 deletions crates/packager/src/package/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> {
}
};

if !metadata.is_file() {
// ignore folders and files that do not include at least the header size
if !metadata.is_file() || metadata.len() < 4 {
continue;
}

Expand Down Expand Up @@ -158,7 +159,7 @@ pub(crate) fn package(ctx: &Context) -> crate::Result<Vec<PathBuf>> {
.clone()
.ok_or_else(|| crate::Error::MissingNotarizeAuthVars)
})
.unwrap_or_else(|| codesign::notarize_auth())
.unwrap_or_else(codesign::notarize_auth)
{
Ok(auth) => {
tracing::debug!("Notarizing {}", app_bundle_path.display());
Expand Down
1 change: 1 addition & 0 deletions examples/slint/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(dead_code)]

slint::include_modules!();

Expand Down

0 comments on commit ecf5868

Please sign in to comment.