pifu/app_image/
config.rs

1// Copyright (c) 2021 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
2// Use of this source is governed by General Public License that can be found
3// in the LICENSE file.
4
5use serde::{Deserialize, Serialize};
6
7use crate::base::fileset::FileSet;
8use crate::base::utils::default_true;
9
10#[derive(Debug, Clone, Deserialize, Serialize)]
11pub struct AppImageConfig {
12    /// A list of elf executable files. If they are dynamically linked, dependent
13    /// libraries will be copied.
14    pub exe_files: Vec<String>,
15
16    /// Boolean - whether to copy dependent libraries.
17    /// This shall almost always be true.
18    /// Those libraries are copied to AppDir/libs folder.
19    #[serde(default = "default_true")]
20    pub embed_libs: bool,
21
22    /// File list.
23    pub files: Option<Vec<FileSet>>,
24
25    // TODO(Shaohua): Add artifact_name
26    #[serde(default = "default_exclude_libs")]
27    pub exclude_libs: Vec<String>,
28}
29
30impl Default for AppImageConfig {
31    fn default() -> Self {
32        Self {
33            exe_files: Vec::new(),
34            embed_libs: true,
35            files: None,
36            exclude_libs: default_exclude_libs(),
37        }
38    }
39}
40
41const fn default_exclude_libs() -> Vec<String> {
42    vec![]
43}