Skip to content

Commit

Permalink
feat(bundler): add recommends for deb and rpm (#11402)
Browse files Browse the repository at this point in the history
closes #10351
  • Loading branch information
amrbashir authored Oct 21, 2024
1 parent 1f31183 commit 6dea12a
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/bundler-linux-recommends.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-bundler": "patch:feat"
---

Add `bundle > linux > deb > recommends` and `bundle > linux > rpm > recommends` fields to declare a strong, but not absolute, dependency for your `.deb` and `.rpm` packages.

9 changes: 9 additions & 0 deletions crates/tauri-bundler/src/bundle/linux/debian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ fn generate_control_file(
if !dependencies.is_empty() {
writeln!(file, "Depends: {}", dependencies.join(", "))?;
}
let dependencies = settings
.deb()
.recommends
.as_ref()
.cloned()
.unwrap_or_default();
if !dependencies.is_empty() {
writeln!(file, "Recommends: {}", dependencies.join(", "))?;
}
let provides = settings
.deb()
.provides
Expand Down
11 changes: 11 additions & 0 deletions crates/tauri-bundler/src/bundle/linux/rpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
builder = builder.provides(Dependency::any(dep));
}

// Add recommends
for dep in settings
.rpm()
.recommends
.as_ref()
.cloned()
.unwrap_or_default()
{
builder = builder.recommends(Dependency::any(dep));
}

// Add conflicts
for dep in settings
.rpm()
Expand Down
4 changes: 4 additions & 0 deletions crates/tauri-bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ pub struct DebianSettings {
// OS-specific settings:
/// the list of debian dependencies.
pub depends: Option<Vec<String>>,
/// the list of debian dependencies recommendations.
pub recommends: Option<Vec<String>>,
/// the list of dependencies the package provides.
pub provides: Option<Vec<String>>,
/// the list of package conflicts.
Expand Down Expand Up @@ -222,6 +224,8 @@ pub struct AppImageSettings {
pub struct RpmSettings {
/// The list of RPM dependencies your application relies on.
pub depends: Option<Vec<String>>,
/// the list of of RPM dependencies your application recommends.
pub recommends: Option<Vec<String>>,
/// The list of RPM dependencies your application provides.
pub provides: Option<Vec<String>>,
/// The list of RPM dependencies your application conflicts with. They must not be present
Expand Down
20 changes: 20 additions & 0 deletions crates/tauri-cli/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2574,6 +2574,16 @@
"type": "string"
}
},
"recommends": {
"description": "The list of deb dependencies your application recommends.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"provides": {
"description": "The list of dependencies the package provides.",
"type": [
Expand Down Expand Up @@ -2685,6 +2695,16 @@
"type": "string"
}
},
"recommends": {
"description": "The list of RPM dependencies your application recommends.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"provides": {
"description": "The list of RPM dependencies your application provides.",
"type": [
Expand Down
2 changes: 2 additions & 0 deletions crates/tauri-cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,7 @@ fn tauri_config_to_bundle_settings(
} else {
Some(depends_deb)
},
recommends: config.linux.deb.recommends,
provides: config.linux.deb.provides,
conflicts: config.linux.deb.conflicts,
replaces: config.linux.deb.replaces,
Expand All @@ -1368,6 +1369,7 @@ fn tauri_config_to_bundle_settings(
} else {
Some(depends_rpm)
},
recommends: config.linux.rpm.recommends,
provides: config.linux.rpm.provides,
conflicts: config.linux.rpm.conflicts,
obsoletes: config.linux.rpm.obsoletes,
Expand Down
20 changes: 20 additions & 0 deletions crates/tauri-schema-generator/schemas/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2574,6 +2574,16 @@
"type": "string"
}
},
"recommends": {
"description": "The list of deb dependencies your application recommends.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"provides": {
"description": "The list of dependencies the package provides.",
"type": [
Expand Down Expand Up @@ -2685,6 +2695,16 @@
"type": "string"
}
},
"recommends": {
"description": "The list of RPM dependencies your application recommends.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"provides": {
"description": "The list of RPM dependencies your application provides.",
"type": [
Expand Down
5 changes: 5 additions & 0 deletions crates/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ pub struct AppImageConfig {
pub struct DebConfig {
/// The list of deb dependencies your application relies on.
pub depends: Option<Vec<String>>,
/// The list of deb dependencies your application recommends.
pub recommends: Option<Vec<String>>,
/// The list of dependencies the package provides.
pub provides: Option<Vec<String>>,
/// The list of package conflicts.
Expand Down Expand Up @@ -398,6 +400,8 @@ pub struct LinuxConfig {
pub struct RpmConfig {
/// The list of RPM dependencies your application relies on.
pub depends: Option<Vec<String>>,
/// The list of RPM dependencies your application recommends.
pub recommends: Option<Vec<String>>,
/// The list of RPM dependencies your application provides.
pub provides: Option<Vec<String>>,
/// The list of RPM dependencies your application conflicts with. They must not be present
Expand Down Expand Up @@ -442,6 +446,7 @@ impl Default for RpmConfig {
fn default() -> Self {
Self {
depends: None,
recommends: None,
provides: None,
conflicts: None,
obsoletes: None,
Expand Down

0 comments on commit 6dea12a

Please sign in to comment.