• Stars
    star
    252
  • Rank 155,336 (Top 4 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Plugin for parsing and managing the Changelog in a "keep a changelog" style.

Gradle Changelog Plugin

official JetBrains project Twitter Follow Gradle Plugin Build Slack

A Gradle plugin providing tasks and helper methods to simplify working with a changelog that is managed in the keep a changelog style.

Note

This project requires Gradle 6.8 or newer

Upgrade Gradle Wrapper with ./gradlew wrapper --gradle-version 8.1.1

Table of contents

Usage

The latest available version is: Gradle Plugin

Note

The patchPluginXml task is defined in Gradle IntelliJ Plugin

build.gradle.kts (Kotlin)

import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.ChangelogSectionUrlBuilder
import org.jetbrains.changelog.date

plugins {
    id("org.jetbrains.changelog") version "..."
}

tasks {
    // ...

    patchPluginXml {
        changeNotes.set(provider {
            changelog.renderItem(
                changelog
                    .getUnreleased()
                    .withHeader(false)
                    .withEmptySections(false),
                Changelog.OutputType.HTML
            )
        })
    }
}

changelog {
    version.set("1.0.0")
    path.set(file("CHANGELOG.md").canonicalPath)
    header.set(provider { "[${version.get()}] - ${date()}" })
    headerParserRegex.set("""(\d+\.\d+)""".toRegex())
    introduction.set(
        """
        My awesome project that provides a lot of useful features, like:
        
        - Feature 1
        - Feature 2
        - and Feature 3
        """.trimIndent()
    )
    itemPrefix.set("-")
    keepUnreleasedSection.set(true)
    unreleasedTerm.set("[Unreleased]")
    groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
    lineSeparator.set("\n")
    combinePreReleases.set(true)
    sectionUrlBuilder.set(ChangelogSectionUrlBuilder { repositoryUrl, currentVersion, previousVersion, isUnreleased -> "foo" })
}

build.gradle (Groovy)

import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.ChangelogSectionUrlBuilder
import org.jetbrains.changelog.ExtensionsKt

plugins {
    id 'org.jetbrains.changelog' version '...'
}

apply plugin: 'org.jetbrains.changelog'

intellij {
    // ...

    patchPluginXml {
        changeNotes = provider {
            changelog.renderItem(
                changelog
                    .getUnreleased()
                    .withHeader(false)
                    .withEmptySections(false),
                Changelog.OutputType.HTML
            )
        }
    }
}

changelog {
    version = "1.0.0"
    path = file("CHANGELOG.md").canonicalPath
    header = "[${-> version.get()}] - ${ExtensionsKt.date("yyyy-MM-dd")}"
    headerParserRegex = ~/(\d+\.\d+)/
    introduction = """
        My awesome project that provides a lot of useful features, like:
        
        - Feature 1
        - Feature 2
        - and Feature 3
    """.stripIndent()
    itemPrefix = "-"
    keepUnreleasedSection = true
    unreleasedTerm = "[Unreleased]"
    groups = ["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]
    lineSeparator = "\n"
    combinePreReleases = true
    sectionUrlBuilder = { repositoryUrl, currentVersion, previousVersion, isUnreleased -> "foo" } as ChangelogSectionUrlBuilder
}

Note

All the extension and task properties are now lazy (see Lazy Configuration).

To set values in Kotlin DSL, use .set(...) method explicitly, like changelog.version.set("1.0.0"), in Groovy it is still possible to use = assignment.

To access property value, call .get(), like: changelog.version.get() in both variants.

Configuration

Plugin can be configured with the following properties set in the changelog {} closure:

Property Description
versionPrefix Version prefix used to compare tags. Type: String
Default value: v
version Current version. By default, project's version is used. Type: String
Default value: project.version
path Path to the changelog file. Type: String
Default value: file("CHANGELOG.md").cannonicalPath
preTitle Optional content placed before the title. Type: String?
Default value: null
title The changelog title set as the top-lever header โ€“ #. Type: String
Default value: "Changelog"
introduction Optional content placed after the title. Type: String?
Default value: null
header Header value used when patching the Unreleased section with text containing the current version. Type: String
Default value: provider { "${version.get()} - ${date()}" }
headerParserRegex Regex/Pattern/String used to extract version from the header string. Type: Regex / Pattern / String
Default value: null, fallbacks to SEM_VER_REGEX
unreleasedTerm Unreleased section name. Type: String
Default value: "[Unreleased]"
keepUnreleasedSection Add an unreleased empty section on the top of the changelog after running the patching task. Type: Boolean
Default value: true
patchEmpty Patches changelog even if no release note is provided. Type: Boolean
Default value: true
groups List of groups created with a new Unreleased section. Type: String
Default value: ["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]
itemPrefix Single item's prefix, allows to customise the bullet sign. Type: String
Default value: "-"
combinePreReleases Combines pre-releases (like 1.0.0-alpha, 1.0.0-beta.2) into the final release note when patching. Type: Boolean
Default value: true
lineSeparator Line separator used for generating changelog content. Type: String
Default value: "\n" or determined from the existing file
repositoryUrl The GitHub repository URL used to build release links. If provided, leads to the GitHub comparison page. Type: String?
Default value: null
sectionUrlBuilder Function to build a single URL to link section with the GitHub page to present changes within the given release. Type: ChangelogSectionUrlBuilder
Default value: Common ChangelogSectionUrlBuilder implementation

Note

The header closure has the delegate explicitly set to the extension's context for the sake of the Configuration cache support.

Tasks

The plugin introduces the following tasks:

Task Description
getChangelog Retrieves changelog for the specified version.
initializeChangelog Creates a new changelog file with an unreleased section and empty groups.
patchChangelog Updates the unreleased section to the given version.

getChangelog

Retrieves changelog for the specified version.

Options

Option Type Default value Description
--no-header Boolean false Omits the section header in the changelog output.
--no-summary Boolean false Omits the section summary in the changelog output.
--no-links Boolean false Omits links in the changelog output.
--no-empty-sections Boolean false Omits empty sections in the changelog output.
--version String? null Returns change notes for the specified version.
--unreleased Boolean false Returns change notes for an unreleased section.

Examples

$ ./gradlew getChangelog --console=plain -q --no-header --no-summary

### Added
- Initial project scaffold
- GitHub Actions to automate testing and deployment
- Kotlin support

initializeChangelog

Creates a new changelog file with an unreleased section and empty groups.

Examples

$ ./gradlew initializeChangelog
$ cat CHANGELOG.md

## [Unreleased]
### Added
- Example item

### Changed

### Deprecated

### Removed

### Fixed

### Security

patchChangelog

Updates the unreleased section to the given version.

Options

Option Type Default value Description
--release-note String? null Use custom release note to create new changelog entry.

Warning

Content provided with the --release-note option will override the existing release note for the latest unreleased entry.

Examples

$ cat CHANGELOG.md
## [Unreleased]
### Added
- A based new feature
 
$ ./gradlew patchChangelog
$ cat CHANGELOG.md

## [Unreleased]
### Added

## [1.0.0]
### Added
- A based new feature
$ cat CHANGELOG.md
## [Unreleased]
### Added
- This note will get overridden by the `--release-note`

$ ./gradlew patchChangelog --release-note='- Foo'
$ cat CHANGELOG.md
## [Unreleased]
### Added

## [1.0.0]
- Foo

Extension Methods

All the methods are available via the changelog extension and allow for reading the changelog file within the Gradle tasks to provide the latest (or specific) change notes.

Note

The following methods depend on the changelog extension set in the Configuration build phase. For safe access and process of your changelog file, we recommend accessing the changelog extension within Gradle closures as presented in the Usage section.

changelog.get(version: String): Changelog.Item

The method returns a Changelog.Item? object for the specified version. Throws MissingVersionException if the version is not available.

Parameters

Parameter Type Description
version String Change note version.

changelog.getUnreleased(): Changelog.Item

The method returns a Changelog.Item object for the unreleased version. Throws MissingVersionException if the version is not available.

changelog.getLatest(): Changelog.Item

The method returns the latest released Changelog.Item object (first on the list). Throws MissingVersionException if the version is not available.

changelog.has(version: String): Boolean

The method checks if the given version exists in the changelog.

Parameters

Parameter Type Description
version String Change note version.

changelog.render(outputType: Changelog.OutputType): String

Renders the whole Changelog object to string based on the given outputType.

Parameters

Parameter Type Description
outputType Changelog.OutputType Output type, see Changelog.OutputType

changelog.renderItem(item: Changelog.Item, outputType: Changelog.OutputType): String

Renders the given Changelog.Item object to string based on the given outputType.

Parameters

Parameter Type Description
item Changelog.Item Item to render, see Changelog.Item
outputType Changelog.OutputType Output type, see Changelog.OutputType

changelog.getInstance(): Changelog

Returns the Changelog instance shared among all the tasks. See Changelog for more details.

Classes

Changelog class

The Changelog class is a wrapper for the Changelog file. It provides methods to read and write the changelog file.

Properties

Name Type Description
preTitle String Optional content placed before the title.
title String The changelog title set as the top-lever header โ€“ #.
introduction String Optional content placed after the title.
items Map<String, Changelog.Item> List of all items available in the changelog stored in a map of version to Changelog.Item.
unreleasedItem Changelog.Item? An instance of the unreleased item, may be null.
releasedItems List<Changelog.Item> List of already released item instances.
links Map<String, String> List of all links stored at the end of the changelog in a map of id to url.

Methods

Name Return type Description
get(version: String) Changelog.Item Returns item for the given version. Throws MissingVersionException if missing.
getLatest() Changelog.Item Returns the latest released item. Throws MissingVersionException if missing.
has(version: String) Boolean Checks if item with the given version exists.
render(outputType: Changelog.OutputType) String Renders the whole Changelog object to string based on the given outputType.
renderItem(item: Changelog.Item, outputType: Changelog.OutputType) String Renders the given Changelog.Item object to string based on the given outputType.

Changelog.OutputType enum

Name Description
MARKDOWN Default, Markdown content format.
PLAIN_TEXT Plain text with no Markdown syntax generated.
HTML HTML content created out of Markdown version.

Changelog.Item class

Methods described in the above section return Changelog.Item object, which is a representation of the single changelog section for the specific version.

It provides a couple of properties and methods that allow altering the output form of the change notes:

Properties

Name Type Description
version String Item version.
header String Literal representation of the given item โ€“ may contain version with extra meta, like date.
summary String Optional summary of the release item.
isUnreleased Boolean Determines if an item is released or not.

Methods

Name Description Returned type
withHeader(Boolean) Includes header part in the output. Changelog.Item
withLinkedHeader(Boolean) Adds link to the version in the header. Changelog.Item
withSummary(Boolean) Includes summary part. Changelog.Item
withLinks(Boolean) Returns links used in the release section at the end. Changelog.Item
withEmptySections(Boolean) Prints empty sections. Changelog.Item
withFilter(Boolean) Applies custom filter to the returned entries. Changelog.Item
toText() Deprecated. Use changelog.renderItem(item) String
toPlainText() Deprecated. Use changelog.renderItem(item, Changelog.OutputType.PLAIN_TEXT) String
toString() Deprecated. Use changelog.renderItem(item, Changelog.OutputType.MARKDOWN) String
toHTML() Deprecated. Use changelog.renderItem(item, Changelog.OutputType.HTML) String

Helper Methods

Name Description Returned type
date(pattern: String = "yyyy-MM-dd") Shorthand for retrieving the current date in the given format. String
markdownToHTML(input: String) Converts given Markdown content to HTML output. String
markdownToPlainText(input: String) Converts given Markdown content to Plain Text output. String

Note

To use package-level Kotlin functions in Groovy, you need to import the containing file as a class:

import org.jetbrains.changelog.ExtensionsKt

changelog {
  header = { "[$version] - ${ExtensionsKt.date('yyyy-MM-dd')}" }
}

Usage Examples

Changelog

All releases are available in the Releases section. The latest available version is:

Gradle Plugin

Contributing

Please see CONTRIBUTING on how to submit feedback and contribute to this project.

License

Licensed under the Apache License, Version 2.0 (the "License"), see LICENCE.

More Repositories

1

kotlin

The Kotlin Programming Language.
Kotlin
45,725
star
2

intellij-community

IntelliJ IDEA Community Edition & IntelliJ Platform
16,452
star
3

compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
Kotlin
14,677
star
4

JetBrainsMono

JetBrains Mono โ€“ the free and open-source typeface for developers
Shell
10,126
star
5

ideavim

IdeaVim โ€“ A Vim engine for JetBrains IDEs
Kotlin
7,980
star
6

Exposed

Kotlin SQL Framework
Kotlin
7,869
star
7

kotlin-native

Kotlin/Native infrastructure
Kotlin
7,048
star
8

ring-ui

A collection of JetBrains Web UI components
TypeScript
3,555
star
9

kotlinconf-app

KotlinConf Schedule Application
Kotlin
2,834
star
10

intellij-platform-plugin-template

Template repository for creating plugins for IntelliJ Platform
Kotlin
2,791
star
11

skija

Java bindings for Skia
Java
2,605
star
12

create-react-kotlin-app

Create React apps using Kotlin with no build configuration
JavaScript
2,477
star
13

projector-docker

Run JetBrains IDEs remotely with Docker
Shell
2,209
star
14

intellij-plugins

Open-source plugins included in the distribution of IntelliJ IDEA Ultimate and other IDEs based on the IntelliJ Platform
Java
2,002
star
15

svg-sprite-loader

Webpack loader for creating SVG sprites.
JavaScript
1,998
star
16

skiko

Kotlin MPP bindings to Skia
C++
1,685
star
17

compose-multiplatform-ios-android-template

Compose Multiplatform iOS+Android Application project template
Kotlin
1,563
star
18

MPS

JetBrains Meta programming System
JetBrains MPS
1,500
star
19

lets-plot

Multiplatform plotting library based on the Grammar of Graphics
Kotlin
1,446
star
20

kotlin-web-site

The Kotlin programming language website
JavaScript
1,413
star
21

intellij-platform-gradle-plugin

Gradle plugin for building plugins for IntelliJ-based IDEs
Kotlin
1,377
star
22

phpstorm-stubs

PHP runtime & extensions header files for PhpStorm
PHP
1,297
star
23

kotlin-wrappers

Kotlin wrappers for popular JavaScript libraries
Kotlin
1,294
star
24

idea-gitignore

.ignore support plugin for IntelliJ IDEA
Kotlin
1,287
star
25

projector-server

Server-side library for running Swing applications remotely
Kotlin
1,230
star
26

resharper-unity

Unity support for both ReSharper and Rider
C#
1,199
star
27

intellij-sdk-docs

IntelliJ SDK Platform Documentation
Markdown
1,181
star
28

xodus

Transactional schema-less embedded database used by JetBrains YouTrack and JetBrains Hub.
Java
1,155
star
29

intellij-scala

Scala plugin for IntelliJ IDEA
Scala
1,137
star
30

kotless

Kotlin Serverless Framework
Kotlin
1,124
star
31

JetBrainsRuntime

Runtime environment based on OpenJDK for running IntelliJ Platform-based products on Windows, macOS, and Linux
Java
1,118
star
32

intellij-sdk-code-samples

Mirror of the IntelliJ SDK Docs Code Samples
Java
980
star
33

js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
Java
879
star
34

android

Android Plugin for IntelliJ IDEA. This repository is a subset of https://git.jetbrains.org/?p=idea/android.git cut according to GitHub file size limitations.
Kotlin
863
star
35

projector-client

Common and client-related code for running Swing applications remotely
Kotlin
813
star
36

projector-installer

Install, configure and run JetBrains IDEs with Projector Server on Linux or in WSL
Python
810
star
37

Grammar-Kit

Grammar files support & parser/PSI generation for IntelliJ IDEA
Java
688
star
38

Arend

The Arend Proof Assistant
Java
676
star
39

amper

Amper - a build and project configuration tool with a focus on the user experience and the IDE support
Kotlin
621
star
40

markdown

Markdown parser written in kotlin
Kotlin
617
star
41

jediterm

Pure Java Terminal Emulator. Works with SSH and PTY.
Java
611
star
42

compose-multiplatform-template

Compose Multiplatform Application project template
Kotlin
603
star
43

jewel

An implementation of the IntelliJ look and feels in Compose for Desktop
Kotlin
580
star
44

Nitra

Public Nitra repository
Nemerle
549
star
45

lincheck

Framework for testing concurrent data structures
Kotlin
520
star
46

intellij-micropython

Plugin for MicroPython devices in PyCharm and IntelliJ
Python
482
star
47

kotlin-playground

Self-contained component to embed in websites for running Kotlin code
JavaScript
422
star
48

colorSchemeTool

Python
396
star
49

compose-multiplatform-desktop-template

Compose Multiplatform Desktop Application project template
Kotlin
393
star
50

lets-plot-kotlin

Grammar of Graphics for Kotlin
Kotlin
389
star
51

Qodana

๐Ÿ“ Source repository of Qodana Help
388
star
52

rd

Reactive Distributed communication framework for .NET, Kotlin, C++. Inspired by Rider IDE.
C#
373
star
53

java-annotations

Annotations for JVM-based languages.
Java
362
star
54

phpstorm-attributes

PhpStorm specific attributes
PHP
357
star
55

Unity3dRider

Unity JetBrains Rider integration
348
star
56

godot-support

C#
339
star
57

pty4j

Pty for Java
Java
338
star
58

resharper-fsharp

F# support in JetBrains Rider
F#
320
star
59

phpstorm-workshop

Code for the PhpStorm workshop
PHP
287
star
60

awesome-pycharm

A curated list of resources for learning and using PyCharm, a Python IDE from JetBrains
271
star
61

web-types

JSON standard for documenting web component libraries for IDEs, documentation generators and other tools
TypeScript
270
star
62

meta-runner-power-pack

A set of Meta-runners for TeamCity
PowerShell
256
star
63

inspection-plugin

Gradle plugin to launch IDEA inspections
Kotlin
255
star
64

youtrack-mobile

A iOS and Android client for YouTrack
TypeScript
255
star
65

ideolog

Interactive viewer for '.log' files.
Kotlin
250
star
66

qodana-action

โš™๏ธ Scan your Go, Java, Kotlin, PHP, Python, JavaScript, TypeScript, .NET projects at GitHub with Qodana. This repository contains Qodana for Azure, GitHub, CircleCI and Gradle
JavaScript
234
star
67

gradle-idea-ext-plugin

Plugin to store IJ settings in gradle script
Groovy
227
star
68

php-timeline

Notable events of PHP history
222
star
69

resharper-rider-samples

Simple interactive exercises to help learn ReSharper and Rider
C#
221
star
70

la-clojure

Clojure plugin for IntelliJ IDEA
Java
220
star
71

kotlin-compiler-server

Server for executing kotlin code
Kotlin
216
star
72

jdk8u_jdk

Java
210
star
73

jcef

A simple framework for embedding Chromium-based browsers into Java-based applications.
Java
206
star
74

pest-intellij

The official Pest Plugin for PhpStorm / IntelliJ IDEA
Kotlin
195
star
75

youtrack-workflows

YouTrack Custom Workflow Repository
JavaScript
194
star
76

psiviewer

PSI Viewer for IntelliJ IDEA plugin development
Java
175
star
77

svg-mixer

Node.js toolset for generating & transforming SVG images and sprites in modern way
JavaScript
173
star
78

compose-for-web-demos

Historical repository of early Compose for Web effort.
171
star
79

phpstorm-docker-images

Pre-configured Docker images used by PhpStorm team
Dockerfile
170
star
80

rider-efcore

Entity Framework Core UI plugin for JetBrains Rider
Kotlin
169
star
81

jetbrains_guide

JetBrains Guides where Developer Advocacy and the community share ideas.
CSS
168
star
82

kotlin-web-demo

Online mini-IDE for Kotlin
Kotlin
168
star
83

intellij-plugin-verifier

Compatibility verification tool for IntelliJ Platform plugins
Kotlin
165
star
84

intellij-samples

Code that demonstrates various IntelliJ IDEA features
Java
163
star
85

jdk8u_hotspot

C++
159
star
86

resharper-rider-plugin

https://www.jetbrains.com/help/resharper/sdk/
PowerShell
158
star
87

qodana-cli

๐Ÿ”ง JetBrains Qodanaโ€™s official command line tool
Go
154
star
88

teamcity-messages

Python Unit Test Reporting to TeamCity
Python
139
star
89

ruby-type-inference

Dynamic definitions and types provider for ruby static analysis
Kotlin
136
star
90

educational-plugin

Educational plugin to learn and teach programming languages such as Kotlin, Java, Python, JavaScript, and others right inside of JetBrains IntelliJ Platform based IDEs.
Kotlin
134
star
91

resharper-angularjs

ReSharper plugin for AngularJS support
JavaScript
134
star
92

clion-remote

134
star
93

golandtipsandtricks

This is an ever evolving repository for GoLand Tips&Tricks
Go
132
star
94

python-skeletons

The python-skeltons repo is deprecated: use PEP 484 and Typeshed instead
Python
132
star
95

clion-wsl

Shell
130
star
96

phpstorm-phpstan-plugin

PHPStan plugin for PhpStorm
Java
130
star
97

teamcity-docker-samples

TeamCity docker compose samples
Shell
128
star
98

phpstorm-psalm-plugin

Psalm plugin for PhpStorm
Java
126
star
99

jdk8u

Shell
123
star
100

YouTrackSharp

.NET Standard 2.0 Library to access YouTrack API.
C#
123
star