breskeby commented on code in PR #14764: URL: https://github.com/apache/lucene/pull/14764#discussion_r2142088147
########## build-tools/build-infra/src/main/groovy/lucene.datasets.external-datasets.gradle: ########## @@ -17,41 +15,40 @@ import java.nio.file.Files * limitations under the License. */ -buildscript { - repositories { - mavenCentral() - } +import java.nio.file.Files +import com.github.luben.zstd.ZstdInputStream +import de.undercouch.gradle.tasks.download.Download +import org.apache.lucene.gradle.datasets.ExtractReuters - dependencies { - classpath deps.zstd - } +// tasks that download various benchmark/test data sets from the internet. + +// TODO: not sure whether this should live in benchmarks, but for now let it be. + +if (project != project.rootProject) { + throw new GradleException("Applicable to rootProject only: " + project.path) } -def unzstd(java.nio.file.Path src, java.nio.file.Path dst) { - try (InputStream is = new com.github.luben.zstd.ZstdInputStream(new BufferedInputStream(Files.newInputStream(src))); - OutputStream os = new BufferedOutputStream(Files.newOutputStream(dst))) { - is.transferTo(os) +def static unzstd(java.nio.file.Path src, java.nio.file.Path dst) { + new ZstdInputStream(new BufferedInputStream(Files.newInputStream(src))).withCloseable { is -> + new BufferedOutputStream(Files.newOutputStream(dst)).withCloseable { os -> + is.transferTo(os) + } } } - -// TODO: not sure whether this should live in benchmarks, but for now let it be. configure(project(":lucene:benchmark")) { Review Comment: this is quite an anti pattern in gradle. Maybe out of scope but definitely something to fix later. this will break isolated projects and configuration cache I think and should live in the benchmark gradle script. -- 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. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org