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


##########
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:
   Right - if there are project-specific blocks (not just 'all-java-projects' 
but project-path specific blocks) then indeed this will require a review of all 
build files. I don't know if this is solvable. It's an orthogonal approach to 
having to configure most things per-project. A matter of taste, I guess.



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