### Install Application Executable
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Installs the main application executable to the runtime destination. This makes the application available to be run.
```cmake
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
```
--------------------------------
### Install and Run Trapeze CLI
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/frameworks/react-native.md
Commands to install the Trapeze CLI and run a configuration file.
```bash
npm install @trapezedev/configure
npx trapeze run config.yaml
```
--------------------------------
### Install and Run Trapeze CLI
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/frameworks/native-ios.md
Commands to install the Trapeze CLI and run a configuration file.
```bash
npm install @trapezedev/configure
npx trapeze run config.yaml
```
--------------------------------
### Define Installation Directories for Bundle
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Sets the destination directories for data and libraries within the installed bundle. These paths are relative to the installation prefix.
```cmake
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
```
--------------------------------
### Define Installation Directories
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Sets the destination directories for installing application data and libraries. These paths are relative to the CMAKE_INSTALL_PREFIX.
```cmake
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
```
--------------------------------
### Project Initialization and Loading
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Demonstrates how to install the package, configure project paths, and load a mobile project instance.
```APIDOC
## Installation
```bash
npm install @trapezedev/project
```
## TypeScript Configuration
Ensure `dom` lib is enabled in `tsconfig.json`.
## Requirements
For Android, `java` must be on `PATH` or `JAVA_HOME` must be set.
## API Usage
### Initialize and Load Project
```typescript
import { MobileProject, MobileProjectConfig } from '@trapeze/project';
const config: MobileProjectConfig = {
ios: {
path: 'ios',
},
android: {
path: 'android',
},
};
const project = new MobileProject('project/root', config);
await project.load();
```
```
--------------------------------
### Install Trapeze Configure Package
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/getting-started.md
Install the `@trapezedev/configure` package using npm. Ensure Java is configured for Android operations.
```bash
npm install @trapezedev/configure
```
--------------------------------
### YAML Configuration with JSON Variables and References
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/getting-started.md
Example showing JSON-parsable variables and how to reference other variables within the configuration.
```yaml
vars:
KEYCHAIN_GROUPS:
default:
[
'$BUNDLE_ID',
]
platforms:
ios:
targets:
App:
entitlements:
- keychain-access-groups: $KEYCHAIN_GROUPS
```
--------------------------------
### Plugin Configuration for Capacitor and React Native
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/recipes.md
Automatically configure native plugins on install for frameworks like Capacitor or React Native. This example demonstrates setting iOS build settings and plist entries, and injecting XML into Android's Manifest.
```yaml
platforms:
ios:
targets:
App:
buildSettings:
ENABLE_BITCODE: false
STRIP_SWIFT_SYMBOLS: false
plist:
replace: false
entries:
- CFBundleURLTypes:
- CFBundleURLSchemes:
- msauth.$(PRODUCT_BUNDLE_IDENTIFIER)
- msauth.$(PRODUCT_BUNDLE_IDENTIFIER)-intunemam
- msauth.com.microsoft.intunemam
android:
manifest:
- file: AndroidManifest.xml
target: manifest
inject: |
```
--------------------------------
### iOS Configuration in YAML
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/frameworks/native-ios.md
Example of a YAML configuration file specifying iOS target versions.
```yaml
platforms:
ios:
targets:
App:
version: 16.4
```
--------------------------------
### Basic YAML Configuration Example
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/getting-started.md
A simple YAML file defining version information for Android and iOS platforms.
```yaml
platforms:
android:
versionName: 5.2.1
ios:
version: 16.4
```
--------------------------------
### Install Bundled Plugin Libraries
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Iterates through a list of bundled libraries (likely from plugins) and installs each one to the lib directory within the bundle. This is part of the Runtime component.
```cmake
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
install(FILES "${bundled_library}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endforeach(bundled_library)
```
--------------------------------
### Install Bundled Plugin Libraries
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Installs any bundled plugin libraries to the library directory of the bundle. This ensures that plugins are available at runtime.
```cmake
if(PLUGIN_BUNDLED_LIBRARIES)
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
```
--------------------------------
### Clean Build Bundle Directory on Install
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Ensures the build bundle directory is clean before installation by removing its contents. This is done as a runtime component during installation.
```cmake
install(CODE "
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
" COMPONENT Runtime)
```
--------------------------------
### Install Flutter Library
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Installs the main Flutter library file to the bundle's root directory. This is a core component required for the Flutter engine to run.
```cmake
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
```
--------------------------------
### Set Installation Directory for Bundle
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Defines the installation directory for the application bundle, placing support files next to the executable for in-place execution. This is particularly useful for Visual Studio builds.
```cmake
set(BUILD_BUNDLE_DIR "$")
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
```
--------------------------------
### Configure Installation Prefix for Bundle
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Sets the installation prefix to a bundle directory within the build directory. This is the default behavior for creating a relocatable bundle.
```cmake
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
```
--------------------------------
### Add and Get iOS Frameworks
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Use `addFramework` to include frameworks in your iOS project. Pass options like `embed` or `link` for complex setups. `getFrameworks` retrieves the list of added frameworks.
```typescript
project.ios?.addFramework(targetName, 'ImageIO.framework');
```
```typescript
project.ios?.addFramework(targetName, 'Custom.framework', {
embed: true,
});
```
```typescript
project.ios?.getFrameworks(targetName);
```
--------------------------------
### YAML Configuration with Variables
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/getting-started.md
Example of defining variables in YAML, including one with a default value. These can be supplied via environment variables or interactive prompts.
```yaml
vars:
MY_APP_ID:
THIS_HAS_A_DEFAULT:
default: true
```
--------------------------------
### Install AOT Library for Release Builds
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Installs the Ahead-Of-Time (AOT) compiled library on non-Debug builds (Profile and Release configurations only). This optimizes runtime performance.
```cmake
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
CONFIGURATIONS Profile;Release
COMPONENT Runtime)
```
--------------------------------
### React Native Configuration YAML
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/frameworks/react-native.md
Example YAML file to configure Android and iOS platforms for a React Native project. Use this with the Trapeze CLI.
```yaml
platforms:
android:
manifest:
- file: AndroidManifest.xml
target: manifest/application
inject:
ios:
targets:
App:
version: 16.4
```
--------------------------------
### Install ICU Data File
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Installs the ICU data file, which is necessary for internationalization and localization, to the data directory of the bundle.
```cmake
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
```
--------------------------------
### Install AOT Library Conditionally
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Installs the AOT (Ahead-Of-Time) library for non-Debug builds. This ensures that performance-critical libraries are only included when needed.
```cmake
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
```
--------------------------------
### Running Trapeze Configuration Script
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/recipes.md
Execute a Trapeze configuration script after installing a plugin. This command is used to apply the settings defined in a YAML configuration file to the project.
```shell
npm install my-capacitor-plugin
npx @trapezedev/configure run node_modules/my-capacitor-plugin/install.yaml
```
--------------------------------
### Build-Specific Configuration for google-services.json
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/recipes.md
Configure build-specific settings, such as the `project_id` in `google-services.json`, using environment variables. This example shows how to set the `project_id` for both Android and iOS targets.
```yaml
vars:
GOOGLE_PROJECT_ID:
default: "default_id"
platforms:
android:
json:
- file: google-services.json
set:
project_info:
project_id: $GOOGLE_PROJECT_ID
ios:
targets:
App:
json:
- file: google-services.json
set:
project_info:
project_id: $GOOGLE_PROJECT_ID
```
--------------------------------
### Set Minimum CMake Version and Project Name
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Specifies the minimum required CMake version and sets the project name. This is a standard starting point for CMake projects.
```cmake
cmake_minimum_required(VERSION 3.10)
project(runner LANGUAGES CXX)
```
--------------------------------
### Set Minimum CMake Version and Project Name
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Specifies the minimum required CMake version and defines the project name. This is a standard starting point for CMake projects.
```cmake
cmake_minimum_required(VERSION 3.14)
project(flutter_configure_test LANGUAGES CXX)
```
--------------------------------
### Manage iOS Version and Build Number
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Manage the version and build numbers for an iOS project. Includes getting, setting, and incrementing the build number, as well as setting the marketing version.
```typescript
// Get the numeric build number (aka CURRENT_PROJECT_VERSION) for the given target and build name
project.ios?.getBuild(targetName, buildName);
// Get the version name (aka the MARKETING_VERSION)
project.ios?.getVersion(targetName, buildName);
// Set the numeric build number
await project.ios?.setBuild(targetName, buildName, 42);
// Increment the build number
await project.ios?.incrementBuild(targetName, buildName);
// Set the marketing version
await project.ios?.setVersion(targetName, buildName, '1.2.3');
```
--------------------------------
### Get Gradle File Reference
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Obtain a reference to a Gradle file within an Android project. Supports 'build.gradle' and 'app/build.gradle'. For other files, use `GradleFile` directly.
```typescript
const buildGradleFile = project.android?.getGradleFile('build.gradle');
const appBuildGradleFile = project.android?.getGradleFile('app/build.gradle');
```
--------------------------------
### Set Flutter Library Path
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/flutter/CMakeLists.txt
Defines the path to the Flutter dynamic library. This variable is published to the parent scope for use in the install step.
```cmake
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
```
--------------------------------
### Get iOS Targets
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Retrieve all targets within an iOS project, including the main app target. Targets contain properties like id, name, productName, productType, and build configurations.
```typescript
// Get all targets in the project
project.ios?.getTargets();
// Targets have properties like id, name, productName, productType, and a list of buildConfigurations
// Get the main app target in the project
const appTarget = project.ios?.getAppTarget();
```
--------------------------------
### Initialize MobileProject with Capacitor Paths
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/frameworks/capacitor.md
Instantiate the MobileProject class for a Capacitor project, specifying the paths to the iOS and Android directories.
```typescript
import { MobileProject, MobileProjectConfig } from '@trapezedev/project';
const config: MobileProjectConfig = {
ios: {
path: 'ios/App',
},
android: {
path: 'android',
},
};
const project = new MobileProject('/path/to/project/dir', config);
await project.load();
```
--------------------------------
### Initialize MobileProject Instance
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Initialize a new MobileProject instance with configuration for iOS and Android paths. Ensure the project is loaded before performing operations.
```typescript
import { MobileProject, MobileProjectConfig } from '@trapezedev/project';
const config: MobileProjectConfig = {
ios: {
path: 'ios',
},
android: {
path: 'android',
},
};
const project = new MobileProject('project/root', config);
await project.load();
```
--------------------------------
### Initialize MobileProject for Android
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/frameworks/native-android.md
Instantiate the MobileProject class with the project directory and configuration, specifying the Android project path. The project must be loaded after instantiation.
```typescript
import { MobileProject, MobileProjectConfig } from '@trapezedev/project';
const config: MobileProjectConfig = {
android: {
path: '.',
},
};
const project = new MobileProject('/path/to/project/dir', config);
await project.load();
```
--------------------------------
### Insert Gradle Plugin and Configuration
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/android.md
Applies a Gradle plugin and configures its settings within the app/build.gradle file.
```yaml
platforms:
android:
gradle:
- file: app/build.gradle
target:
insert: |
apply plugin: 'com.microsoft.intune.mam'
intunemam {
includeExternalLibraries = ["androidx.*", "com.getcapacitor.*"]
}
```
--------------------------------
### Configure Cross-Building Sysroot
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Sets up the sysroot and find paths for cross-compilation. This is used when building for a different target platform than the host system.
```cmake
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
```
--------------------------------
### Manage iOS Display Name
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Get or set the display name for an iOS application. This is the name shown to the user on the device.
```typescript
project.ios?.getDisplayName(targetName, buildName);
project.ios?.setDisplayName(targetName, buildName, 'Really Awesome App');
```
--------------------------------
### Find and check GTK, GLIB, and GIO modules
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/flutter/CMakeLists.txt
Uses PkgConfig to find and check for the required GTK, GLIB, and GIO modules, making their imported targets available for linking.
```cmake
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
```
--------------------------------
### Initialize MobileProject for iOS
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/frameworks/native-ios.md
Instantiate the MobileProject class for an iOS project using the API. Ensure the correct project directory and configuration path are provided.
```typescript
import { MobileProject, MobileProjectConfig } from '@trapezed/project';
const config: MobileProjectConfig = {
ios: {
path: '.',
},
};
const project = new MobileProject('/path/to/project/dir', config);
await project.load();
```
--------------------------------
### Set and Get Android Package Name
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Modify the Android package name using `setPackageName`. Retrieve the current package name with `getPackageName`.
```typescript
project.android?.setPackageName('com.ionicframework.awesome');
```
```typescript
project.android?.getPackageName();
```
--------------------------------
### Run Trapeze Configuration
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/getting-started.md
Process a Trapeze YAML configuration file using the `run` command. Specify paths to your Android and iOS projects.
```bash
npx trapeze run config.yaml --android-project android --ios-project ios/App
```
--------------------------------
### Committing Changes
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Explains how to commit changes made in the virtual file system and how to preview them.
```APIDOC
## Committing Changes
Changes are made in a virtual filesystem and committed using `project.commit()`.
### Commit Changes
```typescript
project.commit();
```
### Preview Changes
```typescript
const changedFiles = project.vfs.all();
changedFiles.forEach((f) => {
console.log(f.getFilename(), f.getData());
});
```
```
--------------------------------
### Configure Flutter Tool Backend Command
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/flutter/CMakeLists.txt
Sets up a custom command to execute the Flutter tool backend. A phony output file is used to ensure the command runs every time, as direct input/output tracking is not available.
```cmake
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
${PHONY_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $
VERBATIM
)
```
--------------------------------
### Replace Gradle Implementation String
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/android.md
Replaces the implementation configuration with a quoted string in app/build.gradle.
```yaml
platforms:
android:
gradle:
- file: app/build.gradle
target:
android:
buildTypes:
implementation:
replace:
implementation: "'test-implementation'"
```
--------------------------------
### Access Deployed Assets with Essentials
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/DotNetMauiApp/Resources/Raw/AboutAssets.txt
This C# code snippet demonstrates how to load a raw asset file that was deployed with your application package using the FileSystem.OpenAppPackageFileAsync method from Essentials. Ensure the asset is included with the MauiAsset build action.
```csharp
async Task LoadMauiAsset()
{
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
using var reader = new StreamReader(stream);
var contents = reader.ReadToEnd();
}
```
--------------------------------
### Provide Environment Variable to Trapeze Command
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/getting-started.md
Demonstrates how to pass an environment variable to the Trapeze command-line tool.
```shell
MY_APP_ID="com.awesome.app" npx trapeze
```
--------------------------------
### Manage iOS Bundle ID
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Get or set the bundle ID for a specific iOS target and build name. The build name is optional and defaults to 'Debug' or 'Release' if not provided.
```typescript
// Get the bundle id for the given target, pass the build name as an optional second parameter
project.ios?.getBundleId(appTarget.name);
project.ios?.setBundleId(targetName, buildName, 'io.ionic.betterBundleId');
project.ios?.setBundleId(targetName, null, 'io.ionic.betterBundleId');
```
--------------------------------
### Configure Android Platform
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/android.md
Use the `android` platform key under the top-level `platforms` key to enable Android project operations.
```yaml
platforms:
android:
```
--------------------------------
### Apply Standard Build Settings
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/runner/CMakeLists.txt
Applies a standard set of build settings to the target. This can be customized or removed if the application requires different build configurations.
```cmake
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
```
--------------------------------
### iOS Info.plist Management
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Explains how to update and retrieve information from the `Info.plist` file for a given iOS target and build configuration.
```APIDOC
## iOS Info.plist Management
Modifications to `Info.plist` can be made by passing an object.
### Update Info.plist
```typescript
await project.ios?.updateInfoPlist(targetName, buildName, {
NSFaceIDUsageDescription: 'The better to see you with',
});
```
### Get Info.plist Path
```typescript
// Get the relative path to the Info.plist
await project.ios?.getInfoPlist(targetName, buildName);
// Get the full path to the Info.plist filename
await project.ios?.getInfoPlistFilename(targetName, buildName);
```
**Note:** This method relies on the registered `INFOPLIST_FILE` for the target and build.
```
--------------------------------
### Set Display Name
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Sets the display name for the given target and build.
```yaml
platforms:
ios:
targets:
App:
displayName: My Awesome App
```
--------------------------------
### Specify Target and Build
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Provide both a target and a build type (e.g., Debug, Release) for operations. Commands will operate on all builds in a target if a build is not specified.
```yaml
platforms:
ios:
targets:
App:
builds:
Debug:
# Operations for the App target and Debug build
Release:
# Operations for the App target and Release build
```
--------------------------------
### Include Raw Assets with MauiAsset
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/DotNetMauiApp/Resources/Raw/AboutAssets.txt
Use the MauiAsset build action in your project file to include raw assets that will be deployed with your application package. These files are accessible at runtime.
```xml
```
--------------------------------
### Manage iOS Build Configurations
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Retrieve all build configurations for a target using `getBuildConfigurations`. Individual build properties can be read or written using `setBuildProperty` and `getBuildProperty`.
```typescript
project.ios?.getBuildConfigurations(target);
```
```typescript
project.ios?.setBuildProperty(targetName, buildName, 'FAKE_PROPERTY', 'YES');
```
```typescript
project.ios?.getBuildProperty(targetName, buildName, 'FAKE_PROPERTY');
```
--------------------------------
### iOS Target Management
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Details how to manage iOS targets, including selecting specific targets and build names.
```APIDOC
## iOS Target Management
Operations can be isolated to specific targets and build names (`Debug`, `Release`).
### Get All Targets
```typescript
// Get all targets in the project
project.ios?.getTargets();
// Targets have properties like id, name, productName, productType, and a list of buildConfigurations
```
### Get App Target
```typescript
// Get the main app target in the project
const appTarget = project.ios?.getAppTarget();
```
**Note:** `targetName` can often be `null` to default to the main App target. `buildName` can be `null` or omitted, but behavior may vary.
```
--------------------------------
### Set Build Settings
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Sets specific build settings fields for the target and build.
```yaml
platforms:
ios:
targets:
App:
buildSettings:
ENABLE_BITCODE: false
STRIP_SWIFT_SYMBOLS: false
```
--------------------------------
### Configure iOS Platform
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Use the `ios` platform key under the top-level `platforms` key to provide iOS project operations.
```yaml
platforms:
ios:
```
--------------------------------
### YAML Configuration for Mobile Projects
Source: https://github.com/ionic-team/trapeze/blob/main/README.md
Define project configurations for iOS and Android platforms using a YAML file. Variables can be supplied from the environment or interactively.
```yaml
platforms:
ios:
targets:
App:
bundleId: $BUNDLE_ID
version: $VERSION
android:
packageName: com.example.app
versionName: $VERSION_NAME
versionCode: $VERSION_CODE
```
--------------------------------
### Set Product Name
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Sets the product name for the given target and build, which corresponds to the `PRODUCT_NAME` field in your project build settings.
```yaml
platforms:
ios:
targets:
App:
productName: Awesome App
```
--------------------------------
### Android Project Settings
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Manage core Android project settings including package name, version, and manifest.
```APIDOC
## Android Project Settings
### Description
Manage core Android project settings such as package name, version name/code, and AndroidManifest.xml.
### Method
`setPackageName(packageName: string): Promise`
`getPackageName(): Promise`
`setVersionName(versionName: string): Promise`
`getVersionName(): Promise`
`setVersionCode(versionCode: number): Promise`
`getVersionCode(): Promise`
`incrementVersionCode(): Promise`
`setVersionNameSuffix(suffix: string): Promise`
`getVersionNameSuffix(): Promise`
`getAndroidManifest(): AndroidManifest`
### Parameters
#### Path Parameters
- **packageName** (string) - Required - The new package name for the Android application.
- **versionName** (string) - Required - The new version name for the Android application.
- **versionCode** (number) - Required - The new version code for the Android application.
- **suffix** (string) - Optional - The suffix to append to the version name.
### Request Example
```typescript
project.android?.setPackageName('com.ionicframework.awesome');
await project.android?.setVersionName('1.0.2');
await project.android?.setVersionCode(11);
await project.android?.incrementVersionCode();
await project.android?.setVersionNameSuffix('beta');
project.android?.getAndroidManifest();
```
### Response
#### Success Response (200)
Methods return void or the requested string/number value.
```
--------------------------------
### Link Libraries and Include Directories
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/runner/CMakeLists.txt
Adds necessary dependency libraries (flutter, flutter_wrapper_app) and include directories to the target. Application-specific dependencies should also be added here.
```cmake
# Add dependency libraries and include directories. Add any application-specific
# dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
```
--------------------------------
### Link Application with Libraries
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Links the application executable against the Flutter library and the GTK+ 3.0 PkgConfig target. Add any other application-specific dependencies here.
```cmake
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
```
--------------------------------
### iOS Build Configurations Management
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Manage build settings and properties for iOS targets and builds.
```APIDOC
## iOS Build Configurations Management
### Description
Manage build settings and properties for iOS targets and builds. Build settings can be read, written, or modified.
### Method
`getBuildConfigurations(target: string): Promise>`
`setBuildProperty(targetName: string, buildName: string, propertyName: string, value: string): Promise`
`getBuildProperty(targetName: string, buildName: string, propertyName: string): Promise`
### Parameters
#### Path Parameters
- **target** (string) - Required - The name of the target.
- **targetName** (string) - Required - The name of the target.
- **buildName** (string) - Required - The name of the build configuration.
- **propertyName** (string) - Required - The name of the build property.
- **value** (string) - Required - The value to set for the build property.
### Request Example
```typescript
project.ios?.getBuildConfigurations(target);
project.ios?.setBuildProperty(targetName, buildName, 'FAKE_PROPERTY', 'YES');
project.ios?.getBuildProperty(targetName, buildName, 'FAKE_PROPERTY');
```
### Response
#### Success Response (200)
`getBuildConfigurations` returns an array of build configuration objects. `getBuildProperty` returns the value of the specified build property.
```
--------------------------------
### iOS Project Settings Management
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Covers managing Bundle ID, Version, Build Number, and Display Name for iOS targets.
```APIDOC
## iOS Project Settings
### Bundle ID
```typescript
// Get the bundle id for the given target
project.ios?.getBundleId(appTarget.name);
// Set the bundle id
project.ios?.setBundleId(targetName, buildName, 'io.ionic.betterBundleId');
project.ios?.setBundleId(targetName, null, 'io.ionic.betterBundleId');
```
### Version and Build Number
```typescript
// Get the numeric build number (CURRENT_PROJECT_VERSION)
project.ios?.getBuild(targetName, buildName);
// Get the version name (MARKETING_VERSION)
project.ios?.getVersion(targetName, buildName);
// Set the numeric build number
await project.ios?.setBuild(targetName, buildName, 42);
// Increment the build number
await project.ios?.incrementBuild(targetName, buildName);
// Set the marketing version
await project.ios?.setVersion(targetName, buildName, '1.2.3');
```
### Display Name
```typescript
project.ios?.getDisplayName(targetName, buildName);
project.ios?.setDisplayName(targetName, buildName, 'Really Awesome App');
```
```
--------------------------------
### Apply Standard Settings to Application Target
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Applies the standard compilation settings defined in APPLY_STANDARD_SETTINGS to the application's executable target. This can be removed if custom settings are needed.
```cmake
apply_standard_settings(${BINARY_NAME})
```
--------------------------------
### Enable Unicode Support
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Adds definitions to enable Unicode support for all projects. This ensures proper handling of international characters.
```cmake
add_definitions(-DUNICODE -D_UNICODE)
```
--------------------------------
### Manage Android Resource Files
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Add new resource files using `addResource` or copy existing files to resource directories with `copyToResources`. `getResource` loads existing resource data.
```typescript
await project.android?.addResource('raw', 'test.json', `{}`);
```
```typescript
await project.android?.copyToResources('drawable', 'icon.png', source);
```
```typescript
const data = await project.android?.getResource('raw', 'test.json');
```
--------------------------------
### Configure Build Configurations
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Sets the available build configurations (Debug, Profile, Release) based on whether the generator is multi-config. If not multi-config and no type is set, defaults to Debug.
```cmake
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(IS_MULTICONFIG)
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
CACHE STRING "" FORCE)
else()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
endif()
```
--------------------------------
### Build Flutter Wrapper App Library
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/flutter/CMakeLists.txt
Creates a STATIC library for the Flutter wrapper intended for the application runner. It links against the Flutter library and includes necessary directories.
```cmake
add_library(flutter_wrapper_app STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_APP}
)
apply_standard_settings(flutter_wrapper_app)
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
target_include_directories(flutter_wrapper_app PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_app flutter_assemble)
```
--------------------------------
### Build Flutter Wrapper Plugin Library
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/flutter/CMakeLists.txt
Creates a STATIC library for the Flutter wrapper intended for plugins. It applies standard build settings, sets visibility to hidden, and links against the Flutter library.
```cmake
add_library(flutter_wrapper_plugin STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
)
apply_standard_settings(flutter_wrapper_plugin)
set_target_properties(flutter_wrapper_plugin PROPERTIES
POSITION_INDEPENDENT_CODE ON)
set_target_properties(flutter_wrapper_plugin PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
target_include_directories(flutter_wrapper_plugin PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_plugin flutter_assemble)
```
--------------------------------
### Manage JSON Files
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Load, set, and merge values within JSON files in a project. Use `getProjectFile` to retrieve or create a `JsonFile` instance.
```typescript
// Get a JSON file from the iOS project, or create a new one:
const jsonFile = ctx.project.android?.getProjectFile(
filename,
(filename: string) => new JsonFile(filename, ctx.project.vfs, ctx.project),
);
// Load it
await jsonFile.load();
// Set values
jsonFile.set({
field: 'value'
});
// Merge values
jsonFile.merge({
field: {
field2: 'value'
}
});
```
--------------------------------
### Create Android Raw Resource File
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/android.md
Creates a new raw resource file named 'auth_config.json' in the Android project.
```yaml
platforms:
android:
res:
- path: raw
file: auth_config.json
text: |
{
"client_id": "$INTUNE_CLIENT_ID",
"authorization_user_agent": "DEFAULT",
"redirect_uri": "msauth://$PACKAGE_NAME/$HASH",
"broker_redirect_uri_registered": true,
"authorities": [
{
"type": "AAD",
"audience": {
"type": "AzureADMyOrg",
"tenant_id": "$INTUNE_TENANT_ID"
}
}
]
```
--------------------------------
### Copy Files, Directories, and URLs
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Copies files, directories, or URLs relative to the iOS project root. Supports local paths and remote URLs.
```yaml
platforms:
ios:
targets:
App:
copy:
- src: ../firebase/GoogleService-Info.plist
dest: App/GoogleService-Info.plist
- src: old/path/of/directory
dest: new/path/of/directory
- src: https://example.com/file.png
dest: new/path/of/file.png
```
--------------------------------
### Replace Gradle Build Type Setting
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/android.md
Replaces the 'minifyEnabled' setting for the 'release' build type in app/build.gradle.
```yaml
platforms:
android:
gradle:
- file: app/build.gradle
target:
android:
buildTypes:
release:
minifyEnabled:
replace:
minifyEnabled: true
```
--------------------------------
### Set Runtime Output Directory for Executable
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Configures the runtime output directory for the executable to a subdirectory. This prevents users from accidentally running the unbundled copy, which may not work correctly due to resource location issues.
```cmake
set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)
```
--------------------------------
### Insert Raw Gradle Fragment
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Add raw Gradle strings to a specific location in a Gradle file. Useful for injecting complex configurations or blocks.
```typescript
appBuildGradleFile.insertFragment({
allprojects: {
repositories: {}
}
}, [{
maven: [
{ url: 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1' },
{ name: 'Duo-SDK-Feed }
]
}]
```
--------------------------------
### Copy Files within Project
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/project.md
Use the `copy` operation to duplicate files from one location to another within the project directory.
```yaml
project:
copy:
- src: file1.json
dest: file2.json
```
--------------------------------
### Define Profile Build Mode Settings
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Sets linker and compiler flags for the Profile build mode to match those of the Release build mode. This ensures consistent performance characteristics between Profile and Release builds.
```cmake
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
```
--------------------------------
### Define Executable and Application ID
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Sets the on-disk name for the application executable and its unique GTK application identifier. Ensure these are set correctly for proper application functioning and identification.
```cmake
set(BINARY_NAME "flutter_configure_test")
set(APPLICATION_ID "com.example.flutter_configure_test")
```
--------------------------------
### Apply Standard Compilation Settings
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
A function to apply common compilation settings to a target, including C++ standard, warning levels, exception handling, and debug definitions. Use with caution for plugins.
```cmake
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
endfunction()
```
--------------------------------
### iOS Entitlements Management
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Manage entitlements for iOS targets and builds.
```APIDOC
## iOS Entitlements Management
### Description
Manage entitlements for iOS targets and builds. Entitlement keys should correspond to Apple's low-level entitlement keys.
### Method
`addEntitlements(targetName: string, buildName: string, entitlements: { [key: string]: any }): Promise`
`getEntitlements(targetName: string): Promise<{ [key: string]: any }>`
### Parameters
#### Path Parameters
- **targetName** (string) - Required - The name of the target.
- **buildName** (string) - Required - The name of the build.
- **entitlements** (object) - Required - An object containing entitlement keys and their values.
### Request Example
```typescript
await project.ios?.addEntitlements(targetName, buildName, {
'keychain-access-groups': ['group1', 'group2'],
});
```
### Response
#### Success Response (200)
`getEntitlements` returns an object containing the entitlements.
#### Response Example
```json
{
"keychain-access-groups": [
"group1",
"group2"
]
}
```
```
--------------------------------
### Opt-in to Modern CMake Behaviors
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/CMakeLists.txt
Enables modern CMake behaviors to avoid warnings with newer CMake versions. This ensures compatibility and adherence to current CMake practices.
```cmake
cmake_policy(SET CMP0063 NEW)
```
--------------------------------
### Set and Merge JSON Files
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Use 'set' to override JSON elements or 'merge' to combine them. Applied relative to the iOS project root.
```yaml
platforms:
ios:
targets:
App:
json:
- file: google-services.json
set:
project_info:
project_id: "MY_ID"
- file: google-services.json
merge:
data:
field: "MY_FIELD"
```
--------------------------------
### Commit Project Changes
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Commit changes made to the virtual filesystem to the actual filesystem. Use project.vfs.all() to preview changes before committing.
```typescript
project.commit();
```
```typescript
const changedFiles = project.vfs.all();
changedFiles.forEach((f) => {
console.log(f.getFilename(), f.getData());
});
```
--------------------------------
### Manage iOS and Android Versions and Builds
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Set and retrieve version information for both iOS and Android. iOS uses `setVersion`, `incrementBuild`, and `getBuild`. Android uses `setVersionName`, `getVersionName`, `setVersionCode`, `getVersionCode`, `incrementVersionCode`, `setVersionNameSuffix`, and `getVersionNameSuffix`.
```typescript
await project.ios?.setVersion('App', 'Debug', '1.4.5');
```
```typescript
await project.ios?.incrementBuild('App');
```
```typescript
project.ios?.getBuild('App', 'Debug');
```
```typescript
project.ios?.getBuild('App', 'Release');
```
```typescript
await project.android?.setVersionName('1.0.2');
```
```typescript
await project.android?.getVersionName();
```
```typescript
await project.android?.setVersionCode(11);
```
```typescript
await project.android?.getVersionCode();
```
```typescript
await project.android?.incrementVersionCode();
```
```typescript
await project.android?.setVersionNameSuffix('beta');
```
```typescript
await project.android?.getVersionNameSuffix();
```
--------------------------------
### Manage iOS Project JSON Files
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Use `getProjectFile` to access or create JSON files within an iOS project. Load, set, or merge values using `load`, `set`, and `merge` methods.
```typescript
const jsonFile = ctx.project.ios?.getProjectFile(
filename,
(filename: string) => new JsonFile(filename, ctx.project.vfs, ctx.project),
);
```
```typescript
await jsonFile.load();
```
```typescript
jsonFile.set({
field: 'value'
});
```
```typescript
jsonFile.merge({
field: {
field2: 'value'
}
});
```
--------------------------------
### Find and Check GTK+ 3.0 Package
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Finds the PkgConfig module for GTK+ 3.0 and creates an imported target for it. This is required for GTK-based Flutter applications.
```cmake
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
```
--------------------------------
### Insert Gradle Repositories
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/android.md
Inserts new Maven repository URLs into the build.gradle file for all projects.
```yaml
platforms:
android:
gradle:
- file: build.gradle
target:
allprojects:
repositories:
insert:
- maven:
- url: 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
- name: 'Duo-SDK-Feed'
```
--------------------------------
### iOS Framework Management
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Manage frameworks for iOS targets, including embedding and linking options.
```APIDOC
## iOS Framework Management
### Description
Manage frameworks for iOS targets, including embedding and linking options.
### Method
`addFramework(targetName: string, frameworkPath: string, options?: { embed?: boolean; link?: boolean; customFramework?: boolean }): void`
`getFrameworks(targetName: string): Promise `
### Parameters
#### Path Parameters
- **targetName** (string) - Required - The name of the target to add the framework to.
- **frameworkPath** (string) - Required - The path to the framework.
- **options** (object) - Optional - Configuration options for the framework.
- **embed** (boolean) - Optional - Whether to embed the framework.
- **link** (boolean) - Optional - Whether to link the framework.
- **customFramework** (boolean) - Optional - Whether it is a custom framework.
### Request Example
```typescript
project.ios?.addFramework(targetName, 'ImageIO.framework');
project.ios?.addFramework(targetName, 'Custom.framework', {
embed: true,
});
```
### Response
#### Success Response (200)
`getFrameworks` returns an array of framework paths.
#### Response Example
```json
[
"ImageIO.framework",
"Custom.framework"
]
```
```
--------------------------------
### Define C++ Wrapper Sources
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/windows/flutter/CMakeLists.txt
Lists and transforms paths for core, plugin, and application-specific C++ wrapper source files. These are used to build static libraries for the Flutter wrapper.
```cmake
list(APPEND CPP_WRAPPER_SOURCES_CORE
"core_implementations.cc"
"standard_codec.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
"plugin_registrar.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_APP
"flutter_engine.cc"
"flutter_view_controller.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
```
--------------------------------
### Define Application Executable Target
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Defines the main executable target for the application, listing its source files. Any new source files should be added here.
```cmake
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
```
--------------------------------
### Android Resource Files Management
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Add, copy, or retrieve resource files for Android projects.
```APIDOC
## Android Resource Files Management
### Description
Manage resource files for Android projects. Resources can be added to specific directories, existing files can be copied, or existing resources can be loaded.
### Method
`addResource(directory: string, filename: string, content: string): Promise`
`copyToResources(directory: string, filename: string, source: string | URL): Promise`
`getResource(directory: string, filename: string): Promise`
### Parameters
#### Path Parameters
- **directory** (string) - Required - The target resource directory (e.g., 'raw', 'drawable').
- **filename** (string) - Required - The name of the resource file.
- **content** (string) - Required - The content of the resource file (for `addResource`).
- **source** (string | URL) - Required - The source path or URL of the file to copy (for `copyToResources`).
### Request Example
```typescript
await project.android?.addResource('raw', 'test.json', `{}`);
await project.android?.copyToResources('drawable', 'icon.png', source);
const data = await project.android?.getResource('raw', 'test.json');
```
### Response
#### Success Response (200)
Methods return void or the content of the requested resource file as a string.
```
--------------------------------
### Copy Files and Directories in Android Project
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/android.md
Copies files, directories, or URLs relative to the root of the Android project. Specify source and destination paths.
```yaml
platforms:
android:
copy:
- src: ../firebase/google-services.json
dest: app/google-services.json
- src: old/path/of/directory
dest: new/path/of/directory
- src: https://example.com/file.png
dest: new/path/of/file.png
```
--------------------------------
### Manage iOS Entitlements
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/project-api.md
Add entitlements to your iOS project using `addEntitlements`. The keys should correspond to Apple's low-level entitlement keys. `getEntitlements` retrieves the current entitlements.
```typescript
await project.ios?.addEntitlements(targetName, buildName, {
'keychain-access-groups': ['group1', 'group2'],
});
```
```typescript
await project.ios?.getEntitlements(targetName);
```
--------------------------------
### Set Bundle ID
Source: https://github.com/ionic-team/trapeze/blob/main/packages/website/docs/operations/ios.md
Sets the bundle identifier for the given target and build.
```yaml
platforms:
ios:
targets:
App:
bundleId: $BUNDLE_ID
```
--------------------------------
### Set Runtime Path for Bundled Libraries
Source: https://github.com/ionic-team/trapeze/blob/main/packages/common/test/fixtures/frameworks/flutter_configure_test/linux/CMakeLists.txt
Configures the runtime search path for libraries to include the 'lib/' directory relative to the executable. This ensures bundled libraries can be found at runtime.
```cmake
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
```