You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/24 15:22:00 UTC
[lucene] 03/06: Correct snowball download/unzip sequence to be
always consistent.
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit bb5db1e16deb91708b70cd46a642e42208d6718d
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Wed Mar 24 15:16:12 2021 +0100
Correct snowball download/unzip sequence to be always consistent.
---
gradle/generation/snowball.gradle | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/gradle/generation/snowball.gradle b/gradle/generation/snowball.gradle
index 7a5adf8..5f2ff71 100644
--- a/gradle/generation/snowball.gradle
+++ b/gradle/generation/snowball.gradle
@@ -38,19 +38,27 @@ configure(project(":lucene:analysis:common")) {
snowballScript = rootProject.file("gradle/generation/snowball.sh")
}
+ def unpackFromZip = { zipFile, targetDir ->
+ project.sync {
+ from(zipTree(zipFile), {
+ eachFile { fcd ->
+ fcd.relativePath = new RelativePath(true, fcd.relativePath.segments.drop(1))
+ }
+ })
+ into targetDir
+ }
+ }
+
// downloads snowball stemmers (or use cached copy)
task downloadSnowballStemmers(type: Download) {
inputs.file(snowballPatchFile)
src "https://github.com/snowballstem/snowball/archive/${snowballStemmerCommit}.zip"
- def snowballStemmerZip = file("${snowballStemmerDir}.zip")
- dest snowballStemmerZip
+ dest file("${snowballStemmerDir}.zip")
overwrite false
tempAndMove true
doLast {
- ant.unzip(src: snowballStemmerZip, dest: snowballStemmerDir, overwrite: "true") {
- ant.cutdirsmapper(dirs: "1")
- }
+ unpackFromZip(dest, snowballStemmerDir)
ant.patch(patchfile: snowballPatchFile, dir: snowballStemmerDir, strip: "1", failonerror: true)
}
}
@@ -64,9 +72,7 @@ configure(project(":lucene:analysis:common")) {
tempAndMove true
doLast {
- ant.unzip(src: snowballWebsiteZip, dest: snowballWebsiteDir, overwrite: "true") {
- ant.cutdirsmapper(dirs: "1")
- }
+ unpackFromZip(snowballWebsiteZip, snowballWebsiteDir)
}
}
@@ -79,9 +85,7 @@ configure(project(":lucene:analysis:common")) {
tempAndMove true
doLast {
- ant.unzip(src: snowballDataZip, dest: snowballDataDir, overwrite: "true") {
- ant.cutdirsmapper(dirs: "1")
- }
+ unpackFromZip(snowballDataZip, snowballDataDir)
}
}
@@ -90,11 +94,11 @@ configure(project(":lucene:analysis:common")) {
description "Regenerates snowball stemmers."
group "generation"
- // Don't even bother adding dependencies.
+ // Don't even bother adding dependencies on Windows.
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
doFirst {
// Just emit a big fat error message but don't fail the build.
- logger.error("Snowball generation does not work on Windows, use a platform where bash is available.")
+ logger.error("Snowball generation does not work on Windows (patch and bash must be available).")
}
} else {
dependsOn downloadSnowballStemmers