- Qbs Manual
- QbsModules
- bundle
- Qbs 3.2.0

# bundle

Provides Core Foundation bundle support. More...

Since: | Qbs 1.4

- List of all members, including inherited members

## Properties

- applicationsFolderPath : string
- bundleName : string
- contentsFolderPath : string
- documentationFolderPath : string `(since Qbs 1.5)`
- embedInfoPlist : bool
- executableFolderPath : string
- executablePath : string
- executablesFolderPath : string
- extension : string
- frameworkVersion : string
- frameworksFolderPath : string
- generatePackageInfo : bool `(since Qbs 1.5)`
- identifier : string
- identifierPrefix : string
- infoPlist : var
- infoPlistFormat : string
- infoPlistPath : string
- infoStringsPath : string `(since Qbs 1.5)`
- isBundle : bool
- isForMainBundle : bool `(since Qbs 3.1)`
- isMainBundle : bool `(since Qbs 3.1)`
- isShallow : bool
- javaFolderPath : string `(since Qbs 1.5)`
- localizedResourcesFolderPath : string `(since Qbs 1.5)`
- packageType : string
- pkgInfoPath : string
- pluginsFolderPath : string
- privateHeaders : pathList
- privateHeadersFolderPath : string
- processInfoPlist : bool
- publicHeaders : pathList
- publicHeadersFolderPath : string
- resources : pathList
- scriptsFolderPath : string
- sharedFrameworksFolderPath : string
- sharedSupportFolderPath : string
- signature : string
- unlocalizedResourcesFolderPath : string
- useBuiltinXcodeBuildSpecs : bool
- versionPlistPath : string
- versionsFolderPath : string `(since Qbs 1.5)`

## Detailed Description

The `bundle` module contains properties and rules for building and working with Core Foundation bundles on Apple platforms (commonly known as CFBundles or simply bundles), directories with a standardized hierarchical structure that hold executable code and resources. Examples include applications, frameworks, and plugins.

This module is available on all platforms but is currently only useful on Apple platforms.

Note: Core Foundation bundles are not to be confused with Mach-O loadable modules, which are also referred to as (loadable) bundles in Apple parlance. In Qbs, Core Foundation bundles are referred to as bundles, while Mach-O loadable bundles are referred to as loadable modules.

### Dependency Parameters

Parameter | Type | Since | Default | Description
--- | --- | --- | --- | ---
`isForMainBundle` | `bool` | 3.1 | true | If `false`, the dependency will not be copied into this main bundle.

### Relevant File Tags

Tag | Auto-tagged File Names | Since | Description
--- | --- | --- | ---
`"bundle.content"` | - | 1.8 | Attached to the output artifacts of the rule that produces the bundle.
`"infoplist"` | `Info.plist`, `*-Info.plist` | 1.5 | Source files with this tag are Info property lists files or fragments that are merged into the bundle's final `Info.plist`.
`"bundle.input.public_hpp"` | n/a | 3.0 | Source files with this tag will be copied to the `Headers` directory within a bundle.
`"bundle.input.private_hpp"` | n/a | 3.0 | Source files with this tag will be copied to the `PrivateHeaders` directory within a bundle.
`"bundle.input.resources"` | n/a | 3.0 | Source files with this tag will be copied to the `Resources` directory within a bundle.

### Main bundles

It is possible to create a bundle that contains other products within itself. This is useful for big applications which depend on custom frameworks and/or other applications.

Creating a main bundle is quite easy, simply set the isMainBundle property to `true` and all dependencies will be copied automatically to appropriate locations:

     CppApplication {
         name: "main"
         files: "main.cpp"
         Depends { name: "mylib" }
         Depends { name: "bundle" }
         bundle.isMainBundle: true
     }
     DynamicLibrary {
         name: "mylib"
         Depends { name: "cpp" }
         files: "mylib.cpp"
         install: false // skip installing the framework
     }

In order to exclude a dependency from the main bundle, set the bundle::isForMainBundle property to `false` in the product:

     DynamicLibrary {
         name: "otherlib"
         Depends { name: "bundle" }
         bundle.isForMainBundle: false
     }

Alternatively, set the `bundle.isForMainBundle` dependency parameter in the main bundle itself:

     CppApplication {
         name: "main"
         Depends { name: "otherlib"; bundle.isForMainBundle: false }
         // ...
     }

See the full example the the examples folder.

Note: Currently, static frameworks and libraries are not supported as an input to a main bundle.

## Property Documentation

### applicationsFolderPath : string `[read-only]`

The path of the directory where dependent applications will be copied.

This property applies only if isMainBundle is `true`.

The path is relative to the directory that contains the bundle.

### bundleName : string

The file name of the bundle's wrapper directory.

This property should not normally need to be changed.

Default: A combination of the product's targetName and bundle's extension.

### contentsFolderPath : string `[read-only]`

The path of the bundle's `Contents` subdirectory.

The path is relative to the directory that contains the bundle.

### documentationFolderPath : string `[read-only, since Qbs 1.5]`

The path of the directory where documentation will be written.

The path is relative to the directory that contains the bundle.

This property was introduced in Qbs 1.5.

### embedInfoPlist : bool

Whether to create a `__TEXT` section in the product's executable containing the processed `Info.plist`.

Only applies to command line applications.

Default: `true` if the product is a command line tool, otherwise `false`.

### executableFolderPath : string `[read-only]`

The path of the directory where the main exectuable will be written.

The path is relative to the directory that contains the bundle.

Not to be confused with executablesFolderPath.

### executablePath : string `[read-only]`

The path that the main executable file will be written to.

The path is relative to the directory that contains the bundle.

### executablesFolderPath : string `[read-only]`

The path of the directory where auxiliary executables will be copied.

The path is relative to the directory that contains the bundle.

Not to be confused with executableFolderPath.

### extension : string

The extension of the bundle's wrapper directory, without the leading period (.).

This property should not normally need to be set unless creating a custom bundle type.

Default: `"app"` for `"APPL"` packages, `"framework"` for `"FMWK"` packages, and `"bundle"` for `"BNDL"` and custom packages.

### frameworkVersion : string

For framework bundles, the version of the framework. Not used for other package types.

Default: `"A"`

### frameworksFolderPath : string `[read-only]`

The path of the directory where internal frameworks will be copied.

The path is relative to the directory that contains the bundle.

### generatePackageInfo : bool `[since Qbs 1.5]`

Whether to generate a `PkgInfo` file for the bundle.

This property should almost never need to be changed, even though enabling it when specifying an alternative package type for custom bundles using packageType is allowed.

Default: `true` for applications, otherwise `false`.

This property was introduced in Qbs 1.5.

### identifier : string

The bundle's identifier. If left unset, the bundle identifier will be a concatenation of the identifierPrefix value and the Product.targetName propertyy formatted as an RFC-1034 identifier, separated by a period (.).

Default: A combination of identifierPrefix and the product's target name formatted as an RFC-1034 identifier.

### identifierPrefix : string

A prefix for the product's bundle identifier. If identifier is left unset, the bundle identifier will be a concatenation of this value and the Product.targetName property formatted as an RFC-1034 identifier, separated by a period (.). This corresponds to the organization identifier in Xcode.

Default: `org.example`

### infoPlist : var

A dictionary of key-value pairs to add to the bundle's `Info.plist`.

The contents of this property will be aggregated with the values from any `plist` files. If this property and any `plist` files contain the same key, this property will take precedence. However, it might be overridden during postprocessing (see processInfoPlist).

If `undefined`, will not be taken into account.

Default: Undefined

### infoPlistFormat : string

The file format to write the product's resulting `Info.plist` in.

Possible values are:

- `"binary1"`
- `"json"`
- `"same-as-input"`
- `"xml1"`

Default: `"binary1"` for iOS, `"same-as-input"` or `"xml1"` for macOS depending on whether a `plist` file is used, and `undefined` for all other operating systems.

### infoPlistPath : string `[read-only]`

The path that the `Info.plist` file will be written to.

The path is relative to the directory that contains the bundle.

### infoStringsPath : string `[read-only, since Qbs 1.5]`

The path that the `InfoPlist.strings` file will be written to.

The path is relative to the directory that contains the bundle.

This property was introduced in Qbs 1.5.

### isBundle : bool

Whether the product should actually be packaged as a bundle as opposed to a flat file. This allows a product indirectly dependent on the `bundle` module to retain control of whether it should actually be built as a bundle.

Default: `true` for applications and dynamic libraries on Apple platforms, `false` otherwise.

### isForMainBundle : bool `[since Qbs 3.1]`

Set this property to `false` to skip copying of this product into any dependent main bundle.

Default: `true`.

This property was introduced in Qbs 3.1.

See also isMainBundle.

### isMainBundle : bool `[since Qbs 3.1]`

Whether to copy dependencies into this bundle.

Default: `false`

This property was introduced in Qbs 3.1.

See also isForMainBundle.

### isShallow : bool `[read-only]`

Whether the bundle directory tree is shallow. That is, whether it lacks a `Contents` subdirectory. This is the default on all platforms other than macOS.

Default: `false` on macOS, otherwise `true`.

### javaFolderPath : string `[read-only, since Qbs 1.5]`

The path of the directory where Java content will be written.

The path is relative to the directory that contains the bundle.

This property was introduced in Qbs 1.5.

### localizedResourcesFolderPath : string `[read-only, since Qbs 1.5]`

The path of the directory where localized resource files will be copied.

The path is relative to the directory that contains the bundle.

This property was introduced in Qbs 1.5.

### packageType : string

The four-letter file type code of the bundle, specified in the bundle's `PkgInfo` file and in the bundle's `Info.plist` as the value for the `CFBundlePackageType` key.

This property should almost never need to be changed, even though specifying an alternative package type for custom bundles is allowed.

Default: `"APPL"` for applications, `"FMWK"` for frameworks, and `"BNDL"` for custom bundles.

### pkgInfoPath : string `[read-only]`

The path that the `PkgInfo` file will be written to.

The path is relative to the directory that contains the bundle.

### pluginsFolderPath : string `[read-only]`

The path of the directory where plugins will be copied.

The path is relative to the directory that contains the bundle.

### privateHeaders : pathList

A list of private header files to copy to a framework bundle's `PrivateHeaders` subdirectory

It is recommended to attach the `"bundle.input.private_hpp"` file tag to headers instead:

     CppApplication {
         Depends { name: "bundle" }
         files: "main.cpp"
         Group {
             name: "private headers"
             files: ["header.h"]
             fileTags: ["bundle.input.private_hpp", "hpp"]
         }
     }

Note: Since Group.fileTags property replaces file tags attached by the FileTagger item, the `"hpp"` tag should also be present.

Default: Undefined

### privateHeadersFolderPath : string `[read-only]`

The path of the directory where private header files will be copied.

The path is relative to the directory that contains the bundle.

### processInfoPlist : bool

Whether to perform post-processing on the aggregated `Info.plist` contents.

If this property is `true`, various post-processing operations will be applied to the bundle's property list dictionary after it has been aggregated from the contents of any `plist` files on disk, and the infoPlist property.

First, values from a list of defaults will be added to the dictionary if they were not already present. Second, values from the `AdditionalInfo` key of the platform SDK's `Info.plist` file will be added to the dictionary if they were not already present, as well as some other miscellaneous keys, such as `BuildMachineOSBuild` and `UIDeviceFamily` (on iOS). Finally, variable expansions will be performed such that substrings of the form `$(VAR)` or `${VAR}` will be replaced with their corresponding environment variables.

Default: `true`

### publicHeaders : pathList

A list of public header files to copy to a framework bundle's `Headers` subdirectory.

It is recommended to attach the `"bundle.input.public_hpp"` file tag to headers instead:

     CppApplication {
         Depends { name: "bundle" }
         files: "main.cpp"
         Group {
             name: "public headers"
             files: ["header.h"]
             fileTags: ["bundle.input.public_hpp", "hpp"]
         }
     }

Note: Since Group.fileTags property replaces file tags attached by the FileTagger item, the `"hpp"` tag should also be present.

Default: Undefined

### publicHeadersFolderPath : string `[read-only]`

The path of the directory where public headers files will be copied.

The path is relative to the directory that contains the bundle.

### resources : pathList

A list of resources to copy to a bundle's `Resources` subdirectory. Files will automatically be copied into `lproj` subdirectories corresponding to the input files' paths.

It is recommended to attach the `"bundle.input.resources"` file tag to resources instead:

     CppApplication {
         Depends { name: "bundle" }
         files: "main.cpp"
         Group {
             name: "resources"
             files: ["file.txt"]
             fileTags: ["bundle.input.resources"]
         }
     }

Default: Undefined

### scriptsFolderPath : string `[read-only]`

The path of the directory where script files will be copied.

The path is relative to the directory that contains the bundle.

### sharedFrameworksFolderPath : string `[read-only]`

The path of the directory where shared frameworks will be copied.

The path is relative to the directory that contains the bundle.

### sharedSupportFolderPath : string `[read-only]`

The path of the directory where shared support files will be copied.

The path is relative to the directory that contains the bundle.

### signature : string

The four-letter signature specific to the bundle, also known as the creator code, specified in the bundle's `PkgInfo` file and in the bundle's `Info.plist` as the value for the `CFBundleSignature` key.

This property should normally never need to be set.

Default: `"????"`

### unlocalizedResourcesFolderPath : string `[read-only]`

The path of the directory where non-localized resource files will be copied.

The path is relative to the directory that contains the bundle.

This is the same as the base resources path.

### useBuiltinXcodeBuildSpecs : bool `[default: false]`

Set this property to `true` to use Xcode `.xcspec` files shipped with Qbs.

This property can be used as a workaround when using a new Xcode version that is not supported by Qbs yet.

### versionPlistPath : string `[read-only]`

The path that the `version.plist` file will be written to.

The path is relative to the directory that contains the bundle.

### versionsFolderPath : string `[read-only, since Qbs 1.5]`

The path of the bundle's `Versions` subdirectory.

The path is relative to the directory that contains the bundle.

This is only relevant for (non-shallow) framework bundles.

This property was introduced in Qbs 1.5.