ccgo 3.4.2

A high-performance C++ cross-platform build CLI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# Changelog Management

Guide to managing changelogs in CCGO projects following Keep a Changelog format and best practices.

## Overview

CCGO follows [Keep a Changelog](https://keepachangelog.com/) principles for documenting changes:

- **Human-Readable** - Changes organized by version and category
- **Machine-Parseable** - Structured format for automated tools
- **Git Integration** - Automated generation from git history
- **Semantic Versioning** - Tied to SemVer version numbers
- **Release Notes** - Foundation for release documentation

## Changelog Format

### Standard Structure

```markdown
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- New features that have been added

### Changed
- Changes in existing functionality

### Deprecated
- Features that will be removed in upcoming releases

### Removed
- Features that have been removed

### Fixed
- Bug fixes

### Security
- Security improvements and vulnerability fixes

## [1.0.0] - 2024-01-15

### Added
- Initial release
- Cross-platform C++ build system
- Support for Android, iOS, macOS, Windows, Linux

[Unreleased]: https://github.com/user/project/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/user/project/releases/tag/v1.0.0
```

### Change Categories

| Category | Description | Example |
|----------|-------------|---------|
| **Added** | New features | Added ARM64 support for Android |
| **Changed** | Modifications to existing features | Updated CMake minimum version to 3.20 |
| **Deprecated** | Features marked for removal | Deprecated `--legacy-build` flag |
| **Removed** | Deleted features | Removed Python 2 support |
| **Fixed** | Bug fixes | Fixed memory leak in iOS framework |
| **Security** | Security fixes | Patched XSS vulnerability |

## Creating a Changelog

### Initial Setup

```bash
# Create CHANGELOG.md in project root
cat > CHANGELOG.md << 'EOF'
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Initial project setup

[Unreleased]: https://github.com/user/project/compare/v0.1.0...HEAD
EOF
```

### Adding Changes

```markdown
## [Unreleased]

### Added
- Android ARM64-v8a architecture support
- Docker-based cross-platform builds for Windows and Linux
- Automatic version injection from git tags

### Changed
- Updated minimum CMake version from 3.18 to 3.20
- Improved error messages for missing dependencies

### Fixed
- Fixed iOS framework symbol visibility issues
- Resolved Windows DLL export problems in MinGW builds
```

### Releasing a Version

1. **Move unreleased changes to new version:**

```markdown
## [Unreleased]

## [1.2.0] - 2024-01-15

### Added
- Android ARM64-v8a architecture support
- Docker-based cross-platform builds

### Changed
- Updated minimum CMake version from 3.18 to 3.20

### Fixed
- Fixed iOS framework symbol visibility issues

[Unreleased]: https://github.com/user/project/compare/v1.2.0...HEAD
[1.2.0]: https://github.com/user/project/compare/v1.1.0...v1.2.0
```

2. **Create git tag:**

```bash
ccgo tag v1.2.0 --message "Release 1.2.0"
```

3. **Update version links:**

```markdown
[Unreleased]: https://github.com/user/project/compare/v1.2.0...HEAD
[1.2.0]: https://github.com/user/project/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/user/project/compare/v1.0.0...v1.1.0
```

## Automated Changelog Generation

### Using ccgo changelog

```bash
# Generate changelog from git history
ccgo changelog

# Output to file
ccgo changelog --output CHANGELOG.md

# Between specific versions
ccgo changelog --from v1.0.0 --to v2.0.0

# Include all commits
ccgo changelog --include-all

# Group by type (conventional commits)
ccgo changelog --group-by-type
```

### Git Commit Parser

CCGO parses [Conventional Commits](https://www.conventionalcommits.org/) for automatic categorization:

```bash
# Commit format: <type>(<scope>): <subject>

feat(android): add ARM64 support       → Added
fix(ios): resolve memory leak          → Fixed
docs: update installation guide        → (Documentation, not in changelog)
chore: bump version to 1.2.0          → (Maintenance, not in changelog)
refactor(core): simplify error handling → Changed
test: add unit tests for calculator    → (Testing, not in changelog)
perf(network): optimize data transfer  → Changed (performance improvement)
```

**Type Mapping:**

| Commit Type | Changelog Category |
|-------------|-------------------|
| `feat` | Added |
| `fix` | Fixed |
| `perf` | Changed |
| `refactor` | Changed |
| `revert` | Changed |
| `docs` | (Not included) |
| `style` | (Not included) |
| `test` | (Not included) |
| `chore` | (Not included) |
| `build` | (Not included) |
| `ci` | (Not included) |

### Breaking Changes

```bash
# Commit with breaking change
git commit -m "feat(api)!: change function signature

BREAKING CHANGE: Calculator.add() now returns Result<int> instead of int"
```

**In Changelog:**

```markdown
## [2.0.0] - 2024-01-15

### Changed
- **BREAKING:** Calculator.add() now returns Result<int> instead of int

### Migration Guide
```cpp
// Before
int result = Calculator.add(2, 3);

// After
auto result = Calculator.add(2, 3);
if (result.is_ok()) {
    int value = result.value();
}
```
```

## CI/CD Integration

### GitHub Actions

```yaml
name: Update Changelog
on:
  push:
    tags:
      - 'v*'

jobs:
  changelog:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0  # Full history for changelog generation

      - name: Install CCGO
        run: pip install ccgo

      - name: Generate Changelog
        run: |
          VERSION=${GITHUB_REF#refs/tags/v}
          PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")

          if [ -n "$PREV_TAG" ]; then
            ccgo changelog --from $PREV_TAG --to v$VERSION --output CHANGELOG.new.md
          else
            ccgo changelog --to v$VERSION --output CHANGELOG.new.md
          fi

      - name: Update Changelog
        run: |
          # Prepend new changes to existing changelog
          cat CHANGELOG.new.md CHANGELOG.md > CHANGELOG.tmp.md
          mv CHANGELOG.tmp.md CHANGELOG.md

      - name: Commit Changelog
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add CHANGELOG.md
          git commit -m "docs: update changelog for ${GITHUB_REF#refs/tags/}"
          git push
```

### GitLab CI

```yaml
update-changelog:
  stage: deploy
  only:
    - tags
  script:
    - pip install ccgo
    - |
      VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//')
      PREV_TAG=$(git describe --tags --abbrev=0 $CI_COMMIT_TAG^ 2>/dev/null || echo "")
      ccgo changelog --from $PREV_TAG --to $CI_COMMIT_TAG --output CHANGELOG.new.md
      cat CHANGELOG.new.md CHANGELOG.md > CHANGELOG.tmp.md
      mv CHANGELOG.tmp.md CHANGELOG.md
    - |
      git config user.name "GitLab CI"
      git config user.email "ci@gitlab.com"
      git add CHANGELOG.md
      git commit -m "docs: update changelog for $CI_COMMIT_TAG"
      git push https://oauth2:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git HEAD:main
```

## Release Notes

### Generating Release Notes

```bash
# Generate release notes from changelog
ccgo release-notes v1.2.0

# Output:
# Release 1.2.0
#
# Added:
# - Android ARM64-v8a architecture support
# - Docker-based cross-platform builds
#
# Changed:
# - Updated minimum CMake version from 3.18 to 3.20
#
# Fixed:
# - Fixed iOS framework symbol visibility issues
```

### GitHub Release Integration

```yaml
name: Create GitHub Release
on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install CCGO
        run: pip install ccgo

      - name: Generate Release Notes
        id: release_notes
        run: |
          ccgo release-notes ${GITHUB_REF#refs/tags/} --output release_notes.md
          echo "notes_file=release_notes.md" >> $GITHUB_OUTPUT

      - name: Create GitHub Release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body_path: ${{ steps.release_notes.outputs.notes_file }}
          draft: false
          prerelease: false
```

## Best Practices

### 1. Update Changelog with Every PR

```markdown
## [Unreleased]

### Added
- Feature X (#123)
- Feature Y (#124)

### Fixed
- Bug in feature A (#125)
```

Include PR/issue numbers for traceability.

### 2. Write User-Focused Descriptions

```markdown
# Good
- Added support for building on Apple Silicon Macs natively

# Bad
- Updated build_macos.py to detect arm64 architecture
```

### 3. Group Related Changes

```markdown
### Android

#### Added
- Support for Android 13 (API 33)
- New material design components

#### Fixed
- Crash on startup in Android 11
- Memory leak in background service

### iOS

#### Added
- iOS 16 widget support
- SwiftUI previews

#### Fixed
- App Store submission issues
```

### 4. Include Migration Guides for Breaking Changes

```markdown
## [2.0.0] - 2024-01-15

### Changed
- **BREAKING:** Renamed `ccgo build-all` to `ccgo build --all`

### Migration Guide

Update your build scripts:
```bash
# Before
ccgo build-all

# After
ccgo build --all
```
```

### 5. Link to Documentation

```markdown
### Added
- Docker-based cross-platform builds ([documentation](../features/docker-builds.md))
- New `--docker` flag for `ccgo build` command
```

## Changelog Tools

### changelog-cli

```bash
# Install changelog-cli
npm install -g changelog-cli

# Add entry
changelog add "Added new feature" --type added

# Remove entry
changelog remove "Old entry"

# Release version
changelog release 1.2.0
```

### git-cliff

```bash
# Install git-cliff
cargo install git-cliff

# Generate changelog
git-cliff --output CHANGELOG.md

# Generate for specific range
git-cliff v1.0.0..v2.0.0
```

### conventional-changelog

```bash
# Install conventional-changelog
npm install -g conventional-changelog-cli

# Generate changelog
conventional-changelog -p angular -i CHANGELOG.md -s

# First release
conventional-changelog -p angular -i CHANGELOG.md -s -r 0
```

## CCGO Project Changelog

### Example

```markdown
# Changelog

## [Unreleased]

### Added
- Rust-based CLI rewrite for improved performance
- Support for Apple Watch and Apple TV platforms
- Unified archive structure across all platforms

### Changed
- Migrated from Python argparse to Rust clap for CLI parsing

## [3.0.10] - 2024-01-15

### Added
- Git versioning with automatic commit SHA injection
- Unified archive naming convention
- Symbols package generation for all platforms

### Changed
- Improved Docker build performance with prebuilt images
- Updated Android NDK requirement to r21+

### Fixed
- Fixed Windows MinGW build symbol exports
- Resolved iOS framework code signing issues

### Security
- Updated OpenSSL dependency to 1.1.1w

## [3.0.9] - 2023-12-01

### Added
- Docker-based cross-platform builds
- Support for OpenHarmony platform

### Fixed
- Fixed macOS universal binary generation
- Resolved Linux RPATH issues

[Unreleased]: https://github.com/zhlinh/ccgo/compare/v3.0.10...HEAD
[3.0.10]: https://github.com/zhlinh/ccgo/compare/v3.0.9...v3.0.10
[3.0.9]: https://github.com/zhlinh/ccgo/releases/tag/v3.0.9
```

## Resources

### Specifications

- [Keep a Changelog]https://keepachangelog.com/
- [Semantic Versioning]https://semver.org/
- [Conventional Commits]https://www.conventionalcommits.org/

### Tools

- [changelog-cli]https://github.com/mc706/changelog-cli
- [git-cliff]https://github.com/orhun/git-cliff
- [conventional-changelog]https://github.com/conventional-changelog/conventional-changelog

### CCGO Documentation

- [Version Management]../features/version-management.md
- [Git Integration]../features/git-integration.md
- [Contributing Guide]contributing.md

### Community

- [GitHub Discussions]https://github.com/zhlinh/ccgo/discussions
- [Issue Tracker]https://github.com/zhlinh/ccgo/issues

## Next Steps

- [Contributing Guide]contributing.md
- [Version Management]../features/version-management.md
- [Git Integration]../features/git-integration.md
- [CI/CD Setup]contributing.md