-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration to disable unused license warnings (#285)
* Added config option for handling unused licenses * Add tests in groovy/KTS * Renamed UnusedAction.WARN to LOG * Unused imports
- Loading branch information
Showing
44 changed files
with
394 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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
16 changes: 16 additions & 0 deletions
16
src/test/fixtures/coordinate-allow-unused-ignored-kts/build.gradle.kts
This file contains 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,16 @@ | ||
import app.cash.licensee.UnusedAction.IGNORE | ||
|
||
plugins { | ||
id("java-library") | ||
alias(libs.plugins.licensee) | ||
} | ||
|
||
dependencies { | ||
implementation("com.example:example:1.0.0") | ||
} | ||
|
||
licensee { | ||
allowDependency("com.example", "example", "1.0.0") | ||
allowDependency("com.example", "example2", "1.0.0") | ||
unusedAction(IGNORE) | ||
} |
5 changes: 5 additions & 0 deletions
5
...xtures/coordinate-allow-unused-ignored-kts/expected/build/reports/licensee/validation.txt
This file contains 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 @@ | ||
WARNING: Allowed dependency 'com.example:example2:1.0.0' is unused | ||
|
||
com.example:example:1.0.0 | ||
- SPDX identifier 'Apache-2.0' is NOT allowed | ||
- Coordinate version is allowed |
Binary file added
BIN
+22 Bytes
...ures/coordinate-allow-unused-ignored-kts/repo/com/example/example/1.0.0/example-1.0.0.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
...ures/coordinate-allow-unused-ignored-kts/repo/com/example/example/1.0.0/example-1.0.0.pom
This file contains 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 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>example</artifactId> | ||
<version>1.0.0</version> | ||
<licenses> | ||
<license> | ||
<name>Apache-2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
</project> |
7 changes: 7 additions & 0 deletions
7
src/test/fixtures/coordinate-allow-unused-ignored-kts/settings.gradle.kts
This file contains 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,7 @@ | ||
pluginManagement { | ||
includeBuild("../../test-build-logic") | ||
} | ||
|
||
plugins { | ||
id("licenseeTests") | ||
} |
14 changes: 14 additions & 0 deletions
14
src/test/fixtures/coordinate-allow-unused-ignored/build.gradle
This file contains 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 @@ | ||
plugins { | ||
id("java-library") | ||
alias(libs.plugins.licensee) | ||
} | ||
|
||
dependencies { | ||
implementation 'com.example:example:1.0.0' | ||
} | ||
|
||
licensee { | ||
allowDependency('com.example', 'example', '1.0.0') | ||
allowDependency('com.example', 'example2', '1.0.0') | ||
unusedAction("IGNORE") | ||
} |
5 changes: 5 additions & 0 deletions
5
...t/fixtures/coordinate-allow-unused-ignored/expected/build/reports/licensee/validation.txt
This file contains 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 @@ | ||
WARNING: Allowed dependency 'com.example:example2:1.0.0' is unused | ||
|
||
com.example:example:1.0.0 | ||
- SPDX identifier 'Apache-2.0' is NOT allowed | ||
- Coordinate version is allowed |
Binary file added
BIN
+22 Bytes
...fixtures/coordinate-allow-unused-ignored/repo/com/example/example/1.0.0/example-1.0.0.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
...fixtures/coordinate-allow-unused-ignored/repo/com/example/example/1.0.0/example-1.0.0.pom
This file contains 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 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>example</artifactId> | ||
<version>1.0.0</version> | ||
<licenses> | ||
<license> | ||
<name>Apache-2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
</project> |
7 changes: 7 additions & 0 deletions
7
src/test/fixtures/coordinate-allow-unused-ignored/settings.gradle
This file contains 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,7 @@ | ||
pluginManagement { | ||
includeBuild("../../test-build-logic") | ||
} | ||
|
||
plugins { | ||
id("licenseeTests") | ||
} |
16 changes: 16 additions & 0 deletions
16
src/test/fixtures/coordinate-allow-unused-warn-kts/build.gradle.kts
This file contains 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,16 @@ | ||
import app.cash.licensee.UnusedAction.LOG | ||
|
||
plugins { | ||
id("java-library") | ||
alias(libs.plugins.licensee) | ||
} | ||
|
||
dependencies { | ||
implementation("com.example:example:1.0.0") | ||
} | ||
|
||
licensee { | ||
allowDependency("com.example", "example", "1.0.0") | ||
allowDependency("com.example", "example2", "1.0.0") | ||
unusedAction(LOG) | ||
} |
5 changes: 5 additions & 0 deletions
5
.../fixtures/coordinate-allow-unused-warn-kts/expected/build/reports/licensee/validation.txt
This file contains 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 @@ | ||
WARNING: Allowed dependency 'com.example:example2:1.0.0' is unused | ||
|
||
com.example:example:1.0.0 | ||
- SPDX identifier 'Apache-2.0' is NOT allowed | ||
- Coordinate version is allowed |
Binary file added
BIN
+22 Bytes
...ixtures/coordinate-allow-unused-warn-kts/repo/com/example/example/1.0.0/example-1.0.0.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
...ixtures/coordinate-allow-unused-warn-kts/repo/com/example/example/1.0.0/example-1.0.0.pom
This file contains 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 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>example</artifactId> | ||
<version>1.0.0</version> | ||
<licenses> | ||
<license> | ||
<name>Apache-2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
</project> |
7 changes: 7 additions & 0 deletions
7
src/test/fixtures/coordinate-allow-unused-warn-kts/settings.gradle.kts
This file contains 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,7 @@ | ||
pluginManagement { | ||
includeBuild("../../test-build-logic") | ||
} | ||
|
||
plugins { | ||
id("licenseeTests") | ||
} |
14 changes: 14 additions & 0 deletions
14
src/test/fixtures/coordinate-allow-unused-warn/build.gradle
This file contains 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 @@ | ||
plugins { | ||
id("java-library") | ||
alias(libs.plugins.licensee) | ||
} | ||
|
||
dependencies { | ||
implementation 'com.example:example:1.0.0' | ||
} | ||
|
||
licensee { | ||
allowDependency('com.example', 'example', '1.0.0') | ||
allowDependency('com.example', 'example2', '1.0.0') | ||
unusedAction("LOG") | ||
} |
5 changes: 5 additions & 0 deletions
5
...test/fixtures/coordinate-allow-unused-warn/expected/build/reports/licensee/validation.txt
This file contains 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 @@ | ||
WARNING: Allowed dependency 'com.example:example2:1.0.0' is unused | ||
|
||
com.example:example:1.0.0 | ||
- SPDX identifier 'Apache-2.0' is NOT allowed | ||
- Coordinate version is allowed |
Binary file added
BIN
+22 Bytes
...st/fixtures/coordinate-allow-unused-warn/repo/com/example/example/1.0.0/example-1.0.0.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
...st/fixtures/coordinate-allow-unused-warn/repo/com/example/example/1.0.0/example-1.0.0.pom
This file contains 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 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>example</artifactId> | ||
<version>1.0.0</version> | ||
<licenses> | ||
<license> | ||
<name>Apache-2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
</project> |
7 changes: 7 additions & 0 deletions
7
src/test/fixtures/coordinate-allow-unused-warn/settings.gradle
This file contains 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,7 @@ | ||
pluginManagement { | ||
includeBuild("../../test-build-logic") | ||
} | ||
|
||
plugins { | ||
id("licenseeTests") | ||
} |
This file contains 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 @@ | ||
plugins { | ||
id("java-library") | ||
alias(libs.plugins.licensee) | ||
} | ||
|
||
dependencies { | ||
implementation 'com.example:example:1.0.0' | ||
} | ||
|
||
licensee { | ||
allow('Apache-2.0') | ||
allow('MIT') | ||
unusedAction("IGNORE") | ||
} |
4 changes: 4 additions & 0 deletions
4
src/test/fixtures/spdx-allow-unused-ignored/expected/build/reports/licensee/validation.txt
This file contains 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 @@ | ||
WARNING: Allowed SPDX identifier 'MIT' is unused | ||
|
||
com.example:example:1.0.0 | ||
- SPDX identifier 'Apache-2.0' allowed |
Binary file added
BIN
+22 Bytes
src/test/fixtures/spdx-allow-unused-ignored/repo/com/example/example/1.0.0/example-1.0.0.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
src/test/fixtures/spdx-allow-unused-ignored/repo/com/example/example/1.0.0/example-1.0.0.pom
This file contains 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 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>example</artifactId> | ||
<version>1.0.0</version> | ||
<licenses> | ||
<license> | ||
<name>Apache-2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
</project> |
This file contains 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,7 @@ | ||
pluginManagement { | ||
includeBuild("../../test-build-logic") | ||
} | ||
|
||
plugins { | ||
id("licenseeTests") | ||
} |
This file contains 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 @@ | ||
plugins { | ||
id("java-library") | ||
alias(libs.plugins.licensee) | ||
} | ||
|
||
dependencies { | ||
implementation 'com.example:example:1.0.0' | ||
} | ||
|
||
licensee { | ||
allow('Apache-2.0') | ||
allow('MIT') | ||
unusedAction("LOG") | ||
} |
4 changes: 4 additions & 0 deletions
4
src/test/fixtures/spdx-allow-unused-warn/expected/build/reports/licensee/validation.txt
This file contains 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 @@ | ||
WARNING: Allowed SPDX identifier 'MIT' is unused | ||
|
||
com.example:example:1.0.0 | ||
- SPDX identifier 'Apache-2.0' allowed |
Binary file added
BIN
+22 Bytes
src/test/fixtures/spdx-allow-unused-warn/repo/com/example/example/1.0.0/example-1.0.0.jar
Binary file not shown.
Oops, something went wrong.