-
Notifications
You must be signed in to change notification settings - Fork 1
feat: per-module CHANGELOG.md support #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AnteLund
wants to merge
3
commits into
main
Choose a base branch
from
feature/per-module-changelog
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+403
−4
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "changesets": minor | ||
| --- | ||
|
|
||
| Add support for per-module changelogs, so each sub-module in a multi-module Maven project can maintain its own `CHANGELOG.md` instead of sharing a single aggregated one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -84,6 +84,31 @@ independent mode, the BOM's pom is left untouched (version *and* pinned properti | |||
| standard per-module sections. The `bom` block in `.changeset/config.json` stays in place — `skipBom` is a per-run override, | ||||
| not a config change. Use it when you want to ship a quick starter patch between full BOM releases. | ||||
|
|
||||
| ## Per-module changelogs | ||||
|
|
||||
| By default the release block is prepended to a single `CHANGELOG.md` at the reactor root. With `independent` versioning you | ||||
| can instead emit one `CHANGELOG.md` per bumped submodule by setting `changelog: "module"`: | ||||
|
|
||||
| ```json | ||||
| { | ||||
| "versioning": "independent", | ||||
| "changelog": "module" | ||||
| } | ||||
| ``` | ||||
|
|
||||
| Behavior: | ||||
|
|
||||
| - Each module that bumps gets its own `CHANGELOG.md` next to its `pom.xml`, containing only that module's changes. | ||||
| - Modules without changesets for the release are skipped — no empty file is created. | ||||
| - No reactor-root `CHANGELOG.md` is written. Any existing root `CHANGELOG.md` is left untouched. | ||||
| - If a [BOM](#bom-bill-of-materials-support) is also configured, the reactor-root `CHANGELOG.md` is *additionally* written as | ||||
| a rollup summary — one entry per bumped module under a single `consumer-parent@<bomVersion>` header, with each module's | ||||
| changes nested below — so consumers see a dependabot-style overview of what moved in that BOM release while the | ||||
| authoritative per-module history lives next to each module. | ||||
|
|
||||
| `changelog: "module"` requires `versioning: "independent"`; combining it with `fixed` is a config validation error, since all | ||||
| modules would share one version anyway. Omitting `changelog` keeps the previous behavior (a single root `CHANGELOG.md`). | ||||
|
|
||||
| ## How `prepare` and `release` interact | ||||
|
|
||||
| `changesets:prepare` (aggregator goal, runs once at the reactor root) reads all changesets in `.changeset/`, computes a new | ||||
|
|
@@ -181,4 +206,6 @@ in history instead of two. | |||
|
|
||||
| If you'd rather have `changesets:prepare` update the poms itself (e.g. to inspect them before triggering the | ||||
| release-plugin), omit `useReleasePluginIntegration`. The trade-off is an extra "chore: prepare release" commit | ||||
| before `release:prepare` runs. | ||||
| before `release:prepare` runs. | ||||
|
|
||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This header seems to have been mistakenly added. |
||||
| ## Configuration reference | ||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
changesets-maven-plugin/src/it/module-changelog-bom/.changeset/bump-a.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "starter-a": minor | ||
| --- | ||
|
|
||
| Added starter-a feature |
5 changes: 5 additions & 0 deletions
5
changesets-maven-plugin/src/it/module-changelog-bom/.changeset/bump-b.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "starter-b": patch | ||
| --- | ||
|
|
||
| Tiny starter-b fix |
8 changes: 8 additions & 0 deletions
8
changesets-maven-plugin/src/it/module-changelog-bom/.changeset/config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "versioning": "independent", | ||
| "changelog": "module", | ||
| "bom": { | ||
| "module": "bom", | ||
| "consumerParent": "consumer-parent" | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
changesets-maven-plugin/src/it/module-changelog-bom/EXPECTED_CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Changelog | ||
|
|
||
| ## consumer-parent@0.4.0 | ||
|
|
||
| ### starter-a@2.1.0 | ||
|
|
||
| #### Minor Changes | ||
|
|
||
| - Added starter-a feature | ||
|
|
||
| ### starter-b@3.0.1 | ||
|
|
||
| #### Patch Changes | ||
|
|
||
| - Tiny starter-b fix | ||
|
|
||
| ### bom@0.4.0 | ||
|
|
||
| #### Pinned version updates | ||
|
|
||
| - starter-a@2.1.0 | ||
| - starter-b@3.0.1 | ||
|
|
34 changes: 34 additions & 0 deletions
34
changesets-maven-plugin/src/it/module-changelog-bom/bom/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>module-changelog-bom-root</artifactId> | ||
| <version>1.0.0</version> | ||
| </parent> | ||
|
|
||
| <artifactId>bom</artifactId> | ||
| <version>0.3.0</version> | ||
| <packaging>pom</packaging> | ||
|
|
||
| <properties> | ||
| <starter-a.version>2.0.0</starter-a.version> | ||
| <starter-b.version>3.0.0</starter-b.version> | ||
| </properties> | ||
|
|
||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>starter-a</artifactId> | ||
| <version>${starter-a.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>starter-b</artifactId> | ||
| <version>${starter-b.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
| </project> |
14 changes: 14 additions & 0 deletions
14
changesets-maven-plugin/src/it/module-changelog-bom/consumer-parent/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>bom</artifactId> | ||
| <version>0.3.0</version> | ||
| <relativePath>../bom</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>consumer-parent</artifactId> | ||
| <packaging>pom</packaging> | ||
| </project> |
1 change: 1 addition & 0 deletions
1
changesets-maven-plugin/src/it/module-changelog-bom/invoker.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:prepare |
22 changes: 22 additions & 0 deletions
22
changesets-maven-plugin/src/it/module-changelog-bom/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>module-changelog-bom-root</artifactId> | ||
| <version>1.0.0</version> | ||
| <packaging>pom</packaging> | ||
|
|
||
| <description>IT: BOM + per-module changelogs, with root CHANGELOG.md rollup.</description> | ||
|
|
||
| <properties> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
| <modules> | ||
| <module>bom</module> | ||
| <module>consumer-parent</module> | ||
| <module>starter-a</module> | ||
| <module>starter-b</module> | ||
| </modules> | ||
| </project> |
8 changes: 8 additions & 0 deletions
8
...gesets-maven-plugin/src/it/module-changelog-bom/starter-a/EXPECTED_CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Changelog | ||
|
|
||
| ## starter-a@2.1.0 | ||
|
|
||
| ### Minor Changes | ||
|
|
||
| - Added starter-a feature | ||
|
|
13 changes: 13 additions & 0 deletions
13
changesets-maven-plugin/src/it/module-changelog-bom/starter-a/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>module-changelog-bom-root</artifactId> | ||
| <version>1.0.0</version> | ||
| </parent> | ||
|
|
||
| <artifactId>starter-a</artifactId> | ||
| <version>2.0.0</version> | ||
| </project> |
8 changes: 8 additions & 0 deletions
8
...gesets-maven-plugin/src/it/module-changelog-bom/starter-b/EXPECTED_CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Changelog | ||
|
|
||
| ## starter-b@3.0.1 | ||
|
|
||
| ### Patch Changes | ||
|
|
||
| - Tiny starter-b fix | ||
|
|
13 changes: 13 additions & 0 deletions
13
changesets-maven-plugin/src/it/module-changelog-bom/starter-b/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>module-changelog-bom-root</artifactId> | ||
| <version>1.0.0</version> | ||
| </parent> | ||
|
|
||
| <artifactId>starter-b</artifactId> | ||
| <version>3.0.0</version> | ||
| </project> |
36 changes: 36 additions & 0 deletions
36
changesets-maven-plugin/src/it/module-changelog-bom/verify.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import groovy.xml.XmlSlurper | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat | ||
|
|
||
| def versions = new File(basedir, '.changeset/VERSIONS').text | ||
| assertThat(versions).contains("starter-a=2.1.0") | ||
| assertThat(versions).contains("starter-b=3.0.1") | ||
| assertThat(versions).contains("bom=0.4.0") | ||
|
|
||
| // BOM bumped to next-dev SNAPSHOT, properties rewritten | ||
| def bom = new XmlSlurper().parse(new File(basedir, 'bom/pom.xml')) | ||
| assertThat(bom.version).isEqualTo('0.4.1-SNAPSHOT') | ||
| assertThat(bom.properties.'starter-a.version'.text()).isEqualTo('2.1.1-SNAPSHOT') | ||
| assertThat(bom.properties.'starter-b.version'.text()).isEqualTo('3.0.2-SNAPSHOT') | ||
|
|
||
| // Starters bumped to their own next-dev SNAPSHOTs | ||
| def starterA = new XmlSlurper().parse(new File(basedir, 'starter-a/pom.xml')) | ||
| assertThat(starterA.version).isEqualTo('2.1.1-SNAPSHOT') | ||
|
|
||
| def starterB = new XmlSlurper().parse(new File(basedir, 'starter-b/pom.xml')) | ||
| assertThat(starterB.version).isEqualTo('3.0.2-SNAPSHOT') | ||
|
|
||
| // Per-module changelogs written next to each starter's pom | ||
| assertThat(new File(basedir, 'starter-a/CHANGELOG.md')) | ||
| .hasSameTextualContentAs(new File(basedir, 'starter-a/EXPECTED_CHANGELOG.md')) | ||
| assertThat(new File(basedir, 'starter-b/CHANGELOG.md')) | ||
| .hasSameTextualContentAs(new File(basedir, 'starter-b/EXPECTED_CHANGELOG.md')) | ||
|
|
||
| // No bom/CHANGELOG.md when BOM has no explicit changesets of its own | ||
| assertThat(new File(basedir, 'bom/CHANGELOG.md')).doesNotExist() | ||
|
|
||
| // Root CHANGELOG.md = the BOM rollup summary | ||
| assertThat(new File(basedir, 'CHANGELOG.md')) | ||
| .hasSameTextualContentAs(new File(basedir, 'EXPECTED_CHANGELOG.md')) | ||
|
|
||
| true |
5 changes: 5 additions & 0 deletions
5
changesets-maven-plugin/src/it/module-changelog/.changeset/bump-a.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "module-a": minor | ||
| --- | ||
|
|
||
| Added module-a feature |
5 changes: 5 additions & 0 deletions
5
changesets-maven-plugin/src/it/module-changelog/.changeset/bump-b.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "module-b": patch | ||
| --- | ||
|
|
||
| Tiny module-b fix |
4 changes: 4 additions & 0 deletions
4
changesets-maven-plugin/src/it/module-changelog/.changeset/config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "versioning": "independent", | ||
| "changelog": "module" | ||
| } |
1 change: 1 addition & 0 deletions
1
changesets-maven-plugin/src/it/module-changelog/invoker.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:prepare |
8 changes: 8 additions & 0 deletions
8
changesets-maven-plugin/src/it/module-changelog/module-a/EXPECTED_CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Changelog | ||
|
|
||
| ## module-a@2.1.0 | ||
|
|
||
| ### Minor Changes | ||
|
|
||
| - Added module-a feature | ||
|
|
12 changes: 12 additions & 0 deletions
12
changesets-maven-plugin/src/it/module-changelog/module-a/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <artifactId>module-a</artifactId> | ||
| <version>2.0.0</version> | ||
| <parent> | ||
| <groupId>se.fortnox.maven.it</groupId> | ||
| <artifactId>module-changelog-root</artifactId> | ||
| <version>1.0.0</version> | ||
| </parent> | ||
| </project> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnteLund should we apply the suggestion?