mirror of https://github.com/apache/lucene.git
Correct soft task ordering between tidy and any other dependency of regenerate.
This commit is contained in:
parent
bb5db1e16d
commit
4c2de7ef43
|
@ -134,7 +134,7 @@ configure(project(":lucene:analysis:common")) {
|
||||||
heapSize = "12g"
|
heapSize = "12g"
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
logger.lifecycle("Regenerating UAX29URLEmailTokenizerImpl. This may take a long time (and requires tons of memory).")
|
logger.lifecycle("Regenerating UAX29URLEmailTokenizerImpl. This may take a long time (and requires ${heapSize} of memory!).")
|
||||||
}
|
}
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
|
|
|
@ -30,12 +30,26 @@ configure([
|
||||||
group "generation"
|
group "generation"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure tidy dependency runs after any other generation task.
|
// Make sure 'tidy' and its dependencies run after any other task in the dependencies
|
||||||
|
// of 'regenerate'. This ensures proper execution ordering so that tidy tasks run
|
||||||
|
// after whatever has been generated is complete.
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
Set<Task> deps = regenerate.getTaskDependencies().getDependencies(regenerate)
|
Set<Task> deps = regenerate.getTaskDependencies().getDependencies(regenerate)
|
||||||
def tidy = deps.find { it.name == "tidy" }
|
def tidy = deps.find { it.name == "tidy" }
|
||||||
if (tidy) {
|
if (tidy) {
|
||||||
tidy.mustRunAfter (deps - [tidy])
|
TaskDependency dep = tidy.taskDependencies
|
||||||
|
Set<Task> visited = new HashSet<>()
|
||||||
|
Queue<Task> queue = new ArrayDeque<>()
|
||||||
|
queue.add(tidy)
|
||||||
|
while (!queue.isEmpty()) {
|
||||||
|
Task t = queue.removeFirst()
|
||||||
|
if (visited.add(t)) {
|
||||||
|
queue.addAll(dep.getDependencies(t))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def otherDeps = deps - [tidy]
|
||||||
|
visited.each { Task t -> t.mustRunAfter(otherDeps) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue