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 2021/02/13 05:12:37 UTC

[GitHub] [lucene-solr] rmuir commented on a change in pull request #2362: LUCENE-9767: infrastructure for icu regeneration in place.

rmuir commented on a change in pull request #2362:
URL: https://github.com/apache/lucene-solr/pull/2362#discussion_r575622281



##########
File path: gradle/generation/icu.gradle
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+/* NOTE: when regenerating, you need icu4c binaries in PATH.
+ * The icu4c version must match exactly the icu4j version in version.props:
+ * The one on your system is probably different.
+ *
+ * You can download the C sources to a standalone folder with these steps:
+ * (example for icu 62.2)
+ *
+ * # download version matching icu4j version in version.props
+ * curl -fLO https://github.com/unicode-org/icu/releases/download/release-62-2/icu4c-62_2-src.tgz
+ * # extract
+ * tar -zxvf icu4c-62_2-src.tgz
+ * # compile
+ * (cd icu/source && ./configure --prefix=$(pwd) --enable-rpath && make -j4)
+ * # test binaries work
+ * icu/source/bin/derb -V
+ * # put in PATH
+ * export PATH=$(pwd)/icu/source/bin:$PATH
+ */
+configure(project(":lucene:analysis:icu")) {
+  def utr30DataDir = file("src/data/utr30")
+
+  task genUtr30DataFiles() {
+    // May be undefined yet, so use a provider.
+    dependsOn { sourceSets.tools.runtimeClasspath }
+
+    doFirst {
+      // all these steps must be done sequentially: it's a pipeline resulting in utr30.nrm
+      project.javaexec {
+        main = "org.apache.lucene.analysis.icu.GenerateUTR30DataFiles"
+        classpath = sourceSets.tools.runtimeClasspath
+
+        ignoreExitValue false
+        workingDir utr30DataDir
+      }
+
+      def gennorm = 'gennorm2'
+      def icupkg = 'icupkg'
+      project.exec {
+        executable gennorm
+        ignoreExitValue = false
+        args = [
+            "-v",
+            "-s",
+            utr30DataDir,
+            "-o",
+            "${buildDir}/utr30.tmp",
+            "nfc.txt", "nfkc.txt", "nfkc_cf.txt", "BasicFoldings.txt",
+            "DiacriticFolding.txt", "DingbatFolding.txt", "HanRadicalFolding.txt",
+            "NativeDigitFolding.txt"
+        ]
+      }
+      project.exec {
+        executable icupkg
+        ignoreExitValue = false
+        args = [
+            "-tb",
+            "${buildDir}/utr30.tmp",
+            "src/resources/org/apache/lucene/analysis/icu/utr30.nrm"
+        ]
+      }
+    }
+  }
+
+  task genRbbi() {
+    // May be undefined yet, so use a provider.
+    dependsOn { sourceSets.tools.runtimeClasspath }
+
+    doFirst {
+      project.javaexec {
+        main = "org.apache.lucene.analysis.icu.RBBIRuleCompiler"
+        classpath = sourceSets.tools.runtimeClasspath
+
+        ignoreExitValue false
+        enableAssertions true
+        args = [
+            "src/data/uax29",
+            "src/resources/org/apache/lucene/analysis/icu/segmentation"
+        ]
+      }
+    }
+  }
+
+  task regenerate() {
+    dependsOn genUtr30DataFiles

Review comment:
       thats right. the RBBI one is pure java. we can do it in parallel alongside the other one.




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



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