Skip to content

merkle-open/gradle-license-enforce-plugin

Repository files navigation

license-enforce-plugin

Gradle plugin enforces licenses of dependencies to comply with definitions.

Usage

build.gralde.kts

plugins {
	// ...
    id("com.namics.oss.gradle.license-enforce-plugin") version "1.0-SNAPSHOT"
}

tasks.enforceLicenses {
    allowedCategories = listOf("Apache", "BSD", "LGPL", "MIT", "ISC", "MPL")
}

Invoke:

gradle enforceLicenses

Custom configurations

tasks.enforceLicenses {
  failOnMissingLicenseInformation = false
  allowedCategories = listOf("Apache", "BSD", "LGPL", "MIT", "ISC", "MPL", "GPLv2+CE", "WTFPL", "EPL", "CDDL", "CPL", "CC0")
  allowedDependencies = listOf(
    "this.is.good.licensed:artifact:1.0",
    "this.is.good.licensed:ignoreVersionArtifact"
  )
  dictionaries = listOf("my-additional-dict.yml")
  allowedLicenses = listOf("My Wonderful License")
  analyseConfigurations = listOf("compile", "api", "implementation")
}

Options to control additional license information

You may

  • customize dictionaries
    • all dictionaries are additive
    • add a license-dictionary.yaml to your project.projectDir (convention for project specific dictionaries)
    • place a yamlsomewhere else and add it to the task configuration dictionaries
    • contribute to the bundled dictionary
  • add specific allowedDependencies or allowedLicenses to the task configuration

Development

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

Full explanation

The header is mandatory and the scope of the header is optional.

Examples

Appears under "Features" header, pencil subheader:

feat(pencil): add 'graphiteWidth' option

Appears under "Bug Fixes" header, graphite subheader, with a link to issue #28:

fix(graphite): stop graphite breaking when width < 0.1

Closes #28

Revert

If the commit reverts a previous commit, it should begin with revert: , followed by the header of the reverted commit. In the body it should say: This reverts commit <hash>., where the hash is the SHA of the commit being reverted.

Type

If the prefix is feat, fix or perf, it will appear in the changelog. However if there is any BREAKING CHANGE, the commit will always appear in the changelog.

Other prefixes are up to your discretion. Suggested prefixes are docs, chore, style, refactor, and test for non-changelog related tasks.

Scope

The scope could be anything specifying place of the commit change. For example $location, $browser, $compile, $rootScope, ngHref, ngClick, ngView, etc...

Subject

The subject contains succinct description of the change:

  • use the imperative, present tense: "change" not "changed" nor "changes"
  • don't capitalize first letter
  • no dot (.) at the end

Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.

Footer

The footer should contain any information about Breaking Changes and is also the place to reference GitHub issues that this commit Closes.

Breaking Changes should start with the word BREAKING CHANGE: with a space or two newlines. The rest of the commit message is then used for this.

A detailed explanation can be found in this document.

Based on https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit