You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/02/10 21:40:55 UTC

[GitHub] [lucene-solr] madrob commented on a change in pull request #1248: LUCENE-9134: Port ant-regenerate tasks to Gradle build

madrob commented on a change in pull request #1248: LUCENE-9134: Port ant-regenerate tasks to Gradle build
URL: https://github.com/apache/lucene-solr/pull/1248#discussion_r377327836
 
 

 ##########
 File path: gradle/generation/util.gradle
 ##########
 @@ -0,0 +1,107 @@
+/*
+ * 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) {
+  configurations {
+    utilgen
+  }
+
+  dependencies {
+  }
+
+  task utilgen {
+    description "Regenerate sources for ...lucene/util/automaton and ...lucene/util/packed."
+    group "generation"
+
+    dependsOn ":lucene:core:utilGenPacked"
+    dependsOn ":lucene:core:utilGenLev"
+  }
+}
+
+
+task installMoman(type: Download) {
+  def momanDir = new File(buildDir, "moman").getAbsolutePath()
+  def momanZip = new File(momanDir, "moman.zip").getAbsolutePath()
+
+  src "https://bitbucket.org/jpbarrette/moman/get/5c5c2a1e4dea.zip"
+  dest momanZip
+  onlyIfModified true
+
+  doLast {
+    logger.lifecycle("Downloading moman to: ${buildDir}")
+    ant.unzip(src: momanZip, dest: momanDir, overwrite: "true") {
+      ant.cutdirsmapper(dirs: "1")
+    }
+  }
+}
+
+configure(project(":lucene:core")) {
+  task utilGenPacked(dependsOn: installMoman) {
+    description "Regenerate util/PackedBulkOperationsPacked*.java and Packed64SingleBlock.java"
+    group "generation"
+
+    def workDir = "src/java/org/apache/lucene/util/packed"
+
+    doLast {
+      ['gen_BulkOperation.py', 'gen_Packed64SingleBlock.py'].each { prog ->
+        logger.lifecycle("Executing: ${prog} in ${workDir}")
+        project.exec {
+          workingDir workDir
+          executable "python"
+          args = ['-B', "${prog}"]
+        }
+      }
+      // Correct line endings for Windows.
+      ['Packed64SingleBlock.java', 'BulkOperation*.java'].each { files ->
+        project.ant.fixcrlf(
+            srcDir: workDir,
+            includes: files,
+            encoding: 'UTF-8',
+            eol: 'lf'
+        )
+      }
+    }
+  }
+}
+
+configure(project(":lucene:core")) {
 
 Review comment:
   I think you can combine this with the previous configure block, I don't think separating them adds readability. Let me know if you did this intentionally though

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org