apple_bundle/info_plist/
bundle_configuration.rs

1//! # Bundle Configuration.
2//!
3//! Define basic characteristics of a bundle, like its name, type, and version.
4//!
5//! The Information Property List file associated with a bundle tells you how to interpret
6//! the bundle’s contents. The file describes fundamental features, like whether the
7//! bundle contains an app, a framework, or something else. It also includes identifying
8//! characteristics of the bundle, like an identifier, a human-readable name, and a
9//! version.
10//!
11//! ## Framework
12//! * Bundle Resources
13
14use serde::{Deserialize, Serialize};
15
16/// Categorization
17#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default)]
18pub struct Categorization {
19    /// The type of bundle.
20    ///
21    /// This key consists of a four-letter code for the bundle type.
22    /// For apps, the code is APPL, for frameworks, it's FMWK, and for bundles,
23    /// it's BNDL. The default value is derived from the bundle extension or,
24    /// if it can't be derived, the default value is BNDL.
25    ///
26    /// ## Availability
27    /// * iOS 2.0+
28    /// * macOS 10.0+
29    /// * tvOS 9.0+
30    /// * watchOS 2.0+
31    ///
32    /// ## Framework
33    /// Core Foundation
34    #[serde(
35        rename = "CFBundlePackageType",
36        serialize_with = "crate::serialize_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub bundle_package_type: Option<String>,
40    /// The category that best describes your app for the App Store.
41    ///
42    /// ## Availability
43    /// * macOS 10.0+
44    ///
45    /// ## Framework
46    /// Core Services
47    #[serde(
48        rename = "LSApplicationCategoryType",
49        skip_serializing_if = "Option::is_none",
50        serialize_with = "crate::serialize_enum_option"
51    )]
52    pub application_category_type: Option<AppCategoryType>,
53}
54
55/// Identification
56#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default)]
57pub struct Identification {
58    /// A unique identifier for a bundle.
59    ///
60    /// A bundle ID uniquely identifies a single app throughout the system.
61    /// The bundle ID string must contain only alphanumeric characters (A-Z, a-z, and
62    /// 0-9), hyphens (-), and periods (.). The string should be in reverse-DNS
63    /// format. Bundle IDs are case sensitive.
64    ///
65    /// ## Availability
66    /// * iOS 2.0+
67    /// * macOS 10.0+
68    /// * tvOS 9.0+
69    /// * watchOS 2.0+
70    ///
71    /// ## Framework
72    /// Core Foundation
73    #[serde(rename = "CFBundleIdentifier")]
74    pub bundle_identifier: String,
75    /// The bundle ID of the watchOS app.
76    ///
77    /// This key is automatically included in your WatchKit extension’s
78    /// information property list when you create a watchOS project from a template.
79    ///
80    /// ## Availability
81    /// * watchOS 2.0+
82    ///
83    /// ## Framework
84    /// * WatchKit
85    #[serde(
86        rename = "WKAppBundleIdentifier",
87        serialize_with = "crate::serialize_option",
88        skip_serializing_if = "Option::is_none"
89    )]
90    pub app_bundle_identifier: Option<String>,
91    /// The bundle ID of the watchOS app’s companion iOS app.
92    ///
93    /// Xcode automatically includes this key in the WatchKit app’s information
94    /// property list when you create a watchOS project from a template.
95    /// The value should be the same as the iOS app’s CFBundleIdentifier.
96    ///
97    /// ## Availability
98    /// * watchOS 2.0+
99    ///
100    /// ## Framework
101    /// * WatchKit
102    #[serde(
103        rename = "WKCompanionAppBundleIdentifier",
104        serialize_with = "crate::serialize_option",
105        skip_serializing_if = "Option::is_none"
106    )]
107    pub companion_app_bundle_identifier: Option<String>,
108}
109
110/// Naming
111#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default)]
112pub struct Naming {
113    /// A user-visible short name for the bundle.
114    ///
115    /// This name can contain up to 15 characters. The system may display
116    /// it to users if CFBundleDisplayName isn't set.
117    ///
118    /// ## Availability
119    /// * iOS 2.0+
120    /// * macOS 10.0+
121    /// * tvOS 9.0+
122    /// * watchOS 2.0+
123    ///
124    /// ## Framework
125    /// Core Foundation
126    #[serde(
127        rename = "CFBundleName",
128        serialize_with = "crate::serialize_option",
129        skip_serializing_if = "Option::is_none"
130    )]
131    pub bundle_name: Option<String>,
132    /// The user-visible name for the bundle, used by Siri and visible on the iOS Home
133    /// screen.
134    ///
135    /// Use this key if you want a product name that's longer than CFBundleName.
136    ///
137    /// ## Availability
138    /// * iOS 2.0+
139    /// * macOS 10.0+
140    /// * tvOS 9.0+
141    /// * watchOS 2.0+
142    ///
143    /// ## Framework
144    /// Core Foundation
145    #[serde(
146        rename = "CFBundleDisplayName",
147        serialize_with = "crate::serialize_option",
148        skip_serializing_if = "Option::is_none"
149    )]
150    pub bundle_display_name: Option<String>,
151    /// A replacement for the app name in text-to-speech operations.
152    ///
153    /// ## Availability
154    /// * iOS 2.0+
155    /// * macOS 10.0+
156    /// * tvOS 9.0+
157    /// * watchOS 2.0+
158    ///
159    /// ## Framework
160    /// Core Foundation
161    #[serde(rename = "CFBundleSpokenName", skip_serializing_if = "Option::is_none")]
162    pub bundle_spoken_name: Option<String>,
163}
164
165/// Bundle Version
166#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default)]
167pub struct BundleVersion {
168    /// The version of the build that identifies an iteration of the bundle.
169    ///
170    /// This key is a machine-readable string composed of one to three period-separated
171    /// integers, such as 10.14.1. The string can only contain numeric characters
172    /// (0-9) and periods.
173    ///
174    /// Each integer provides information about the build version in the format
175    /// \[Major\].\[Minor\].\[Patch\]:
176    /// - Major: A major revision number.
177    /// - Minor: A minor revision number.
178    /// - Patch: A maintenance release number.
179    ///
180    /// You can include more integers but the system ignores them.
181    /// You can also abbreviate the build version by using only one or two integers,
182    /// where missing integers in the format are interpreted as zeros.
183    /// For example, 0 specifies 0.0.0, 10 specifies 10.0.0, and 10.5 specifies 10.5.0.
184    /// This key is required by the App Store and is used throughout the system to
185    /// identify the version of the build. For macOS apps, increment the build version
186    /// before you distribute a build.
187    ///
188    /// ## Availability
189    /// * iOS 2.0+
190    /// * macOS 10.0+
191    /// * tvOS 9.0+
192    /// * watchOS 2.0+
193    ///
194    /// ## Framework
195    /// Core Foundation
196    #[serde(
197        rename = "CFBundleVersion",
198        serialize_with = "crate::serialize_option",
199        skip_serializing_if = "Option::is_none"
200    )]
201    pub bundle_version: Option<String>,
202    /// The release or version number of the bundle.
203    ///
204    /// This key is a user-visible string for the version of the bundle. The required
205    /// format is three period-separated integers, such as 10.14.1. The string can
206    /// only contain numeric characters (0-9) and periods.
207    ///
208    /// Each integer provides information about the release in the format
209    /// \[Major\].\[Minor\].\[Patch\]:
210    /// - Major: A major revision number.
211    /// - Minor: A minor revision number.
212    /// - Patch: A maintenance release number.
213    ///
214    /// This key is used throughout the system to identify the version of the bundle.
215    ///
216    /// ## Availability
217    /// * iOS 2.0+
218    /// * macOS 10.0+
219    /// * tvOS 9.0+
220    /// * watchOS 2.0+
221    ///
222    /// ## Framework
223    /// Core Foundation
224    #[serde(
225        rename = "CFBundleShortVersionString",
226        serialize_with = "crate::serialize_option",
227        skip_serializing_if = "Option::is_none"
228    )]
229    pub bundle_short_version_string: Option<String>,
230    /// The current version of the Information Property List structure.
231    ///
232    /// Xcode adds this key automatically. Don’t change the value.
233    ///
234    /// ## Availability
235    /// * iOS 2.0+
236    /// * macOS 10.0+
237    /// * tvOS 9.0+
238    /// * watchOS 2.0+
239    ///
240    /// ## Framework
241    /// Core Foundation
242    #[serde(
243        rename = "CFBundleInfoDictionaryVersion",
244        serialize_with = "crate::serialize_option",
245        skip_serializing_if = "Option::is_none"
246    )]
247    pub bundle_info_dictionary_version: Option<String>,
248    /// A human-readable copyright notice for the bundle.
249    ///
250    /// ## Availability
251    /// * macOS 10.0+
252    ///
253    /// ## Framework
254    /// * Foundation
255    #[serde(
256        rename = "NSHumanReadableCopyright",
257        serialize_with = "crate::serialize_option",
258        skip_serializing_if = "Option::is_none"
259    )]
260    pub human_readable_copyright: Option<String>,
261}
262
263/// Operating System Version
264#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default)]
265pub struct OperatingSystemVersion {
266    /// The minimum operating system version required for the app to run.
267    ///
268    /// The Mac App Store uses this key to indicate the OS releases on
269    /// which your app can run and show compatibility with the user’s Mac.
270    ///
271    /// ## Availability
272    /// * macOS 10.0+
273    ///
274    /// ## Framework
275    /// * Core Services
276    #[serde(
277        rename = "LSMinimumSystemVersion",
278        serialize_with = "crate::serialize_option",
279        skip_serializing_if = "Option::is_none"
280    )]
281    pub minimum_system_version: Option<String>,
282    /// The minimum version of macOS required for the app to run on a set of
283    /// architectures.
284    ///
285    /// ## Availability
286    /// * macOS 10.0+
287    ///
288    /// ## Framework
289    /// * Core Services
290    #[serde(
291        rename = "LSMinimumSystemVersionByArchitecture",
292        serialize_with = "crate::serialize_option",
293        skip_serializing_if = "Option::is_none"
294    )]
295    pub minimum_system_version_by_architecture: Option<MinimumSystemVersionByArchitecture>,
296    /// The minimum operating system version required for the app to run on iOS, tvOS, and
297    /// watchOS.
298    ///
299    /// The App Store uses this key to indicate the OS releases on which your app can run.
300    ///
301    /// ## Availability
302    /// * macOS 3.0+
303    /// * tvOS 9.0+
304    /// * watchOS 2.0+
305    ///
306    /// ## Framework
307    /// * Core Services
308    #[serde(
309        rename = "MinimumOSVersion",
310        serialize_with = "crate::serialize_option",
311        skip_serializing_if = "Option::is_none"
312    )]
313    pub minimum_os_version: Option<String>,
314    /// A Boolean value indicating whether the app must run in iOS.
315    ///
316    /// ## Availability
317    /// * iOS 12.0+
318    ///
319    /// ## Framework
320    /// * Core Services
321    #[serde(
322        rename = "LSRequiresIPhoneOS",
323        serialize_with = "crate::serialize_option",
324        skip_serializing_if = "Option::is_none"
325    )]
326    pub requires_iphone_os: Option<bool>,
327    /// A Boolean value that indicates whether the bundle is a watchOS app.
328    ///
329    /// Xcode automatically includes this key in the WatchKit app’s information
330    /// property list when you create a watchOS project from a template.
331    ///
332    /// ## Availability
333    /// * watchOS 2.0+
334    ///
335    /// ## Framework
336    /// * WatchKit
337    #[serde(
338        rename = "WKWatchKitApp",
339        serialize_with = "crate::serialize_option",
340        skip_serializing_if = "Option::is_none"
341    )]
342    pub watch_kit_app: Option<bool>,
343}
344
345/// Localization
346#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default)]
347pub struct Localization {
348    /// The default language and region for the bundle, as a language ID.
349    ///
350    /// The system uses this key as the language if it can't locate a resource for the
351    /// user’s preferred language. The value should be a language ID that identifies a
352    /// language, dialect, or script.
353    ///
354    /// To distinguish between different languages and regional dialects, use a language
355    /// designator with a region designator and a script designator separated by
356    /// hyphens. To specify the English language as it's used in the United Kingdom,
357    /// use en-GB, where GB is the region designator. To represent Mandarin Chinese,
358    /// spoken in Taiwan, and written in Traditional Chinese script, use zh-Hant-TW.
359    ///
360    /// To specify a script, combine a language designator with a script designator
361    /// separated by a hyphen, as in az-Arab for Azerbaijani in the Arabic script.
362    ///
363    /// ## Availability
364    /// * iOS 2.0+
365    /// * macOS 10.0+
366    /// * tvOS 9.0+
367    /// * watchOS 2.0+
368    ///
369    /// ## Framework
370    /// Core Foundation
371    #[serde(
372        rename = "CFBundleDevelopmentRegion",
373        serialize_with = "crate::serialize_option",
374        skip_serializing_if = "Option::is_none"
375    )]
376    pub bundle_development_region: Option<String>,
377    /// The localizations handled manually by your app.
378    ///
379    /// ## Availability
380    /// * iOS 2.0+
381    /// * macOS 10.0+
382    /// * tvOS 9.0+
383    /// * watchOS 2.0+
384    ///
385    /// ## Framework
386    /// Core Foundation
387    #[serde(
388        rename = "CFBundleLocalizations",
389        skip_serializing_if = "Option::is_none",
390        serialize_with = "crate::serialize_vec_enum_option"
391    )]
392    pub bundle_localizations: Option<Vec<BundleLocalizations>>,
393    /// A Boolean value that indicates whether the bundle supports the retrieval of
394    /// localized strings from frameworks.
395    ///
396    /// ## Availability
397    /// * iOS 2.0+
398    /// * macOS 10.0+
399    /// * tvOS 9.0+
400    /// * watchOS 2.0+
401    ///
402    /// ## Framework
403    /// Core Foundation
404    #[serde(
405        rename = "CFBundleAllowMixedLocalizations",
406        serialize_with = "crate::serialize_option",
407        skip_serializing_if = "Option::is_none"
408    )]
409    pub bundle_allow_mixed_localizations: Option<bool>,
410    /// A Boolean value that enables the Caps Lock key to switch between Latin and
411    /// non-Latin input sources.
412    ///
413    /// Latin input sources, such as ABC, U.S., and Vietnamese, output characters in Latin
414    /// script. Non-Latin input sources, such as Bulgarian (Cyrillic script), Hindi
415    /// (Devanagari script), and Urdu (Arabic script), output characters in scripts
416    /// other than Latin.
417    ///
418    /// After implementing the key, users can enable or disable this functionality by
419    /// modifying the “Use Caps Lock to switch to and from” preference, which can be
420    /// found in System Preferences > Keyboard > Input Sources.
421    ///
422    /// ## Availability
423    /// * macOS 10.15+
424    ///
425    /// ## Framework
426    /// * AppKit
427    #[serde(
428        rename = "TICapsLockLanguageSwitchCapable",
429        serialize_with = "crate::serialize_option",
430        skip_serializing_if = "Option::is_none"
431    )]
432    pub caps_lock_language_switch_capable: Option<bool>,
433}
434
435/// Help
436#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default)]
437pub struct Help {
438    /// The name of the bundle’s HTML help file.
439    ///
440    /// ## Availability
441    /// * macOS 10.0+
442    ///
443    /// ## Framework
444    /// * Core Foundation
445    #[serde(
446        rename = "CFAppleHelpAnchor",
447        serialize_with = "crate::serialize_option",
448        skip_serializing_if = "Option::is_none"
449    )]
450    pub apple_help_anchor: Option<String>,
451    /// The name of the help file that will be opened in Help Viewer.
452    ///
453    /// ## Availability
454    /// * macOS 10.0+
455    ///
456    /// ## Framework
457    /// * Core Foundation
458    #[serde(
459        rename = "CFBundleHelpBookName",
460        serialize_with = "crate::serialize_option",
461        skip_serializing_if = "Option::is_none"
462    )]
463    pub bundle_help_book_name: Option<String>,
464    /// The name of the folder containing the bundle’s help files.
465    ///
466    /// ## Availability
467    /// * macOS 10.0+
468    ///
469    /// ## Framework
470    /// * Core Foundation
471    #[serde(
472        rename = "CFBundleHelpBookFolder",
473        serialize_with = "crate::serialize_option",
474        skip_serializing_if = "Option::is_none"
475    )]
476    pub bundle_help_book_folder: Option<String>,
477}
478
479/// App Category Type
480#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
481pub enum AppCategoryType {
482    #[serde(rename = "public.app-category.business")]
483    Business,
484    #[serde(rename = "public.app-category.developer-tools")]
485    DeveloperTools,
486    #[serde(rename = "public.app-category.education")]
487    Education,
488    #[serde(rename = "public.app-category.entertainment")]
489    Entertainment,
490    #[serde(rename = "public.app-category.finance")]
491    Finance,
492    #[serde(rename = "public.app-category.games")]
493    Games,
494    #[serde(rename = "public.app-category.action-games")]
495    ActionGames,
496    #[serde(rename = "public.app-category.adventure-games")]
497    AdventureGames,
498    #[serde(rename = "public.app-category.arcade-games")]
499    ArcadeGames,
500    #[serde(rename = "public.app-category.board-games")]
501    BoardGames,
502    #[serde(rename = "public.app-category.card-games")]
503    CardGames,
504    #[serde(rename = "public.app-category.casino-games")]
505    CasinoGames,
506    #[serde(rename = "public.app-category.dice-games")]
507    DiceGames,
508    #[serde(rename = "public.app-category.educational-games")]
509    EducationalGames,
510    #[serde(rename = "public.app-category.family-games")]
511    FamilyGames,
512    #[serde(rename = "public.app-category.kids-games")]
513    KidsGames,
514    #[serde(rename = "public.app-category.music-games")]
515    MusicGames,
516    #[serde(rename = "public.app-category.puzzle-games")]
517    PuzzleGames,
518    #[serde(rename = "public.app-category.racing-games")]
519    RacingGames,
520    #[serde(rename = "public.app-category.role-playing-games")]
521    RolePlayingGames,
522    #[serde(rename = "public.app-category.simulation-games")]
523    SimulationGames,
524    #[serde(rename = "public.app-category.sports-games")]
525    SportsGames,
526    #[serde(rename = "public.app-category.strategy-games")]
527    StrategyGames,
528    #[serde(rename = "public.app-category.trivia-games")]
529    TriviaGames,
530    #[serde(rename = "public.app-category.word-games")]
531    WordGames,
532    #[serde(rename = "public.app-category.graphics-design")]
533    GraphicsDesign,
534    #[serde(rename = "public.app-category.healthcare-fitness")]
535    HealthcareFitness,
536    #[serde(rename = "public.app-category.lifestyle")]
537    Lifestyle,
538    #[serde(rename = "public.app-category.medical")]
539    Medical,
540    #[serde(rename = "public.app-category.music")]
541    Music,
542    #[serde(rename = "public.app-category.news")]
543    News,
544    #[serde(rename = "public.app-category.photography")]
545    Photography,
546    #[serde(rename = "public.app-category.productivity")]
547    Productivity,
548    #[serde(rename = "public.app-category.reference")]
549    Reference,
550    #[serde(rename = "public.app-category.social-networking")]
551    SocialNetworking,
552    #[serde(rename = "public.app-category.sports")]
553    Sports,
554    #[serde(rename = "public.app-category.travel")]
555    Travel,
556    #[serde(rename = "public.app-category.utilities")]
557    Utilities,
558    #[serde(rename = "public.app-category.video")]
559    Video,
560    #[serde(rename = "public.app-category.weather")]
561    Weather,
562}
563
564/// Operating System Version
565#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
566pub struct MinimumSystemVersionByArchitecture {
567    pub i386: String,
568    pub ppc: String,
569    pub ppc64: String,
570    pub x86_64: String,
571}
572
573impl Default for MinimumSystemVersionByArchitecture {
574    fn default() -> Self {
575        Self {
576            i386: "10.0.0".to_owned(),
577            ppc: "10.0.0".to_owned(),
578            ppc64: "10.0.0".to_owned(),
579            x86_64: "10.0.0".to_owned(),
580        }
581    }
582}
583
584/// Bundle Localizations
585#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
586pub enum BundleLocalizations {
587    #[serde(rename = "zh")]
588    Zh,
589    #[serde(rename = "zh_CN")]
590    ZhCn,
591    #[serde(rename = "zh_TW")]
592    ZhTw,
593    #[serde(rename = "en")]
594    En,
595    #[serde(rename = "fr")]
596    Fr,
597    #[serde(rename = "de")]
598    De,
599    #[serde(rename = "it")]
600    It,
601    #[serde(rename = "ja")]
602    Ja,
603    #[serde(rename = "ko")]
604    Ko,
605}