forked from LeidosLabs/holeshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
license-as-csv.ftl
35 lines (34 loc) · 1.26 KB
/
license-as-csv.ftl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<#-- To render the third-party file.
Available context :
- dependencyMap a collection of Map.Entry with
key are dependencies (as a MavenProject) (from the maven project)
values are licenses of each dependency (array of string)
- licenseMap a collection of Map.Entry with
key are licenses of each dependency (array of string)
values are all dependencies using this license
-->
<#function licenseFormat licenses>
<#assign result = ""/>
<#list licenses as license>
<#assign result = result + " (" +license + ")"/>
</#list>
<#assign result = result + "; "/>
<#return result>
</#function>
<#function artifactFormat p>
<#if p.name?index_of('Unnamed') > -1>
<#return p.artifactId + "; " + p.groupId + ":" + p.artifactId + ":" + p.version + "; " + (p.url!"no url defined")>
<#else>
<#return p.name + "; " + p.groupId + ":" + p.artifactId + ":" + p.version + "; " + (p.url!"no url defined")>
</#if>
</#function>
<#if dependencyMap?size == 0>
The project has no dependencies.
<#else>
Lists of ${dependencyMap?size} third-party dependencies.
<#list dependencyMap as e>
<#assign project = e.getKey()/>
<#assign licenses = e.getValue()/>
${licenseFormat(licenses)} ${artifactFormat(project)}
</#list>
</#if>