dweiss commented on a change in pull request #1262: LUCENE-9220: regenerate all stemmers/stopwords/test data from snowball 2.0 URL: https://github.com/apache/lucene-solr/pull/1262#discussion_r380175386
########## File path: gradle/generation/snowball.gradle ########## @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: "de.undercouch.download" + +configure(rootProject) { + ext { + snowballWorkDir = file("${buildDir}/snowball") + snowballStemmerDir = file("${buildDir}/snowball/stemmers") + snowballPatchedDir = file("${buildDir}/snowball/patched") + snowballWebsiteDir = file("${buildDir}/snowball/website") + snowballDataDir = file("${buildDir}/snowball/data") + } + + task snowball() { + description "Regenerate snowball-based sources, stopwords, and tests for ...lucene/analysis." + group "generation" + + dependsOn ":lucene:analysis:common:snowballGen" + } + + task downloadSnowballStemmers(type: Download) { + def stemmerZip = file("${snowballWorkDir}/stemmers.zip") + + src "https://github.com/snowballstem/snowball/archive/53739a805cfa6c77ff8496dc711dc1c106d987c1.zip" + dest stemmerZip + onlyIfModified true + useETag "all" + cachedETagsFile file("${snowballWorkDir}/stemmers.json") + + doLast { + ant.unzip(src: stemmerZip, dest: snowballStemmerDir, overwrite: "true") { + ant.cutdirsmapper(dirs: "1") + } + } + } + + task downloadSnowballWebsite(type: Download) { + def websiteZip = file("${snowballWorkDir}/website.zip") + + src "https://github.com/snowballstem/snowball-website/archive/ff891e74f08e7315523ee3c0cad55bb1b7831b9d.zip" + dest websiteZip + onlyIfModified true + useETag "all" + cachedETagsFile file("${snowballWorkDir}/website.json") + + doLast { + ant.unzip(src: websiteZip, dest: snowballWebsiteDir, overwrite: "true") { + ant.cutdirsmapper(dirs: "1") + } + } + } + + task downloadSnowballData(type: Download) { + def dataZip = file("${snowballWorkDir}/data.zip") + + src "https://github.com/snowballstem/snowball-data/archive/9145f8732ec952c8a3d1066be251da198a8bc792.zip" + dest dataZip + onlyIfModified true + useETag "all" + cachedETagsFile file("${snowballWorkDir}/data.json") + + doLast { + ant.unzip(src: dataZip, dest: snowballDataDir, overwrite: "true") { + ant.cutdirsmapper(dirs: "1") + } + } + } + + task cleanSnowballCheckout(type: Delete) { + dependsOn downloadSnowballStemmers + delete snowballPatchedDir + } + + task patchSnowball(type: Copy) { + dependsOn cleanSnowballCheckout + + from fileTree(snowballStemmerDir) { + include '**/*' + } + into snowballPatchedDir + + doLast { + ant.patch(patchfile: rootProject.file("gradle/generation/snowball.patch"), dir: snowballPatchedDir, strip: "1") Review comment: I know it doesn't download twice but if it declared inputs/ outputs or upToDateWhen correctly then it shouldn't run any actions attached to the task (doFirst/ doLast) and it does it now, regardless of whether it downloaded the artifact or not, right (that was my impression from other sections of the code, no this patch). Anyway, if it's working then fine. As for different versions of patch -- throw git/ jgit's implementation in the mix... they all seem to be behaving differently in corner cases. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org