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.
|
|
|
|
*/
|
2024-06-17 03:49:21 -04:00
|
|
|
apply plugin: deps.plugins.undercouch.download.get().pluginId
|
2020-02-11 18:56:11 -05:00
|
|
|
|
2021-04-02 03:56:47 -04:00
|
|
|
def resources = scriptResources(buildscript)
|
|
|
|
|
2021-03-23 04:25:53 -04:00
|
|
|
configure(project(":lucene:core")) {
|
2020-02-13 05:18:01 -05:00
|
|
|
ext {
|
2021-04-02 03:56:47 -04:00
|
|
|
momanSource = "https://github.com/jpbarrette/moman/archive/497c90e34e412b6494db6dabf0d95db8034bd325.zip"
|
2020-02-13 05:18:01 -05:00
|
|
|
momanDir = file("${buildDir}/moman")
|
2020-02-11 18:56:11 -05:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2021-04-02 03:56:47 -04:00
|
|
|
src momanSource
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-16 16:35:51 -04:00
|
|
|
task utilGenPackedInternal(dependsOn: installMoman) {
|
2021-04-02 03:56:47 -04:00
|
|
|
def targetDir = file("src/java/org/apache/lucene/util/packed")
|
2020-02-11 18:56:11 -05:00
|
|
|
|
2022-07-30 14:45:32 -04:00
|
|
|
def templateFiles = [
|
|
|
|
file("${resources}/gen_BulkOperation.py"),
|
|
|
|
file("${resources}/gen_Packed64SingleBlock.py")
|
|
|
|
]
|
|
|
|
|
2021-04-02 03:56:47 -04:00
|
|
|
inputs.property("source", momanSource)
|
2022-07-30 14:45:32 -04:00
|
|
|
inputs.files templateFiles
|
2021-04-02 03:56:47 -04:00
|
|
|
outputs.files fileTree(dir: targetDir, includes: ["Packed64SingleBlock.java", "BulkOperation*.java"])
|
2020-02-13 05:18:01 -05:00
|
|
|
|
2021-04-02 03:56:47 -04:00
|
|
|
doLast {
|
2022-07-30 14:45:32 -04:00
|
|
|
templateFiles.each { prog ->
|
2020-02-13 05:18:01 -05:00
|
|
|
logger.lifecycle("Executing: ${prog} in ${targetDir}")
|
2021-03-30 08:38:13 -04:00
|
|
|
quietExec {
|
2020-02-13 05:18:01 -05:00
|
|
|
workingDir targetDir
|
2020-08-30 11:10:18 -04:00
|
|
|
executable project.externalTool("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'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-16 16:35:51 -04:00
|
|
|
task utilGenLevInternal(dependsOn: installMoman) {
|
2021-04-02 03:56:47 -04:00
|
|
|
def targetDir = file("src/java/org/apache/lucene/util/automaton")
|
2020-02-11 18:56:11 -05:00
|
|
|
|
2022-07-30 14:45:32 -04:00
|
|
|
def templateFile = file("${resources}/createLevAutomata.py")
|
|
|
|
|
2021-04-02 03:56:47 -04:00
|
|
|
inputs.property("source", momanSource)
|
2022-07-30 14:45:32 -04:00
|
|
|
inputs.file templateFile
|
2021-04-02 03:56:47 -04:00
|
|
|
outputs.files fileTree(dir: targetDir, includes: ["*ParametricDescription.java"])
|
2020-02-11 18:56:11 -05:00
|
|
|
|
2021-04-02 03:56:47 -04:00
|
|
|
doLast {
|
2020-02-11 18:56:11 -05:00
|
|
|
['1', '2'].each { num ->
|
|
|
|
['True', 'False'].each { transpose ->
|
2021-03-30 08:38:13 -04:00
|
|
|
quietExec {
|
2020-02-13 05:18:01 -05:00
|
|
|
workingDir targetDir
|
2020-08-30 11:10:18 -04:00
|
|
|
executable project.externalTool("python3")
|
2021-04-02 03:56:47 -04:00
|
|
|
args = ['-B',
|
2022-07-30 14:45:32 -04:00
|
|
|
templateFile.toString(),
|
2021-04-02 03:56:47 -04:00
|
|
|
num,
|
|
|
|
transpose,
|
|
|
|
"${momanDir}/finenight/python"]
|
2020-02-11 18:56:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2020-12-23 06:41:23 -05:00
|
|
|
|
2021-03-23 04:25:53 -04:00
|
|
|
task moman() {
|
|
|
|
description "Regenerate Moman-based sources."
|
2020-02-11 18:56:11 -05:00
|
|
|
group "generation"
|
2020-12-23 06:41:23 -05:00
|
|
|
|
2024-04-09 01:44:07 -04:00
|
|
|
def extraConfig = [
|
|
|
|
andThenTasks: ["spotlessJava", "spotlessJavaApply"],
|
|
|
|
mustRunBefore: [ "compileJava" ]
|
|
|
|
]
|
|
|
|
|
|
|
|
dependsOn wrapWithPersistentChecksums(utilGenPackedInternal, extraConfig)
|
|
|
|
dependsOn wrapWithPersistentChecksums(utilGenLevInternal, extraConfig)
|
2020-12-23 06:41:23 -05:00
|
|
|
}
|
|
|
|
|
2021-04-02 03:56:47 -04:00
|
|
|
regenerate.dependsOn moman
|
2020-02-11 18:56:11 -05:00
|
|
|
}
|