2020-02-11 18:56:11 -05:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2020-02-13 05:18:01 -05:00
|
|
|
|
2020-02-11 18:56:11 -05:00
|
|
|
apply plugin: "de.undercouch.download"
|
|
|
|
|
|
|
|
configure(rootProject) {
|
2020-02-13 05:18:01 -05:00
|
|
|
ext {
|
|
|
|
momanDir = file("${buildDir}/moman")
|
2020-02-11 18:56:11 -05:00
|
|
|
}
|
|
|
|
|
2020-02-13 05:18:01 -05:00
|
|
|
task moman() {
|
|
|
|
description "Regenerate Moman-based sources for ...lucene/util/automaton and ...lucene/util/packed."
|
2020-02-11 18:56:11 -05:00
|
|
|
group "generation"
|
|
|
|
|
|
|
|
dependsOn ":lucene:core:utilGenPacked"
|
|
|
|
dependsOn ":lucene:core:utilGenLev"
|
|
|
|
}
|
|
|
|
|
2020-02-13 05:18:01 -05:00
|
|
|
task installMoman(type: Download) {
|
|
|
|
def momanZip = file("${momanDir}/moman.zip")
|
2020-02-11 18:56:11 -05:00
|
|
|
|
2020-02-20 21:27:38 -05:00
|
|
|
src "https://github.com/jpbarrette/moman/archive/497c90e34e412b6494db6dabf0d95db8034bd325.zip"
|
2020-02-13 05:18:01 -05:00
|
|
|
dest momanZip
|
|
|
|
onlyIfModified true
|
2020-02-11 18:56:11 -05:00
|
|
|
|
2020-02-13 05:18:01 -05:00
|
|
|
doLast {
|
|
|
|
ant.unzip(src: momanZip, dest: momanDir, overwrite: "true") {
|
|
|
|
ant.cutdirsmapper(dirs: "1")
|
|
|
|
}
|
2020-02-11 18:56:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
configure(project(":lucene:core")) {
|
2020-02-13 05:18:01 -05:00
|
|
|
task utilGenPacked(dependsOn: rootProject.installMoman) {
|
2020-02-11 18:56:11 -05:00
|
|
|
description "Regenerate util/PackedBulkOperationsPacked*.java and Packed64SingleBlock.java"
|
|
|
|
group "generation"
|
|
|
|
|
|
|
|
doLast {
|
2020-02-13 05:18:01 -05:00
|
|
|
def targetDir = file("src/java/org/apache/lucene/util/packed")
|
|
|
|
|
2020-02-11 18:56:11 -05:00
|
|
|
['gen_BulkOperation.py', 'gen_Packed64SingleBlock.py'].each { prog ->
|
2020-02-13 05:18:01 -05:00
|
|
|
logger.lifecycle("Executing: ${prog} in ${targetDir}")
|
2020-02-11 18:56:11 -05:00
|
|
|
project.exec {
|
2020-02-13 05:18:01 -05:00
|
|
|
workingDir targetDir
|
2020-02-20 21:27:38 -05:00
|
|
|
executable "python3"
|
2020-02-11 18:56:11 -05:00
|
|
|
args = ['-B', "${prog}"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Correct line endings for Windows.
|
|
|
|
project.ant.fixcrlf(
|
2020-02-13 05:18:01 -05:00
|
|
|
srcDir: targetDir,
|
2020-02-11 18:56:11 -05:00
|
|
|
includes: 'Packed64SingleBlock.java, BulkOperation*.java',
|
|
|
|
encoding: 'UTF-8',
|
|
|
|
eol: 'lf'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-13 05:18:01 -05:00
|
|
|
task utilGenLev(dependsOn: rootProject.installMoman) {
|
2020-02-11 18:56:11 -05:00
|
|
|
description "Regenerate util/automaton Lev*ParametricDescription.java"
|
|
|
|
group "generation"
|
|
|
|
|
|
|
|
doLast {
|
2020-02-13 05:18:01 -05:00
|
|
|
def targetDir = file("src/java/org/apache/lucene/util/automaton")
|
2020-02-11 18:56:11 -05:00
|
|
|
|
|
|
|
['1', '2'].each { num ->
|
|
|
|
['True', 'False'].each { transpose ->
|
|
|
|
project.exec {
|
2020-02-13 05:18:01 -05:00
|
|
|
workingDir targetDir
|
2020-02-20 21:27:38 -05:00
|
|
|
executable "python3"
|
2020-02-11 18:56:11 -05:00
|
|
|
args = ['-B', 'createLevAutomata.py', num, transpose, "${momanDir}/finenight/python"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
project.ant.fixcrlf(
|
2020-02-13 05:18:01 -05:00
|
|
|
srcDir: targetDir,
|
2020-02-11 18:56:11 -05:00
|
|
|
includes: '*ParametricDescription.java',
|
|
|
|
encoding: 'UTF-8',
|
|
|
|
eol: 'lf'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|