dweiss commented on code in PR #14764:
URL: https://github.com/apache/lucene/pull/14764#discussion_r2142114811


##########
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:
   I never understood why. When did it become an anti-pattern? Because from the 
start configuring projects like this was one of the features and strengths of 
this build system - pulling the common logic in one place and applying it to 
those projects that need it.
   
   I wonder, what is the alternative?



-- 
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

Reply via email to