wails/v3/internal/flags
Lea Anthony 6d40bcd0d2 ## Summary
I have successfully implemented Mac PKG bundling for Wails v3, addressing GitHub issue #2413. Here's what was accomplished:

###  **Complete Implementation**

**1. PKG Builder (`pkg_builder.go`)**
- Uses macOS `pkgbuild` and `productbuild` tools
- Supports code signing with Developer ID certificates
- Generates distribution XML with customizable installer appearance
- Handles component and product package creation

**2. Notarization Service (`notarization.go`)**
- Full Apple notarization workflow using `notarytool`
- Automatic status polling with timeout handling
- Ticket stapling with `stapler`
- Detailed error logging and debugging support

**3. Configuration System (`config.go`)**
- YAML-based configuration with environment variable support
- Path resolution for relative paths
- Comprehensive validation
- Template generation for easy setup

**4. Command Integration (`command.go`)**
- Seamless integration with existing `wails3 tool package` command
- Support for `--format pkg` option
- Template generation with `--generate-template`
- Configuration validation with `--validate-only`

**5. CLI Integration**
- Updated `tool_package.go` to handle PKG format
- Added new flags for PKG-specific options
- Maintained backward compatibility with existing formats

###  **Key Features**

- **Professional Installers**: Creates distribution-ready PKG installers with custom branding
- **Code Signing**: Full support for Developer ID signing certificates
- **Notarization**: Automated Apple notarization with retry logic and status monitoring
- **Configuration-Driven**: YAML configuration with environment variable expansion
- **Validation**: Comprehensive dependency and configuration validation
- **Template Generation**: Automatic generation of sample configuration files
- **Cross-Platform Safe**: Only runs on macOS, provides clear error messages elsewhere

###  **Testing & Documentation**

- **Unit Tests**: Comprehensive test coverage for all components
- **Integration Tests**: CLI integration and end-to-end workflow testing
- **Documentation**: Complete README with examples, troubleshooting, and workflows
- **Error Handling**: Detailed error messages and validation feedback

###  **Usage Examples**

**Generate Template:**
```bash
wails3 tool package --format pkg --generate-template --config my-pkg.yaml
```

**Build PKG:**
```bash
wails3 tool package --format pkg --config my-pkg.yaml
```

**Validate Only:**
```bash
wails3 tool package --format pkg --config my-pkg.yaml --validate-only
```

###  **Based on Community Input**

The implementation incorporates the sample script provided by @sebheitzmann in the GitHub issue, using:
- `pkgbuild` for component package creation
- `productbuild` for final installer assembly
- Distribution XML for installer customization
- Modern `notarytool` for Apple notarization

###  **Production Ready**

The implementation is ready for v3 and includes:
- Dependency validation for required tools
- Comprehensive error handling and user feedback
- Security best practices for credential handling
- Professional installer workflows matching industry standards
- Full integration with existing Wails build system

This addresses the original GitHub issue by providing a complete Mac PKG bundling and notarization solution that integrates seamlessly with the existing Wails v3 packaging system.
2025-08-04 19:23:08 +10:00
..
bindings.go [v3] Fix binding generator bugs and prepare for Go 1.24 (#4045) 2025-02-09 09:44:34 +11:00
bindings_test.go [v3] New binding generator (#3468) 2024-05-19 20:40:44 +10:00
common.go [v3] Initial template support (likely to change) 2023-01-22 15:39:57 +11:00
init.go Add goModTidy function to clean up Go module dependencies during inst… (#4286) 2025-08-02 15:51:30 +10:00
msix.go Add MSIX packaging support for Windows applications 2025-06-14 21:23:59 +10:00
package.go ## Summary 2025-08-04 19:23:08 +10:00
service.go Fix service generation text 2024-10-30 22:13:41 +11:00
task_wrapper.go [darwin] Wrappers for init, build, dev, package. Refactored default Taskfile. 2023-11-12 21:41:10 +11:00