-
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.
- Loading branch information
1 parent
571f446
commit 4d76f23
Showing
6 changed files
with
136 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package sbtlicensereport.license | ||
|
||
trait Column { | ||
def columnName: String | ||
|
||
def render(depLicense: DepLicense, language: TargetLanguage): String | ||
} | ||
|
||
object Column { | ||
case object Category extends Column { | ||
override val columnName: String = "Category" | ||
|
||
override def render(depLicense: DepLicense, language: TargetLanguage): String = | ||
depLicense.license.category.name | ||
} | ||
|
||
case object License extends Column { | ||
override val columnName: String = "License" | ||
|
||
override def render(depLicense: DepLicense, language: TargetLanguage): String = | ||
language.createHyperLink(depLicense.license.url, depLicense.license.name) | ||
} | ||
|
||
case object Dependency extends Column { | ||
override val columnName: String = "Dependency" | ||
|
||
override def render(depLicense: DepLicense, language: TargetLanguage): String = | ||
depLicense.homepage match { | ||
case None => depLicense.module.toString | ||
case Some(url) => language.createHyperLink(url.toExternalForm, depLicense.module.toString) | ||
} | ||
} | ||
|
||
case object Configuration extends Column { | ||
override val columnName: String = "Maven/Ivy Configurations" | ||
|
||
override def render(depLicense: DepLicense, language: TargetLanguage): String = { | ||
depLicense.configs.mkString(",") | ||
} | ||
} | ||
|
||
case object OriginatingArtifactName extends Column { | ||
override val columnName: String = "Originating Artifact" | ||
|
||
override def render(depLicense: DepLicense, language: TargetLanguage): String = | ||
depLicense.originatingModule.name | ||
} | ||
} |
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
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