Regenerate checksum for a single dependency once. Add trailing newline for consistency with ant code.

This commit is contained in:
Dawid Weiss 2019-12-17 14:27:25 +01:00
parent 8906c2ddbe
commit faadb65202
187 changed files with 250 additions and 235 deletions

View File

@ -1,4 +1,3 @@
// This adds validation of project dependencies:
// 1) license file
// 2) notice file
@ -10,6 +9,7 @@ import org.apache.commons.codec.digest.MessageDigestAlgorithms
// This should be false only for debugging.
def failOnError = true
// We're using commons-codec for computing checksums.
buildscript {
repositories {
mavenCentral()
@ -33,17 +33,17 @@ configure(project(":solr")) {
// All known license types. If 'noticeOptional' is true then
// the notice file must accompany the license.
def licenseTypes = [
"ASL": [name: "Apache Software License 2.0"],
"BSD": [name: "Berkeley Software Distribution"],
"ASL" : [name: "Apache Software License 2.0"],
"BSD" : [name: "Berkeley Software Distribution"],
//BSD like just means someone has taken the BSD license and put in their name, copyright, or it's a very similar license.
"BSD_LIKE": [name: "BSD like license"],
"CDDL": [name: "Common Development and Distribution License", noticeOptional: true],
"CPL": [name: "Common Public License"],
"EPL": [name: "Eclipse Public License Version 1.0", noticeOptional: true],
"MIT": [name: "Massachusetts Institute of Tech. License", noticeOptional: true],
"MPL": [name: "Mozilla Public License", noticeOptional: true /* NOT SURE on the required notice */],
"PD": [name: "Public Domain", noticeOptional: true],
"SUN": [name: "Sun Open Source License", noticeOptional: true],
"CDDL" : [name: "Common Development and Distribution License", noticeOptional: true],
"CPL" : [name: "Common Public License"],
"EPL" : [name: "Eclipse Public License Version 1.0", noticeOptional: true],
"MIT" : [name: "Massachusetts Institute of Tech. License", noticeOptional: true],
"MPL" : [name: "Mozilla Public License", noticeOptional: true /* NOT SURE on the required notice */],
"PD" : [name: "Public Domain", noticeOptional: true],
"SUN" : [name: "Sun Open Source License", noticeOptional: true],
"COMPOUND": [name: "Compound license (details in NOTICE file)."],
]
@ -95,13 +95,13 @@ subprojects {
project.ext.jarInfos = ownDeps.resolvedConfiguration.resolvedArtifacts.collect { resolvedArtifact ->
def file = resolvedArtifact.file
return [
name: resolvedArtifact.name,
jarName: file.toPath().getFileName().toString(),
path: file,
module: resolvedArtifact.moduleVersion,
checksum: new DigestUtils(MessageDigestAlgorithms.SHA_1).digestAsHex(file),
// We keep count of the files referenced by this dependency (sha, license, notice, etc.)
// so that we can determine unused files later on.
name : resolvedArtifact.name,
jarName : file.toPath().getFileName().toString(),
path : file,
module : resolvedArtifact.moduleVersion,
checksum : new DigestUtils(MessageDigestAlgorithms.SHA_1).digestAsHex(file),
// We keep track of the files referenced by this dependency (sha, license, notice, etc.)
// so that we can determine unused dangling files later on.
referencedFiles: []
]
}
@ -143,30 +143,6 @@ subprojects {
}
}
// Update dependency checksums
task updateChecksums() {
group = 'Dependency validation'
description = "Write or update checksums of dependencies"
dependsOn collectJarInfos
doLast {
licensesDir.mkdirs()
jarInfos.each { dep ->
def expectedChecksumFile = file("${licensesDir}/${dep.jarName}.sha1")
if (expectedChecksumFile.exists()) {
def expected = expectedChecksumFile.getText("UTF-8").trim()
def actual = dep.checksum.trim()
if (expected.compareToIgnoreCase(actual) == 0) {
return;
}
}
logger.log(LogLevel.LIFECYCLE, "Updating checksum ('${dep.module}'): ${expectedChecksumFile}")
expectedChecksumFile.write(dep.checksum.trim(), "UTF-8")
}
}
}
// Locate the set of license file candidates for this dependency. We
// search for [jar-or-prefix]-LICENSE-[type].txt
// where 'jar-or-prefix' can be any '-'-delimited prefix of the dependency JAR's name.
@ -237,10 +213,11 @@ subprojects {
licenses.dependsOn validateJarChecksums, validateJarLicenses
}
// Check for dangling files in the licenses folder.
configure([project(":solr"), project(":lucene"), ]) {
configure([project(":solr"), project(":lucene"),]) {
def validationTasks = subprojects.collect { it.tasks.matching { it.name == "licenses" } }
def jarInfoTasks = subprojects.collect { it.tasks.matching { it.name == "collectJarInfos" } }
// Check for dangling files in the licenses folder.
task checkDanglingLicenseFiles() {
dependsOn validationTasks
@ -250,9 +227,8 @@ configure([project(":solr"), project(":lucene"), ]) {
doFirst {
def allReferenced = validationTasks.collectMany { task ->
task.project.jarInfos.collectMany { it.referencedFiles }
}
.collect { it.toString() }
task.project.jarInfos.collectMany { it.referencedFiles }
}.collect { it.toString() }
def patterns = ext.exclude
def allExisting = fileTree(licensesDir, {
@ -270,6 +246,43 @@ configure([project(":solr"), project(":lucene"), ]) {
}
licenses.dependsOn checkDanglingLicenseFiles
// Update dependency checksums.
task updateChecksums() {
group = 'Dependency validation'
description = "Write or update checksums of dependencies"
dependsOn jarInfoTasks
doLast {
licensesDir.mkdirs()
// Clean any previous checksums. In theory we wouldn't have to do it --
// dangling files from any previous JARs would be reported;
// it automates the process of updating versions and makes it easier though so
// why not.
project.delete fileTree(licensesDir, {
include "*.sha1"
exclude checkDanglingLicenseFiles.ext.exclude
})
def updated = []
jarInfoTasks.collectMany { task -> task.project.jarInfos }.each { dep ->
def expectedChecksumFile = file("${licensesDir}/${dep.jarName}.sha1")
if (expectedChecksumFile.exists()) {
def expected = expectedChecksumFile.getText("UTF-8").trim()
def actual = dep.checksum.trim()
if (expected.compareToIgnoreCase(actual) == 0) {
return;
}
}
updated += "Updated checksum ('${dep.module}'): ${expectedChecksumFile}"
expectedChecksumFile.write(dep.checksum.trim() + "\n", "UTF-8")
}
updated.sort().each { line -> logger.log(LogLevel.LIFECYCLE, line) }
}
}
}
// Exclude files that are not a result of direct dependencies but have to be there.
@ -293,9 +306,11 @@ configure(project(":solr")) {
}
}
// Disable validation for these projects (should it be disabled?)
// solr-ref-guide doesn't contribute any JARs to dependency checks.
configure(project(":solr:solr-ref-guide")) {
[validateJarLicenses, validateJarChecksums, updateChecksums].each { task ->
task.enabled = false
configurations {
jarValidation {
exclude group: "*"
}
}
}

View File

@ -1 +1 @@
485de3a253e23f645037828c07f1d7f1af40763a
485de3a253e23f645037828c07f1d7f1af40763a

View File

@ -1 +1 @@
94919d81969c67c5894646338bf10fbc35f5a946
94919d81969c67c5894646338bf10fbc35f5a946

View File

@ -1 +1 @@
32c9a9afe84eca86a3b0b3c66a956ced249ceade
32c9a9afe84eca86a3b0b3c66a956ced249ceade

View File

@ -1 +1 @@
2c8241f84acf6c924bd75be0dbd68e8d74fbcd70
2c8241f84acf6c924bd75be0dbd68e8d74fbcd70

View File

@ -1 +1 @@
302d0fe0abba26bbf5f31c3cd5337b3125c744e3
302d0fe0abba26bbf5f31c3cd5337b3125c744e3

View File

@ -1 +1 @@
7f13f63e2e213f6ea38364836408d2dc11f29804
7f13f63e2e213f6ea38364836408d2dc11f29804

View File

@ -1 +1 @@
bae68362b6020d6da93ad9abfa6a44edffb2b952
bae68362b6020d6da93ad9abfa6a44edffb2b952

View File

@ -1 +1 @@
df0250131a6e85e546ec5b1bf964f7f2ff3a42fc
df0250131a6e85e546ec5b1bf964f7f2ff3a42fc

View File

@ -1 +1 @@
d0c46320fbc07be3a24eb13a56cee4e3d38e0c75
d0c46320fbc07be3a24eb13a56cee4e3d38e0c75

View File

@ -1 +1 @@
bd47ad3bd14b8e82595c7adaa143501e60842a84
bd47ad3bd14b8e82595c7adaa143501e60842a84

View File

@ -1 +1 @@
f62cb75ed52455a9e68d1d05b84c500673340eb2
f62cb75ed52455a9e68d1d05b84c500673340eb2

View File

@ -1 +1 @@
f32e510b239620852fc9a2387fac41fd053d6a4d
f32e510b239620852fc9a2387fac41fd053d6a4d

View File

@ -1 +1 @@
6000774d7f8412ced005a704188ced78beeed2bb
6000774d7f8412ced005a704188ced78beeed2bb

View File

@ -1 +1 @@
814f5395cb0af71d6d7eb304a94a2c5365e4929c
814f5395cb0af71d6d7eb304a94a2c5365e4929c

View File

@ -1 +1 @@
bc7d7a74b2e5ead39ee3688f107bece3ad13eca6
bc7d7a74b2e5ead39ee3688f107bece3ad13eca6

View File

@ -1 +1 @@
539317dc171b8c92cca964e87686602800cf19b0
539317dc171b8c92cca964e87686602800cf19b0

View File

@ -1 +1 @@
decabb42b88a8d40c1894984f4af8adb833f766b
decabb42b88a8d40c1894984f4af8adb833f766b

View File

@ -1 +1 @@
2bf96b7aa8b611c177d329452af1dc933e14501c
2bf96b7aa8b611c177d329452af1dc933e14501c

View File

@ -1 +1 @@
3acb4705652e16236558f0f4f2192cc33c3bd189
3acb4705652e16236558f0f4f2192cc33c3bd189

View File

@ -1 +1 @@
8ad72fe39fa8c91eaaf12aadb21e0c3661fe26d5
8ad72fe39fa8c91eaaf12aadb21e0c3661fe26d5

View File

@ -1 +1 @@
54ebea0a5b653d3c680131e73fe807bb8f78c4ed
54ebea0a5b653d3c680131e73fe807bb8f78c4ed

View File

@ -1 +1 @@
6aac3c03d02dcab0d59f77ff00b682f5320e54e9
6aac3c03d02dcab0d59f77ff00b682f5320e54e9

View File

@ -1 +1 @@
1191f9f2bc0c47a8cce69193feb1ff0a8bcb37d5
1191f9f2bc0c47a8cce69193feb1ff0a8bcb37d5

View File

@ -1 +1 @@
d97d5b3f8b58c52730d47e1a63c8d3258f41ca6c
d97d5b3f8b58c52730d47e1a63c8d3258f41ca6c

View File

@ -1 +1 @@
8dfb9facd0830a27b1b5f29f84593f0aeee7773b
8dfb9facd0830a27b1b5f29f84593f0aeee7773b

View File

@ -1 +1 @@
04ff14d809195b711fd6bcc87e6777f886730ca1
04ff14d809195b711fd6bcc87e6777f886730ca1

View File

@ -1 +1 @@
2852e6e05fbb95076fc091f6d1780f1f8fe35e0f
2852e6e05fbb95076fc091f6d1780f1f8fe35e0f

View File

@ -1 +1 @@
6505a72a097d9270f7a9e7bf42c4238283247755
6505a72a097d9270f7a9e7bf42c4238283247755

View File

@ -1 +1 @@
f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f
f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f

View File

@ -1 +1 @@
e4ba98f1d4b3c80ec46392f25e094a6a2e58fcbf
e4ba98f1d4b3c80ec46392f25e094a6a2e58fcbf

View File

@ -1 +1 @@
ba72cf0c40cf701e972fe7720ae844629f4ecca2
ba72cf0c40cf701e972fe7720ae844629f4ecca2

View File

@ -1 +1 @@
a1974d9b3251c055408059b2f408d19d7db07224
a1974d9b3251c055408059b2f408d19d7db07224

View File

@ -1 +1 @@
d45229aee7d3f1f628a34fcac9b66ed5ba52c31f
d45229aee7d3f1f628a34fcac9b66ed5ba52c31f

View File

@ -1 +1 @@
1e6d5cf7b18a402f5d52785877010711538d68a0
1e6d5cf7b18a402f5d52785877010711538d68a0

View File

@ -1 +1 @@
3386abf821719bc89c7685f9eaafaf4a842f0199
3386abf821719bc89c7685f9eaafaf4a842f0199

View File

@ -1 +1 @@
0c26a897ae0d524809eef1c786cc6183b4ddcc3b
0c26a897ae0d524809eef1c786cc6183b4ddcc3b

View File

@ -1 +1 @@
4538cf5564ab3c262eec65c55fdb13965625589c
4538cf5564ab3c262eec65c55fdb13965625589c

View File

@ -1 +1 @@
e2543a63086b4189fbe418d05d56633bc1a815f7
e2543a63086b4189fbe418d05d56633bc1a815f7

View File

@ -1 +1 @@
a941956b3a4664d0cf728ece06ba25cc2110a3aa
a941956b3a4664d0cf728ece06ba25cc2110a3aa

View File

@ -1 +1 @@
566fd1d6b25012bb82078da08b82e6d0ba8c884a
566fd1d6b25012bb82078da08b82e6d0ba8c884a

View File

@ -1 +1 @@
3a4ccd3aa6ce33ec701893c3ee632eeb0e012c89
3a4ccd3aa6ce33ec701893c3ee632eeb0e012c89

View File

@ -1 +1 @@
6c57e4b22b44e89e548b5c9f70f0c45fe10fb0b4
6c57e4b22b44e89e548b5c9f70f0c45fe10fb0b4

View File

@ -1 +1 @@
275df2b5942c554ae3f3adf8483e81f5aec5ebc7
275df2b5942c554ae3f3adf8483e81f5aec5ebc7

View File

@ -1 +1 @@
b1b95aed9aa956ffb7d21e30a0415ca14d91c4ad
b1b95aed9aa956ffb7d21e30a0415ca14d91c4ad

View File

@ -1 +1 @@
f75a9b8c7868056325c1eba7be17e42628bc4a6f
f75a9b8c7868056325c1eba7be17e42628bc4a6f

View File

@ -1 +1 @@
e47a88c42c450e6e4b23bf951356c203cae2db24
e47a88c42c450e6e4b23bf951356c203cae2db24

View File

@ -1 +1 @@
2243629339302f74412f4bcb3777d0b248e86387
2243629339302f74412f4bcb3777d0b248e86387

View File

@ -1 +1 @@
a79e17c4d454cfb51b8d3307570ed84b1f7cc8f1
a79e17c4d454cfb51b8d3307570ed84b1f7cc8f1

View File

@ -1 +1 @@
c56a99b3043755b5506cfd85f11d53bd61652f3d
c56a99b3043755b5506cfd85f11d53bd61652f3d

View File

@ -1 +1 @@
f23cc3049750388d6f800f5aff276cc1aaed77b3
f23cc3049750388d6f800f5aff276cc1aaed77b3

View File

@ -1 +1 @@
ffc7ba8f289428b9508ab484b8001dea944ae603
ffc7ba8f289428b9508ab484b8001dea944ae603

View File

@ -1 +1 @@
195957160ed990dbc798207c0d577280d9919208
195957160ed990dbc798207c0d577280d9919208

View File

@ -1 +1 @@
12b3e2adda95e8c41d9d45d33db075137871d2e2
12b3e2adda95e8c41d9d45d33db075137871d2e2

View File

@ -1 +1 @@
2f043b2b3b9d27c17f2a067521dfb69b41fea1b8
2f043b2b3b9d27c17f2a067521dfb69b41fea1b8

View File

@ -1 +1 @@
81ac98f3be6a902e39e3f48496c9790dd02d4950
81ac98f3be6a902e39e3f48496c9790dd02d4950

View File

@ -1 +1 @@
916f481032995159d062ffc44f566891872d8a07
916f481032995159d062ffc44f566891872d8a07

View File

@ -1 +1 @@
cde2b06c3134600309061a84759d1ef9087a7348
cde2b06c3134600309061a84759d1ef9087a7348

View File

@ -1 +1 @@
41365c22bc6046af6e1e10f1be0b4dbfe49902be
41365c22bc6046af6e1e10f1be0b4dbfe49902be

View File

@ -1 +1 @@
1afe5621985efe90a92d0fbc9be86271efbe796f
1afe5621985efe90a92d0fbc9be86271efbe796f

View File

@ -1 +1 @@
acc54d9b28bdffe4bbde89ed2e4a1e86b5285e2b
acc54d9b28bdffe4bbde89ed2e4a1e86b5285e2b

View File

@ -1 +1 @@
164343da11db817e81e24e0d9869527e069850c9
164343da11db817e81e24e0d9869527e069850c9

View File

@ -1 +1 @@
7a4d00d5ec5febd252a6182e8b6e87a0a9821f81
7a4d00d5ec5febd252a6182e8b6e87a0a9821f81

View File

@ -1 +1 @@
70b5c26b52c120d2e94643717a764c4a67640fd6
70b5c26b52c120d2e94643717a764c4a67640fd6

View File

@ -1 +1 @@
8a422b016925475b2234b576a0f7ee3f55f1f9e2
8a422b016925475b2234b576a0f7ee3f55f1f9e2

View File

@ -1 +1 @@
dfe7134b759597276ff87b7acf662bef1c1c4fd8
dfe7134b759597276ff87b7acf662bef1c1c4fd8

View File

@ -1 +1 @@
e01cfd93b80d6773b3f757c78e756c9755b47b81
e01cfd93b80d6773b3f757c78e756c9755b47b81

View File

@ -1 +1 @@
4e2c5fa04648ec9772c63e2101c53af6504e624e
4e2c5fa04648ec9772c63e2101c53af6504e624e

View File

@ -1 +1 @@
1127c9cf62f2bb3121a3a2a0a1351d251a602117
1127c9cf62f2bb3121a3a2a0a1351d251a602117

View File

@ -1 +1 @@
e761e9b93d2da05e5ea1bc4deff1d75cb13b106b
e761e9b93d2da05e5ea1bc4deff1d75cb13b106b

View File

@ -1 +1 @@
9bd1a7f8268a436674a4f3210f11ef4eebe14d84
9bd1a7f8268a436674a4f3210f11ef4eebe14d84

View File

@ -1 +1 @@
fc934c7619ca7c626a7ce713646d8c43f8dca8bd
fc934c7619ca7c626a7ce713646d8c43f8dca8bd

View File

@ -1 +1 @@
dc4066e5b4532121b8e4d69124919376ab123940
dc4066e5b4532121b8e4d69124919376ab123940

View File

@ -1 +1 @@
0ddfd261063f2e6300e4c884aeef5f145dd0b38d
0ddfd261063f2e6300e4c884aeef5f145dd0b38d

View File

@ -1 +1 @@
ad31986653dac9cb5132ea5b2999c20b4b286255
ad31986653dac9cb5132ea5b2999c20b4b286255

View File

@ -1 +1 @@
59a83ca73c72a5e25b3f0b1bb305230a11000329
59a83ca73c72a5e25b3f0b1bb305230a11000329

View File

@ -1 +1 @@
9724dd44f1abbba99c9858aa05fc91d53f59e7a5
9724dd44f1abbba99c9858aa05fc91d53f59e7a5

View File

@ -1 +1 @@
3cd63d075497751784b2fa84be59432f4905bf7c
3cd63d075497751784b2fa84be59432f4905bf7c

View File

@ -1 +1 @@
e6a8629079856a2aa7862c6327ccf6dd1988d7fc
e6a8629079856a2aa7862c6327ccf6dd1988d7fc

View File

@ -1 +1 @@
6f14738ec2e9dd0011e343717fa624a10f8aab64
6f14738ec2e9dd0011e343717fa624a10f8aab64

View File

@ -1 +1 @@
1f41de81768ef84ca2d8cda4cb79e9272c8ee966
1f41de81768ef84ca2d8cda4cb79e9272c8ee966

View File

@ -1 +1 @@
2f19f1f7096d0fe3e09ae5698e4427114c23ad03
2f19f1f7096d0fe3e09ae5698e4427114c23ad03

View File

@ -1 +1 @@
4aa2da175202a62d62850ade7fb26a64fd451bc2
4aa2da175202a62d62850ade7fb26a64fd451bc2

View File

@ -1 +1 @@
d3e23487151f5393bdcef5449407c5ce29718cdc
d3e23487151f5393bdcef5449407c5ce29718cdc

View File

@ -1 +1 @@
7a999fbfb9905465c1494052b612b4a4bbb349b7
7a999fbfb9905465c1494052b612b4a4bbb349b7

View File

@ -1 +1 @@
aaacd77f8073e98f8400d042e70538623b3924ed
aaacd77f8073e98f8400d042e70538623b3924ed

View File

@ -1 +1 @@
09dd286abe644513305864453030e9c1631b5535
09dd286abe644513305864453030e9c1631b5535

View File

@ -1 +1 @@
69125cf74b07f1b9d60b5c94da47cb04c098f654
69125cf74b07f1b9d60b5c94da47cb04c098f654

View File

@ -1 +1 @@
12d71fe6d671c635f1ae6fd3c31bc6578a293c4b
12d71fe6d671c635f1ae6fd3c31bc6578a293c4b

View File

@ -1 +1 @@
d3f0b0fb016ef8d35ffb199d928ffbcbfa121c86
d3f0b0fb016ef8d35ffb199d928ffbcbfa121c86

View File

@ -1 +1 @@
dcb6d4d505ef74898e3a64a38c40195c01e97119
dcb6d4d505ef74898e3a64a38c40195c01e97119

View File

@ -1 +1 @@
22be18a055850a6cf3b0efd56c789c3929c87e98
22be18a055850a6cf3b0efd56c789c3929c87e98

View File

@ -1 +1 @@
7990b0f4e8cafe99b47148df9aa3276af336d4d5
7990b0f4e8cafe99b47148df9aa3276af336d4d5

View File

@ -1 +1 @@
9fa640d36c088cf55843900043d28aef830ade4d
9fa640d36c088cf55843900043d28aef830ade4d

View File

@ -1 +1 @@
7885cc3d5d7701a444acada7ab97f89846514875
7885cc3d5d7701a444acada7ab97f89846514875

View File

@ -1 +1 @@
ca1803fde51b795c0a8346ca8bc6277d9d04d01d
ca1803fde51b795c0a8346ca8bc6277d9d04d01d

View File

@ -1 +1 @@
b7bb7913d7583ee8d877f1c20feeb0905f342ad5
b7bb7913d7583ee8d877f1c20feeb0905f342ad5

View File

@ -1 +1 @@
ddb54190e858875fb681a6b9dd630a3609eaa513
ddb54190e858875fb681a6b9dd630a3609eaa513

View File

@ -1 +1 @@
3095acb088f4ff9e3fd9aedf98db73e3c18ea849
3095acb088f4ff9e3fd9aedf98db73e3c18ea849

View File

@ -1 +1 @@
968d70676fa16b3d62487987624dd4e9ce5db123
968d70676fa16b3d62487987624dd4e9ce5db123

Some files were not shown because too many files have changed in this diff Show More