LUCENE-9915: Add generation/ checksumming task for gen_ForUtil.py (#126)

This commit is contained in:
Dawid Weiss 2021-05-05 22:03:06 +02:00 committed by GitHub
parent a6cf46dada
commit aac6581f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 3 deletions

View File

@ -151,6 +151,7 @@ apply from: file('gradle/generation/kuromoji.gradle')
apply from: file('gradle/generation/nori.gradle')
apply from: file('gradle/generation/icu.gradle')
apply from: file('gradle/generation/javacc.gradle')
apply from: file('gradle/generation/forUtil.gradle')
apply from: file('gradle/datasets/external-datasets.gradle')

View File

@ -0,0 +1,69 @@
/*
* 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.
*/
// Regenerates "ForUtil.java" code used by codecs.
configure(project(":lucene:core")) {
task generateForUtilInternal() {
description "Regenerate gen_ForUtil.py"
group "generation"
def genDir = file("src/java/org/apache/lucene/codecs/lucene90")
def genScript = file("${genDir}/gen_ForUtil.py")
def genOutput = file("${genDir}/ForUtil.java")
inputs.file genScript
outputs.file genOutput
doLast {
quietExec {
workingDir genDir
executable project.externalTool("python3")
args = []
}
}
}
regenerate.dependsOn wrapWithPersistentChecksums(generateForUtilInternal, [ andThenTasks: ["spotlessJava", "spotlessJavaApply"] ])
}
configure(project(":lucene:backward-codecs")) {
task generateForUtilInternal() {
description "Regenerate gen_ForUtil.py"
group "generation"
def genDir = file("src/java/org/apache/lucene/backward_codecs/lucene84")
def genScript = file("${genDir}/gen_ForUtil.py")
def genOutput = file("${genDir}/ForUtil.java")
inputs.file genScript
outputs.file genOutput
doLast {
quietExec {
workingDir genDir
executable project.externalTool("python3")
args = []
}
}
}
regenerate.dependsOn wrapWithPersistentChecksums(generateForUtilInternal, [ andThenTasks: ["spotlessJava", "spotlessJavaApply"] ])
}

View File

@ -64,11 +64,12 @@ def computeChecksummedEntries = { Task sourceTask ->
configure([
project(":lucene:analysis:common"),
project(":lucene:core"),
project(":lucene:analysis:icu"),
project(":lucene:queryparser"),
project(":lucene:analysis:kuromoji"),
project(":lucene:analysis:nori")
project(":lucene:analysis:nori"),
project(":lucene:backward-codecs"),
project(":lucene:core"),
project(":lucene:queryparser"),
]) {
task regenerate() {
description "Rerun any code or static data generation tasks."

View File

@ -0,0 +1,4 @@
{
"lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/ForUtil.java": "59319f493441c05e84ca9077a9f3bf98b6eb8c7e",
"lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/gen_ForUtil.py": "96635fbbf3270b6cb25237b8c01e068ecad0d2ce"
}

View File

@ -0,0 +1,4 @@
{
"lucene/core/src/java/org/apache/lucene/codecs/lucene90/ForUtil.java": "f2091e2b7284b70c740052a9b0ee389e67eb48a9",
"lucene/core/src/java/org/apache/lucene/codecs/lucene90/gen_ForUtil.py": "69b6fcb95fc127a5cd29a40e4454048f56570a26"
}