2020-05-20 10:23:24 -04: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.
|
|
|
|
*/
|
|
|
|
|
2021-03-30 04:55:19 -04:00
|
|
|
def resources = scriptResources(buildscript)
|
|
|
|
|
|
|
|
configure(project(':lucene:documentation')) {
|
|
|
|
task checkBrokenLinks(type: CheckBrokenLinksTask) {
|
2020-05-20 10:23:24 -04:00
|
|
|
group 'Verification'
|
|
|
|
description 'Check broken links in the entire documentation'
|
2021-03-30 04:55:19 -04:00
|
|
|
dependsOn 'documentation'
|
2020-05-20 10:23:24 -04:00
|
|
|
|
2021-03-30 04:55:19 -04:00
|
|
|
validationScript = file("${resources}/checkJavadocLinks.py")
|
|
|
|
docsDir.fileProvider(provider { -> file(project.docroot) })
|
|
|
|
output = project.file("${buildDir}/check-broken-links-output.txt")
|
2020-05-20 10:23:24 -04:00
|
|
|
}
|
2020-08-29 09:28:03 -04:00
|
|
|
|
|
|
|
check.dependsOn checkBrokenLinks
|
2020-05-20 10:23:24 -04:00
|
|
|
}
|
|
|
|
|
2021-10-18 10:13:15 -04:00
|
|
|
@CacheableTask
|
2020-05-20 10:23:24 -04:00
|
|
|
class CheckBrokenLinksTask extends DefaultTask {
|
|
|
|
// wraps input directory location in DirectoryProperty so as to lazily evaluate 'docroot' property
|
|
|
|
// (see gradle/documentation/documentation.gradle)
|
|
|
|
@InputDirectory
|
2021-10-18 10:13:15 -04:00
|
|
|
@PathSensitive(PathSensitivity.RELATIVE)
|
|
|
|
@IgnoreEmptyDirectories
|
2020-05-20 10:23:24 -04:00
|
|
|
final DirectoryProperty docsDir = project.objects.directoryProperty()
|
|
|
|
|
|
|
|
@InputFile
|
2021-10-18 10:13:15 -04:00
|
|
|
@PathSensitive(PathSensitivity.RELATIVE)
|
2021-03-30 04:55:19 -04:00
|
|
|
File validationScript
|
|
|
|
|
|
|
|
@OutputFile
|
|
|
|
File output
|
2020-05-20 10:23:24 -04:00
|
|
|
|
|
|
|
@TaskAction
|
|
|
|
def check() {
|
2021-03-30 08:38:13 -04:00
|
|
|
project.quietExec {
|
|
|
|
executable project.externalTool("python3")
|
|
|
|
ignoreExitValue = false
|
|
|
|
args = [
|
|
|
|
"-B",
|
|
|
|
validationScript.absolutePath,
|
|
|
|
docsDir.get().getAsFile()
|
|
|
|
]
|
2020-05-20 10:23:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|