-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from mdedetrich/add-aggreate-anyproject-report
Support report generation for aggregate and all projects
- Loading branch information
Showing
9 changed files
with
125 additions
and
5 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
45 changes: 45 additions & 0 deletions
45
src/sbt-test/dumpLicenseReport/aggregate-report/example.sbt
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,45 @@ | ||
name := "example" | ||
|
||
excludeDependencies in ThisBuild += "org.scala-lang" | ||
|
||
lazy val one = project.in(file("one")).settings( | ||
List( | ||
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.5.4", | ||
libraryDependencies += "junit" % "junit" % "4.12" % "test" | ||
) | ||
) | ||
|
||
lazy val two = project.in(file("two")).settings( | ||
List( | ||
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.4.6" | ||
) | ||
) | ||
|
||
// Deliberately excluded from project root aggregate so we can test that it doesn't get included | ||
// in report | ||
lazy val three = project.in(file("three")).settings( | ||
List( | ||
libraryDependencies += "com.google.guava" % "guava" % "31.1-jre" | ||
) | ||
) | ||
|
||
lazy val root = project.in(file(".")).aggregate( | ||
one, two | ||
) | ||
|
||
TaskKey[Unit]("check") := { | ||
val contents = sbt.IO.read(target.value / "license-reports" / "example-licenses.md") | ||
if (!contents.contains("[The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | [com.fasterxml.jackson.core # jackson-databind # 2.5.4](http://github.com/FasterXML/jackson)")) | ||
sys.error("Expected report to contain jackson-databind with Apache license: " + contents) | ||
if (!contents.contains("jackson-databind")) | ||
sys.error("Expected report to contain jackson-databind: " + contents) | ||
if (!contents.contains("logback-classic")) | ||
sys.error("Expected report to contain logback-classic:" + contents) | ||
if (contents.contains("guava")) | ||
sys.error("Expected report to NOT contain guava:" + contents) | ||
if (!contents.contains("[Eclipse Public License 1.0](http://www.eclipse.org/legal/epl-v10.html) | [junit # junit # 4.12](http://junit.org)")) | ||
sys.error("Expected report to contain junit with EPL license: " + contents) | ||
// Test whether exclusions are included. | ||
if (contents.contains("scala-library")) | ||
sys.error("Expected report to NOT contain scala-library: " + contents) | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/dumpLicenseReport/aggregate-report/project/plugins.sbt
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 @@ | ||
addSbtPlugin("com.github.sbt" % "sbt-license-report" % sys.props("plugin.version")) |
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 @@ | ||
> dumpLicenseReportAggregate | ||
$ exists target/license-reports/example-licenses.md | ||
$ exists target/license-reports/example-licenses.html | ||
$ exists target/license-reports/example-licenses.csv | ||
> check |
31 changes: 31 additions & 0 deletions
31
src/sbt-test/dumpLicenseReport/anyproject-report/example.sbt
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,31 @@ | ||
name := "example" | ||
|
||
excludeDependencies in ThisBuild += "org.scala-lang" | ||
|
||
lazy val one = project.in(file("one")).settings( | ||
List( | ||
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.5.4", | ||
libraryDependencies += "junit" % "junit" % "4.12" % "test" | ||
) | ||
) | ||
|
||
lazy val two = project.in(file("two")).settings( | ||
List( | ||
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.4.6" | ||
) | ||
) | ||
|
||
TaskKey[Unit]("check") := { | ||
val contents = sbt.IO.read(target.value / "license-reports" / "example-licenses.md") | ||
if (!contents.contains("[The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | [com.fasterxml.jackson.core # jackson-databind # 2.5.4](http://github.com/FasterXML/jackson)")) | ||
sys.error("Expected report to contain jackson-databind with Apache license: " + contents) | ||
if (!contents.contains("jackson-databind")) | ||
sys.error("Expected report to contain jackson-databind: " + contents) | ||
if (!contents.contains("logback-classic")) | ||
sys.error("Expected report to contain logback-classic:" + contents) | ||
if (!contents.contains("[Eclipse Public License 1.0](http://www.eclipse.org/legal/epl-v10.html) | [junit # junit # 4.12](http://junit.org)")) | ||
sys.error("Expected report to contain junit with EPL license: " + contents) | ||
// Test whether exclusions are included. | ||
if (contents.contains("scala-library")) | ||
sys.error("Expected report to NOT contain scala-library: " + contents) | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/dumpLicenseReport/anyproject-report/project/plugins.sbt
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 @@ | ||
addSbtPlugin("com.github.sbt" % "sbt-license-report" % sys.props("plugin.version")) |
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 @@ | ||
> dumpLicenseReportAnyProject | ||
$ exists target/license-reports/example-licenses.md | ||
$ exists target/license-reports/example-licenses.html | ||
$ exists target/license-reports/example-licenses.csv | ||
> check |