Packaging
July 18, 2026 · View on GitHub
English | 简体中文
fastforge package prepares the project, runs the build, and turns its output into a distributable format.
fastforge package --platform android --target apk
Both --platform and --target are required, and one target is processed at a time. The example above applies to a native Gradle Android project. Flutter projects currently support only macOS formats, such as --platform macos --target zip. See the packager overview for platform formats and environment requirements.
Packaging Process
A packaging run contains these stages:
- Detect the build system from project files.
- Invoke the appropriate platform tools to build the project.
- Run the pre-package hook.
- Produce the final distributable artifact.
- Run the post-package hook.
Native projects without pubspec.yaml use Gradle for Android or Xcode for iOS and macOS. Flutter projects containing pubspec.yaml always use Flutter Builder.
Current Support
| Build system | Project type | Platform | Formats | Current entry point |
|---|---|---|---|---|
| Gradle | Native Android | Android | apk, aab | CLI, package action |
| Xcode | Native iOS | iOS | ipa | package action |
| Xcode | Native macOS | macOS | dmg, pkg, zip | package action |
| Flutter Builder | Contains pubspec.yaml | macOS | dmg, pkg, zip | CLI, package action |
Note
fastforge package does not currently cover every build system equally. Flutter projects can package only macOS formats. Running package for android or ios finishes the build but fails because the packager is not connected. See the builder overview for routing rules.
Build Stage
The packaging command selects Gradle, Xcode, or Flutter Builder based on the project type, then passes detected artifacts to a packager. See the builder overview for builder selection and integration status.
To inspect a Flutter Builder result separately, run:
fastforge build --platform <platform> [--target <target>]
See Building for platforms, targets, arguments, and output details.
Packaging Options
Skip Cleaning
To reuse the existing build cache, skip the cleaning step before packaging:
fastforge package --platform macos --target zip --skip-clean
Custom Flutter Entry Point
fastforge package --platform macos --target dmg \
--build-target lib/main_production.dart
Output Directory
When package is run directly, it writes to dist/. To customize the directory or artifact name, use a workflow action's output and artifact-name fields.
Lifecycle Hooks
fastforge package --platform macos --target zip \
--hook-pre './scripts/before-package.sh' \
--hook-post './scripts/after-package.sh'
Hooks run through the system shell. Fastforge provides these environment variables:
PLATFORMPACKAGE_FORMATBUILD_MODEOUTPUT_DIRECTORYBUILD_OUTPUT_DIRECTORYBUILD_OUTPUT_FILES(colon-separated)
Packaging fails immediately if any hook exits with a nonzero status.
Automation
Use Local Workflows to combine multiple packaging targets, publishing operations, or other commands.