Skip to content

Commit 4870ff5

Browse files
committed
Fixing build issues.
1 parent 55c414d commit 4870ff5

File tree

3 files changed

+116
-104
lines changed

3 files changed

+116
-104
lines changed

assembly/licenses/copy-licenses.groovy

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,21 @@ Files.readAllLines(thirdPartyFile).each { line ->
9999

100100
// Normalize licenses
101101
def normalizedLicenses = licenses.collect { license ->
102-
def mapping = licenseMappings.find { mapping ->
103-
mapping.patterns.any { pattern ->
104-
def regex = Pattern.compile("^${pattern}\$", Pattern.CASE_INSENSITIVE)
105-
license ==~ regex
102+
def result = licenseMappings.find { mapping ->
103+
// Match "<spdx-id>:" first
104+
if (license.startsWith("${mapping.spdx_id}:")) {
105+
return mapping;
106106
}
107+
// Then other patterns
108+
mapping.patterns.any { pattern ->
109+
def regex = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)
110+
regex.matcher(license).find()
111+
} ? mapping : null
107112
}
108-
if (!mapping) {
109-
throw new RuntimeException("No mapping found for license \"${license}\" in line: ${trimmedLine}")
113+
if (!result) {
114+
throw new RuntimeException("No mapping found for license \"${license}\" in line: \"${trimmedLine}\"")
110115
}
111-
[spdx_id: mapping.spdx_id, full_name: mapping.full_name]
116+
[spdx_id: result.spdx_id, full_name: result.full_name]
112117
}
113118

114119
// Format normalized license string

assembly/licenses/license_mappings.json

Lines changed: 80 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -4,255 +4,242 @@
44
"spdx_id": "Apache-2.0",
55
"full_name": "Apache License 2.0",
66
"patterns": [
7-
"ASF 2\\.0",
8-
"ASL 2\\.0",
9-
"Apache 2",
10-
"Apache 2\\.0",
11-
"Apache 2\\.0 License",
12-
"Apache License",
13-
"Apache License 2\\.0",
14-
"Apache License v2",
15-
"Apache License Version 2\\.0",
16-
"Apache License, Version 2\\.0",
17-
"Apache License, version 2\\.0",
18-
"Apache Public License 2\\.0",
19-
"Apache Software Licenses",
20-
"Apache Software License - Version 2\\.0",
21-
"Apache Software License, version 2\\.0",
22-
"Apache-2\\.0",
23-
"The Apache License, Version 2\\.0",
24-
"The Apache Software License, Version 2\\.0",
25-
"The Apache Software License, version 2\\.0"
7+
"\\b(The )?Apache.*?[^\\d]2[^\\d]",
8+
"^ASF 2\\.0$",
9+
"^ASL 2\\.0$",
10+
"^Apache License$",
11+
"^Apache Software Licenses$"
2612
]
2713
},
2814
{
2915
"spdx_id": "BSD-2-Clause",
3016
"full_name": "BSD 2-Clause \"Simplified\" License",
3117
"patterns": [
32-
"BSD 2-Clause \"Simplified\" License",
33-
"The BSD 2-Clause License"
18+
"^BSD 2-Clause \"Simplified\" License$",
19+
"^The BSD 2-Clause License$"
3420
]
3521
},
3622
{
3723
"spdx_id": "BSD-3-Clause",
3824
"full_name": "BSD 3-Clause \"New\" or \"Revised\" License",
3925
"patterns": [
40-
"BSD",
41-
"BSD License",
42-
"BSD Licence",
43-
"BSD 3-Clause \"New\" or \"Revised\" License",
44-
"BSD-3-Clause",
45-
"Eclipse Distribution License - v 1\\.0",
46-
"EDL 1\\.0",
47-
"New BSD License",
48-
"Revised BSD",
49-
"The \\(New\\) BSD License",
50-
"The BSD 3-Clause License \\(BSD3\\)",
51-
"The BSD License"
26+
"^BSD$",
27+
"^BSD License$",
28+
"^BSD Licence$",
29+
"^BSD 3-Clause \"New\" or \"Revised\" License$",
30+
"^BSD-3-Clause: BSD 3-Clause \"New\" or \"Revised\" License$",
31+
"^BSD-3-Clause$",
32+
"^Eclipse Distribution License - v 1\\.0$",
33+
"^EDL 1\\.0$",
34+
"^New BSD License$",
35+
"^Revised BSD$",
36+
"^The \\(New\\) BSD License$",
37+
"^The BSD 3-Clause License \\(BSD3\\)$",
38+
"^The BSD License$"
5239
]
5340
},
5441
{
5542
"spdx_id": "BSD-3-Clause-No-Nuclear-License",
5643
"full_name": "BSD 3-clause License w/nuclear disclaimer",
5744
"patterns": [
58-
"BSD 3-clause License w/nuclear disclaimer"
45+
"^BSD 3-clause License w/nuclear disclaimer$"
5946
]
6047
},
6148
{
6249
"spdx_id": "CDDL-1.0",
6350
"full_name": "Common Development and Distribution License 1.0",
6451
"patterns": [
65-
"CDDL",
66-
"CDDL 1\\.0",
67-
"CDDL, v1\\.0",
68-
"Common Development and Distribution License"
52+
"^CDDL$",
53+
"^CDDL 1\\.0$",
54+
"^CDDL, v1\\.0$",
55+
"^Common Development and Distribution License$"
6956
]
7057
},
7158
{
7259
"spdx_id": "CDDL-1.1",
7360
"full_name": "Common Development and Distribution License 1.1",
7461
"patterns": [
75-
"CDDL 1\\.1",
76-
"CDDL License",
77-
"Common Development and Distribution License 1\\.1",
78-
"Unknown license",
79-
"CDDL \\+ GPLv2 with classpath exception",
80-
"CDDL/GPLv2\\+CE"
62+
"^CDDL 1\\.1$",
63+
"^CDDL License$",
64+
"^Common Development and Distribution License 1\\.1$",
65+
"^Unknown license$",
66+
"^CDDL \\+ GPLv2 with classpath exception$",
67+
"^CDDL/GPLv2\\+CE$"
8168
]
8269
},
8370
{
8471
"spdx_id": "CPL-1.0",
8572
"full_name": "Common Public License 1.0",
8673
"patterns": [
87-
"Common Public License 1\\.0",
88-
"CPL"
74+
"^Common Public License 1\\.0$",
75+
"^CPL$"
8976
]
9077
},
9178
{
9279
"spdx_id": "EPL-1.0",
9380
"full_name": "Eclipse Public License 1.0",
9481
"patterns": [
95-
"Eclipse Public License 1\\.0",
96-
"Eclipse Public License Version 1\\.0",
97-
"Eclipse Public License - Version 1\\.0",
98-
"EPL 1\\.0"
82+
"^Eclipse Public License 1\\.0$",
83+
"^Eclipse Public License Version 1\\.0$",
84+
"^Eclipse Public License - Version 1\\.0$",
85+
"^EPL 1\\.0$"
9986
]
10087
},
10188
{
10289
"spdx_id": "EPL-2.0",
10390
"full_name": "Eclipse Public License 2.0",
10491
"patterns": [
105-
"Eclipse Public License 2\\.0",
106-
"Eclipse Public License v\\. 2\\.0",
107-
"Eclipse Public License v2\\.0",
108-
"EPL 2\\.0",
109-
"EPL-2\\.0"
92+
"^Eclipse Public License 2\\.0$",
93+
"^Eclipse Public License v\\. 2\\.0$",
94+
"^Eclipse Public License v2\\.0$",
95+
"^EPL 2\\.0$",
96+
"^EPL-2\\.0$"
11097
]
11198
},
11299
{
113100
"spdx_id": "GPL-2.0-with-classpath-exception",
114101
"full_name": "GNU General Public License v2.0 only with the Classpath exception 2.0",
115102
"patterns": [
116-
"GNU General Public License, version 2 with the GNU Classpath Exception",
117-
"GPL-2\\.0-with-classpath-exception",
118-
"GPL2 w/ CPE",
119-
"GPLv2 with classpath exception",
120-
"GPL-2\\.0 with Classpath Exception",
121-
"GNU General Public License v2\\.0 with Classpath Exception",
122-
"CDDL \\+ GPLv2 with classpath exception",
123-
"CDDL/GPLv2\\+CE"
103+
"^GNU General Public License, version 2 with the GNU Classpath Exception$",
104+
"^GPL-2\\.0-with-classpath-exception$",
105+
"^GPL2 w/ CPE$",
106+
"^GPLv2 with classpath exception$",
107+
"^GPL-2\\.0 with Classpath Exception$",
108+
"^GNU General Public License v2\\.0 with Classpath Exception$",
109+
"^CDDL \\+ GPLv2 with classpath exception$",
110+
"^CDDL/GPLv2\\+CE$"
124111
]
125112
},
126113
{
127114
"spdx_id": "GPL-3.0-only",
128115
"full_name": "GNU General Public License v3.0 only",
129116
"patterns": [
130-
"GENERAL PUBLIC LICENSE, version 3 \\(GPL-3\\.0\\)"
117+
"^GENERAL PUBLIC LICENSE, version 3 \\(GPL-3\\.0\\)$"
131118
]
132119
},
133120
{
134121
"spdx_id": "ICU",
135122
"full_name": "ICU License",
136123
"patterns": [
137-
"ICU License"
124+
"^ICU License$"
138125
]
139126
},
140127
{
141128
"spdx_id": "LGPL-2.1-or-later",
142129
"full_name": "GNU Lesser General Public License v2.1 or later",
143130
"patterns": [
144-
"GNU Lesser General Public License v2\\.1 or later",
145-
"LGPL-2\\.1-or-later",
146-
"LGPL, v2\\.1 or later"
131+
"^GNU Lesser General Public License v2\\.1 or later$",
132+
"^LGPL-2\\.1-or-later$",
133+
"^LGPL, v2\\.1 or later$"
147134
]
148135
},
149136
{
150137
"spdx_id": "LGPL-2.1-only",
151138
"full_name": "GNU Lesser General Public License v2.1 only",
152139
"patterns": [
153-
"GNU Lesser General Public License, version 2\\.1"
140+
"^GNU Lesser General Public License, version 2\\.1$"
154141
]
155142
},
156143
{
157144
"spdx_id": "LGPL-3.0-or-later",
158145
"full_name": "GNU Lesser General Public License v3.0 or later",
159146
"patterns": [
160-
"GNU Lesser General Public License v3\\.0 or later",
161-
"Lesser General Public License, version 3 or greater"
147+
"^GNU Lesser General Public License v3\\.0 or later$",
148+
"^Lesser General Public License, version 3 or greater$"
162149
]
163150
},
164151
{
165152
"spdx_id": "LGPL-3.0-only",
166153
"full_name": "GNU Lesser General Public License v3.0 only",
167154
"patterns": [
168-
"GNU LESSER GENERAL PUBLIC LICENSE, version 3 \\(LGPL-3\\.0\\)"
155+
"^GNU LESSER GENERAL PUBLIC LICENSE, version 3 \\(LGPL-3\\.0\\)$"
169156
]
170157
},
171158
{
172159
"spdx_id": "LicenseRef-CUP-Parser-Generator",
173160
"full_name": "CUP Parser Generator Copyright Notice, License, and Disclaimer",
174161
"patterns": [
175-
"CUP Parser Generator Copyright Notice, License, and Disclaimer"
162+
"^CUP Parser Generator Copyright Notice, License, and Disclaimer$"
176163
]
177164
},
178165
{
179166
"spdx_id": "LicenseRef-GO",
180167
"full_name": "The Go license",
181168
"patterns": [
182-
"The Go license"
169+
"^The Go license$"
183170
]
184171
},
185172
{
186173
"spdx_id": "LicenseRef-JDOM",
187174
"full_name": "Similar to Apache License but with the acknowledgment clause removed",
188175
"patterns": [
189-
"Similar to Apache License but with the acknowledgment clause removed"
176+
"^Similar to Apache License but with the acknowledgment clause removed$"
190177
]
191178
},
192179
{
193180
"spdx_id": "LicenseRef-JJ2000",
194181
"full_name": "jj2000 License",
195182
"patterns": [
196-
"jj2000 License",
197-
"JJ2000"
183+
"^jj2000 License$",
184+
"^JJ2000$"
198185
]
199186
},
200187
{
201188
"spdx_id": "LicenseRef-Public-Domain",
202189
"full_name": "Public Domain",
203190
"patterns": [
204-
"LicenseRef-Public-Domain",
205-
"Public Domain"
191+
"^LicenseRef-Public-Domain$",
192+
"^Public Domain$"
206193
]
207194
},
208195
{
209196
"spdx_id": "LicenseRef-UnRAR",
210197
"full_name": "UnRar License",
211198
"patterns": [
212-
"UnRar License"
199+
"^UnRar License$"
213200
]
214201
},
215202
{
216203
"spdx_id": "Unicode-3.0",
217204
"full_name": "Unicode License v3",
218205
"patterns": [
219-
"Unicode/ICU License",
220-
"Unicode License v3"
206+
"^Unicode/ICU License$",
207+
"^Unicode License v3$"
221208
]
222209
},
223210
{
224211
"spdx_id": "MIT",
225212
"full_name": "MIT License",
226213
"patterns": [
227-
"Bouncy Castle Licence",
228-
"MIT",
229-
"MIT License",
230-
"The MIT License",
231-
"The MIT License \\(MIT\\)"
214+
"^Bouncy Castle Licence$",
215+
"^MIT$",
216+
"^MIT License$",
217+
"^The MIT License$",
218+
"^The MIT License \\(MIT\\)$"
232219
]
233220
},
234221
{
235222
"spdx_id": "MPL-1.1",
236223
"full_name": "Mozilla Public License 1.1",
237224
"patterns": [
238-
"Mozilla Public License Version 1\\.1"
225+
"^Mozilla Public License Version 1\\.1$"
239226
]
240227
},
241228
{
242229
"spdx_id": "MPL-2.0",
243230
"full_name": "Mozilla Public License 2.0",
244231
"patterns": [
245-
"Mozilla Public License 2\\.0",
246-
"Mozilla Public License, Version 2\\.0",
247-
"MPL 2\\.0"
232+
"^Mozilla Public License 2\\.0$",
233+
"^Mozilla Public License, Version 2\\.0$",
234+
"^MPL 2\\.0$"
248235
]
249236
},
250237
{
251238
"spdx_id": "UPL-1.0",
252239
"full_name": "Universal Permissive License v1.0",
253240
"patterns": [
254-
"Universal Permissive License v1\\.0",
255-
"Universal Permissive License, Version 1\\.0"
241+
"^Universal Permissive License v1\\.0$",
242+
"^Universal Permissive License, Version 1\\.0$"
256243
]
257244
}
258245
]

0 commit comments

Comments
 (0)