Skip to content

Commit a2de23e

Browse files
committed
Update documentation: move license-gather and crlf doc to their own README files
1 parent be02a4e commit a2de23e

File tree

7 files changed

+197
-109
lines changed

7 files changed

+197
-109
lines changed

README.md

Lines changed: 3 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -54,45 +54,8 @@ CRLF Plugin
5454
Adds Kotlin DSL to specify CRLF/LF filtering for `CopySpec`.
5555
Enables to use `.gitignore` and `.gitattributes` for building `CopySpec`.
5656

57-
Usage
58-
-----
57+
See [crlf-plugin description](plugins/crlf-plugin/README.md) for configuration options.
5958

60-
Kotlin DSL:
61-
62-
```kotlin
63-
// Loads .gitattributes and .gitignore from rootDir (and subdirs)
64-
val gitProps by tasks.registering(FindGitAttributes::class) {
65-
// Scanning for .gitignore and .gitattributes files in a task avoids doing that
66-
// when distribution build is not required (e.g. code is just compiled)
67-
root.set(rootDir)
68-
}
69-
70-
fun CrLfSpec.sourceLayout() = copySpec {
71-
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
72-
gitattributes(gitProps)
73-
into(baseFolder) {
74-
// Note: license content is taken from "/build/..", so gitignore should not be used
75-
// Note: this is a "license + third-party licenses", not just Apache-2.0
76-
dependencyLicenses(sourceLicense)
77-
// Include all the source files
78-
from(rootDir) {
79-
gitignore(gitProps)
80-
}
81-
}
82-
}
83-
84-
for (archive in listOf(Zip::class, Tar::class)) {
85-
tasks.register("dist${archive.simpleName}", archive) {
86-
val eol = if (archive == Tar::class) LineEndings.LF else LineEndings.CRLF
87-
if (this is Tar) {
88-
compression = Compression.GZIP
89-
}
90-
CrLfSpec(eol).run {
91-
with(sourceLayout())
92-
}
93-
}
94-
}
95-
```
9659

9760
IDE Plugin
9861
==========
@@ -104,74 +67,9 @@ IDE Plugin
10467
License Gather Plugin
10568
=====================
10669

107-
The purpose of the plugin is to analyze and infer license names for the dependencies.
108-
The plugin checks for 3 places: MANIFEST.MF (`Bundle-License` attribute),
109-
`pom.xml` (`licenses/license` tags), and finally `LICENSE`-like files.
110-
Note: for now only fuzzy-match is implemented, and by default a similarity threshold of 42% is used.
111-
112-
License Gather Plugin uses https://github.com/spdx/license-list-data for the list of licenses.
113-
114-
Prior art
115-
---------
116-
117-
https://github.com/jk1/Gradle-License-Report
118-
119-
Gradle-License-Report is nice (it is), however there are certain pecularities (as of 2019-06-04)
120-
121-
* It can't generate multiple lists within a single project (e.g. license for source / binary artifacts)
122-
* The model for imported/discovered licenses is differnet
123-
* There's no way to override license detection
124-
125-
https://github.com/eskatos/honker-gradle
126-
127-
* There's no way to override license files
128-
* [SPDX](https://spdx.org/licenses/) is not used
129-
130-
Features
131-
--------
70+
The purpose of the plugin is to analyze and infer license names for the dependencies, and verify license compatibility.
13271

133-
* LICENSE file generation
134-
* License whitelisting
135-
* The detected licenses can be overridden
136-
* Support for incremental-builds (discovery does not run in case dependencies do not change)
137-
* Type-safe license enumeration (based on SPDX):
138-
139-
com.github.vlsi.gradle.license.api.SpdxLicense#Apache_2_0
140-
141-
Usage
142-
-----
143-
144-
Gradle (Groovy DSL):
145-
```groovy
146-
plugins {
147-
id('com.github.vlsi.license-gather') version '1.0.0'
148-
}
149-
150-
tasks.register('generateLicense', GatherLicenseTask.class) {
151-
configurations.add(project.configurations.runtimeClasspath)
152-
outputFile.set(file("$buildDir/result.txt"))
153-
154-
doLast {
155-
println(outputFile.get().asFile.text)
156-
}
157-
}
158-
```
159-
160-
Gradle (Kotlin DSL):
161-
```groovy
162-
plugins {
163-
id("com.github.vlsi.license-gather") version "1.0.0"
164-
}
165-
166-
tasks.register("generateLicense", GatherLicenseTask::class) {
167-
configurations.add(project.configurations.runtimeClasspath)
168-
outputFile.set(file("$buildDir/result.txt"))
169-
170-
doLast {
171-
println(outputFile.get().asFile.readText())
172-
}
173-
}
174-
```
72+
See [license-gather-plugin description](plugins/license-gather-plugin/README.md) for configuration options.
17573

17674
Gettext Plugin
17775
==============

plugins/checksum-dependency-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/github/vlsi/gradle/checksum-dependency-plugin/maven-metadata.xml.svg?colorB=007ec6&label=gradle)](https://plugins.gradle.org/plugin/com.github.vlsi.checksum-dependency)
1+
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/com/github/vlsi/gradle/checksum-dependency-plugin/maven-metadata.xml.svg?colorB=007ec6&label=latest%20version)](https://plugins.gradle.org/plugin/com.github.vlsi.checksum-dependency)
22

33
Checksum Dependency Plugin
44
==========================

plugins/crlf-plugin/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/com/github/vlsi/gradle/crlf-plugin/maven-metadata.xml.svg?colorB=007ec6&label=latest%20version)](https://plugins.gradle.org/plugin/com.github.vlsi.crlf)
2+
3+
CRLF Plugin
4+
===========
5+
6+
Adds Kotlin DSL to specify CRLF/LF filtering for `CopySpec`.
7+
Enables to use `.gitignore` and `.gitattributes` for building `CopySpec`.
8+
9+
Usage
10+
-----
11+
12+
Kotlin DSL:
13+
14+
```kotlin
15+
// Loads .gitattributes and .gitignore from rootDir (and subdirs)
16+
val gitProps by tasks.registering(FindGitAttributes::class) {
17+
// Scanning for .gitignore and .gitattributes files in a task avoids doing that
18+
// when distribution build is not required (e.g. code is just compiled)
19+
root.set(rootDir)
20+
}
21+
22+
fun CrLfSpec.sourceLayout() = copySpec {
23+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
24+
gitattributes(gitProps)
25+
into(baseFolder) {
26+
// Note: license content is taken from "/build/..", so gitignore should not be used
27+
// Note: this is a "license + third-party licenses", not just Apache-2.0
28+
dependencyLicenses(sourceLicense)
29+
// Include all the source files
30+
from(rootDir) {
31+
gitignore(gitProps)
32+
}
33+
}
34+
}
35+
36+
for (archive in listOf(Zip::class, Tar::class)) {
37+
tasks.register("dist${archive.simpleName}", archive) {
38+
val eol = if (archive == Tar::class) LineEndings.LF else LineEndings.CRLF
39+
if (this is Tar) {
40+
compression = Compression.GZIP
41+
}
42+
CrLfSpec(eol).run {
43+
with(sourceLayout())
44+
}
45+
}
46+
}
47+
```

plugins/gradle-extensions-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/github/vlsi/gradle/gradle-extensions-plugin/maven-metadata.xml.svg?colorB=007ec6&label=gradle)](https://plugins.gradle.org/plugin/com.github.vlsi.gradle-extensions)
1+
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/com/github/vlsi/gradle/gradle-extensions-plugin/maven-metadata.xml.svg?colorB=007ec6&label=latest%20version)](https://plugins.gradle.org/plugin/com.github.vlsi.gradle-extensions)
22

33
Gradle Extensions Plugin
44
=========================

plugins/jandex-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/github/vlsi/jandex/jandex-plugin/maven-metadata.xml.svg?colorB=007ec6&label=gradle)](https://plugins.gradle.org/plugin/com.github.vlsi.jandex)
1+
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/com/github/vlsi/jandex/jandex-plugin/maven-metadata.xml.svg?colorB=007ec6&label=latest%20version)](https://plugins.gradle.org/plugin/com.github.vlsi.jandex)
22

33
Jandex Gradle Plugin
44
====================
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/com/github/vlsi/gradle/license-gather-plugin/maven-metadata.xml.svg?colorB=007ec6&label=latest%20version)](https://plugins.gradle.org/plugin/com.github.vlsi.license-gather)
2+
3+
License Gather Plugin
4+
=====================
5+
6+
The purpose of the plugin is to analyze and infer license names for the dependencies, and verify license compatibility.
7+
The plugin checks for 3 places: MANIFEST.MF (`Bundle-License` attribute),
8+
`pom.xml` (`licenses/license` tags), and finally `LICENSE`-like files.
9+
Note: for now only fuzzy-match is implemented, and by default a similarity threshold of 42% is used.
10+
11+
License Gather Plugin uses https://github.com/spdx/license-list-data for the list of licenses.
12+
13+
Prior art
14+
---------
15+
16+
https://github.com/jk1/Gradle-License-Report
17+
18+
Gradle-License-Report is nice (it is), however there are certain pecularities (as of 2019-06-04)
19+
20+
* It can't generate multiple lists within a single project (e.g. license for source / binary artifacts)
21+
* The model for imported/discovered licenses is differnet
22+
* There's no way to override license detection
23+
24+
https://github.com/eskatos/honker-gradle
25+
26+
* There's no way to override license files
27+
* [SPDX](https://spdx.org/licenses/) is not used
28+
29+
License Gather Plugin Features
30+
------------------------------
31+
32+
* LICENSE file generation
33+
* License whitelisting
34+
* The detected licenses can be overridden
35+
* Verify license compatibility
36+
* Type-safe license enumeration (based on SPDX):
37+
38+
com.github.vlsi.gradle.license.api.SpdxLicense.Apache_2_0
39+
40+
Usage
41+
-----
42+
43+
Gradle (Groovy DSL):
44+
```groovy
45+
import com.github.vlsi.gradle.license.GatherLicenseTask
46+
import com.github.vlsi.gradle.license.VerifyLicenseCompatibilityTask
47+
import com.github.vlsi.gradle.release.AsfLicenseCategory
48+
import com.github.vlsi.gradle.license.api.SpdxLicense
49+
import com.github.vlsi.gradle.license.api.SimpleLicense
50+
51+
plugins {
52+
id('com.github.vlsi.license-gather') version '1.78'
53+
}
54+
55+
// Gathers license information and license files from the runtime dependencies
56+
def gatherLicense = tasks.register('gatherLicense', GatherLicenseTask.class) {
57+
configurations.add(project.configurations.runtimeClasspath)
58+
}
59+
60+
tasks.register("verifyLicenses", VerifyLicenseCompatibilityTask.class) {
61+
metadata.from(gatherLicense)
62+
allow(SpdxLicense.EPL_2_0) {
63+
// The message would be displayed, so the verification results are easier to understand
64+
because("ISSUE-23: EPL-2.0 is fine in our projects")
65+
}
66+
allow(new SimpleLicense("The W3C License", uri("http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding.zip"))) {
67+
because("ISSUE-42: John Smith decided the license is OK")
68+
}
69+
// License category
70+
// See https://www.apache.org/legal/resolved.html
71+
allow(AsfLicenseCategory.A) {
72+
because("The ASF category A is allowed")
73+
}
74+
reject(AsfLicenseCategory.X) {
75+
because("The ASF category X is forbidden")
76+
}
77+
}
78+
```
79+
80+
Gradle (Kotlin DSL):
81+
```kotlin
82+
import com.github.vlsi.gradle.license.GatherLicenseTask
83+
import com.github.vlsi.gradle.license.VerifyLicenseCompatibilityTask
84+
import com.github.vlsi.gradle.release.AsfLicenseCategory
85+
import com.github.vlsi.gradle.license.api.SpdxLicense
86+
import com.github.vlsi.gradle.license.api.SimpleLicense
87+
88+
plugins {
89+
id("com.github.vlsi.license-gather") version "1.78"
90+
}
91+
92+
// Gathers license information and license files from the runtime dependencies
93+
val generateLicense by tasks.registering(GatherLicenseTask::class) {
94+
configurations.add(project.configurations.runtimeClasspath)
95+
// In the ideal case, each dependency should ship a copy of the full license text
96+
// just in case it has been modified.
97+
// For instance, "MIT licence" and "BSD-* license" are almost always modified,
98+
// and they have custom "copyright" section.
99+
// However, certain licenses like Apache-2.0, MPL-2.0, have fixed texts, so
100+
// we can ignore the failure if project is MPL-2.0 licensed, and it omits the license file
101+
ignoreMissingLicenseFor.add(SpdxLicense.Apache_2_0.asExpression())
102+
103+
defaultTextFor.add(SpdxLicense.MPL_2_0.asExpression())
104+
105+
// Artifact version in override is optional
106+
overrideLicense("com.thoughtworks.xstream:xstream:1.4.11") {
107+
// This version reads "BSD style" in pom.xml, however, their license
108+
// is the same as BSD-3-Clause, so we override it
109+
// expectedLicense helps to protect from accidental overrides if the project changes version
110+
expectedLicense = SimpleLicense("BSD style", uri("http://x-stream.github.io/license.html"))
111+
// https://github.com/x-stream/xstream/issues/151
112+
// https://github.com/x-stream/xstream/issues/153
113+
effectiveLicense = SpdxLicense.BSD_3_Clause
114+
}
115+
116+
overrideLicense("com.formdev:svgSalamander") {
117+
// See https://github.com/blackears/svgSalamander/blob/d6b6fe9a8ece7d0e0e7aeb3de82f027a38a6fe25/www/license/license-bsd.txt
118+
effectiveLicense = SpdxLicense.BSD_3_Clause
119+
}
120+
}
121+
122+
val verifyLicenses by tasks.registering(VerifyLicenseCompatibilityTask::class) {
123+
metadata.from(gatherLicense)
124+
// License with SPDX ID (see https://spdx.org/licenses/)
125+
allow(SpdxLicense.EPL_2_0) {
126+
// The message would be displayed, so the verification results are easier to understand
127+
because("ISSUE-23: EPL-2.0 is fine in our projects")
128+
}
129+
// A custom license that is not present in SPDX
130+
allow(SimpleLicense("The W3C License", uri("http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding.zip"))) {
131+
because("ISSUE-42: John Smith decided the license is OK")
132+
}
133+
// License category
134+
// See https://www.apache.org/legal/resolved.html
135+
allow(AsfLicenseCategory.A) {
136+
// The reason will be displayed
137+
because("The ASF category A is allowed")
138+
}
139+
reject(AsfLicenseCategory.X) {
140+
because("The ASF category X is forbidden")
141+
}
142+
}
143+
```

plugins/stage-vote-release-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/github/vlsi/gradle/stage-vote-release-plugin/maven-metadata.xml.svg?colorB=007ec6&label=gradle)](https://plugins.gradle.org/plugin/com.github.vlsi.stage-vote-release)
1+
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/com/github/vlsi/gradle/stage-vote-release-plugin/maven-metadata.xml.svg?colorB=007ec6&label=latest%20version)](https://plugins.gradle.org/plugin/com.github.vlsi.stage-vote-release)
22

33
Stage Vote Release Plugin
44
=========================

0 commit comments

Comments
 (0)