Skip to content

feat(windows): add post-package command option for Windows packaging#274

Closed
annd22 wants to merge 4 commits into
fastforgedev:mainfrom
annd22:main
Closed

feat(windows): add post-package command option for Windows packaging#274
annd22 wants to merge 4 commits into
fastforgedev:mainfrom
annd22:main

Conversation

@annd22

@annd22 annd22 commented Jun 5, 2025

Copy link
Copy Markdown

Add --post-package-windows-cmd option to execute custom commands between
build and package steps for Windows platform. This enables custom file
operations (like code signing) on the built executable before packaging.

Changes:

  • Add new CLI option --post-package-windows-cmd in command_package.dart
  • Implement command execution logic in unified_distributor.dart
  • Add proper error handling and logging for custom command execution

Example usage:
fastforge package --platform windows --targets exe --post-package-windows-cmd="call ./sign-file.bat"

annd22 added 2 commits June 5, 2025 09:07
Add --post-package-windows-cmd option to execute custom commands between
build and package steps for Windows platform. This enables custom file
operations (like code signing) on the built executable before packaging.

Changes:
- Add new CLI option --post-package-windows-cmd in command_package.dart
- Implement command execution logic in unified_distributor.dart
- Add proper error handling and logging for custom command execution

Example usage:
fastforge package --platform windows --targets exe --post-package-windows-cmd="call ./sign-file.bat"
@annd22

annd22 commented Jun 5, 2025

Copy link
Copy Markdown
Author

This pull request is for: #272

- Fix path escaping to prevent double backslashes in Windows paths - Add proper handling of paths with spaces in post-package commands - Improve batch file execution with enabledelayedexpansion
@lijy91

lijy91 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Hi @annd22, thanks for your contribution!

This PR has been superseded by #342 which implements a more general prepackage/postpackage hooks system that:

  • Works for all platforms (not just Windows)
  • Supports both pre and post hooks
  • Can be configured via YAML (distribute_options.yaml) or CLI flags (--hook-pre/--hook-post)
  • Supports multiple commands (not just a single string)
  • Provides rich environment variables (PLATFORM, BUILD_OUTPUT_DIRECTORY, etc.)

So instead of:

fastforge package --platform windows --targets exe --post-package-windows-cmd="call ./sign-file.bat"

You can now do:

fastforge package --platform windows --targets exe --hook-post "call ./sign-file.bat"

Or via YAML:

package:
  platform: windows
  target: exe
  hooks:
    post: call ./sign-file.bat

Please check out #342 for details. Thanks again! 🙏

@lijy91 lijy91 closed this Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants