diff --git a/gradle/documentation/changes-to-html.gradle b/gradle/documentation/changes-to-html.gradle index b49ae93e5da..49003796a74 100644 --- a/gradle/documentation/changes-to-html.gradle +++ b/gradle/documentation/changes-to-html.gradle @@ -15,21 +15,32 @@ * limitations under the License. */ -configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) { - task changesToHtml(type: ChangesToHtmlTask) +def resources = scriptResources(buildscript) + +configure(subprojects.findAll { it.path == ':lucene:documentation' || it.path == ':solr:documentation' }) { + task changesToHtml(type: ChangesToHtmlTask) { + siteDir = resources + script = file("${resources}/changes2html.pl") + } } // compile changes.txt into an html file class ChangesToHtmlTask extends DefaultTask { - @Input - File changesFile = project.file("CHANGES.txt") + @Internal + Project productProject = project.parent - @Input - File changesDoapFile = project.rootProject.file("dev-tools/doap/${project.name}.rdf") + @Internal + String productName = productProject.name + + @InputFile + File changesFile = productProject.file('CHANGES.txt') + + @InputFile + File changesDoapFile = project.rootProject.file("dev-tools/doap/${productName}.rdf") @InputDirectory - File siteDir = project.rootProject.file("lucene/site/changes") + File siteDir @OutputDirectory final DirectoryProperty targetDir = project.objects.directoryProperty() @@ -39,11 +50,11 @@ class ChangesToHtmlTask extends DefaultTask { def luceneDocUrl = "${->project.luceneDocUrl}" @InputFile - def script = project.rootProject.file("${siteDir}/changes2html.pl") + def script def loadVersions(File outfile) { // load version properties from DOAP RDF - def prefix = "doap.${project.name}".toString() + def prefix = "doap.${productName}".toString() ant.xmlproperty(keeproot: false, file: changesDoapFile, collapseAttributes: false, prefix: "${prefix}") outfile.withWriter("UTF-8") { writer -> writer.println(ant.properties["${prefix}.Project.release.Version.revision"]) @@ -63,7 +74,7 @@ class ChangesToHtmlTask extends DefaultTask { args += [ "-CSD", script, - "${project.name}", + "${productName}", versionsFile.toString(), luceneDocUrl.concat('/') // slash required at end by perl script ] diff --git a/lucene/site/changes/ChangesFancyStyle.css b/gradle/documentation/changes-to-html/ChangesFancyStyle.css similarity index 100% rename from lucene/site/changes/ChangesFancyStyle.css rename to gradle/documentation/changes-to-html/ChangesFancyStyle.css diff --git a/lucene/site/changes/ChangesFixedWidthStyle.css b/gradle/documentation/changes-to-html/ChangesFixedWidthStyle.css similarity index 100% rename from lucene/site/changes/ChangesFixedWidthStyle.css rename to gradle/documentation/changes-to-html/ChangesFixedWidthStyle.css diff --git a/lucene/site/changes/ChangesSimpleStyle.css b/gradle/documentation/changes-to-html/ChangesSimpleStyle.css similarity index 100% rename from lucene/site/changes/ChangesSimpleStyle.css rename to gradle/documentation/changes-to-html/ChangesSimpleStyle.css diff --git a/lucene/site/changes/changes2html.pl b/gradle/documentation/changes-to-html/changes2html.pl old mode 100755 new mode 100644 similarity index 100% rename from lucene/site/changes/changes2html.pl rename to gradle/documentation/changes-to-html/changes2html.pl diff --git a/gradle/documentation/documentation.gradle b/gradle/documentation/documentation.gradle index 242b26a0f71..3c5262472a9 100644 --- a/gradle/documentation/documentation.gradle +++ b/gradle/documentation/documentation.gradle @@ -23,7 +23,7 @@ configure(rootProject) { luceneDocUrl = project.propertyOrDefault('lucene.javadoc.url', { if (project.version != project.baseVersion) { // non-release build - project('lucene').file('build/documentation').toURI().toASCIIString() + new File(project('lucene:documentation').buildDir, 'site').toURI().toASCIIString().minus(~'/$') } else { // release build "https://lucene.apache.org/core/${urlVersion}" @@ -33,7 +33,7 @@ configure(rootProject) { solrDocUrl = project.propertyOrDefault('solr.javadoc.url', { if (project.version != project.baseVersion) { // non-release build - project('solr').file('build/documentation').toURI().toASCIIString() + new File(project('solr:documentation').buildDir, 'site').toURI().toASCIIString().minus(~'/$') } else { // release build "https://lucene.apache.org/solr/${urlVersion}" @@ -47,26 +47,27 @@ configure(rootProject) { group = 'documentation' description = 'Generate all documentation' - dependsOn ':lucene:documentation' - dependsOn ':solr:documentation' + dependsOn ':lucene:documentation:assemble' + dependsOn ':solr:documentation:assemble' } } // docroot will point to Lucene and Solr relative directory for each sub-project. -configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) { +configure(subprojects.findAll { it.path == ':lucene:documentation' || it.path == ':solr:documentation' }) { + ext { - docroot = file("${buildDir}/documentation") + docroot = file("${buildDir}/site") + docrootMinimal = file("${buildDir}/minimalSite") + + markdownSrc = file("src/markdown") + assets = file("src/assets") } - configurations { - docs - } - task documentation() { group = 'documentation' description = "Generate ${project.name.capitalize()} documentation" - dependsOn subprojects.collect { prj -> + dependsOn project.parent.subprojects.collect { prj -> prj.tasks.matching { it.name == 'renderSiteJavadoc' } } dependsOn 'changesToHtml','copyDocumentationAssets', @@ -75,55 +76,68 @@ configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) { task copyDocumentationAssets(type: Copy) { includeEmptyDirs = false - from('site/html') // lucene - from('site/assets') // solr + from(project.assets) into project.docroot } - - artifacts { - docs project.docroot, { - builtBy documentation - } - } -} - -configure(project(':solr')) { - ext { - // required for the "simple" Solr docs shipped in tgz/zip files, only referring to online web pages: - docrootOnline = file("${buildDir}/docs-online") + + assemble { + dependsOn documentation } configurations { - docsOnline + site } - documentation { - // for Solr we also have a page shipped with zip/tgz that just points to online web pages: - dependsOn 'documentationOnline' + artifacts { + site project.docroot, { + builtBy documentation + } } - - task documentationOnline() { + +} + +configure(project(':solr:documentation')) { + + task documentationMinimal() { group = 'documentation' description = "Generate stub Solr documentation pointing to web page (that's part of Solr TGZ)" - dependsOn 'copyOnlineDocumentationAssets','createOnlineDocumentationIndex','copyChangesToHtmlForOnline' + dependsOn 'copyMiniDocumentationAssets','createMiniDocumentationIndex','copyChangesToHtmlForMiniSite' } - - task copyChangesToHtmlForOnline(type: Copy) { + + task copyChangesToHtmlForMiniSite(type: Copy) { from project.docroot - into project.docrootOnline + into project.docrootMinimal include 'changes/**' dependsOn 'changesToHtml' } - - task copyOnlineDocumentationAssets(type: Copy) { + + task copyMiniDocumentationAssets(type: Copy) { includeEmptyDirs = false - from('site/assets') - into project.docrootOnline + from('src/assets') + into project.docrootMinimal } + assemble { + dependsOn documentationMinimal + } + + configurations { + minimalSite + } + artifacts { - docsOnline project.docrootOnline, { - builtBy documentationOnline + minimalSite project.docrootMinimal, { + builtBy documentationMinimal } } + +} + +configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) { + + ext { + docroot = project('documentation').docroot + docrootMinimal = project('documentation').docrootMinimal + } + } diff --git a/gradle/documentation/markdown.gradle b/gradle/documentation/markdown.gradle index 254b4228e8c..ef1c25aa0be 100644 --- a/gradle/documentation/markdown.gradle +++ b/gradle/documentation/markdown.gradle @@ -40,7 +40,7 @@ buildscript { } } -configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) { +configure(subprojects.findAll { it.path == ':lucene:documentation' || it.path == ':solr:documentation' }) { task markdownToHtml(type: Copy) { dependsOn copyDocumentationAssets @@ -52,9 +52,9 @@ configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) { } } -configure(project(':lucene')) { +configure(project(':lucene:documentation')) { markdownToHtml { - from('.') { + from(project.parent.projectDir) { include 'MIGRATE.md' include 'JRE_VERSION_MIGRATION.md' include 'SYSTEM_REQUIREMENTS.md' @@ -62,10 +62,10 @@ configure(project(':lucene')) { } task createDocumentationIndex(type: MarkdownTemplateTask) { - dependsOn copyDocumentationAssets,markdownToHtml + dependsOn markdownToHtml outputFile = file("${project.docroot}/index.html") - templateFile = file('site/index.template.md') + templateFile = file("${project.markdownSrc}/index.template.md") def defaultCodecFile = project(':lucene:core').file('src/java/org/apache/lucene/codecs/Codec.java') inputs.file(defaultCodecFile) @@ -87,19 +87,19 @@ configure(project(':lucene')) { } } -configure(project(':solr')) { +configure(project(':solr:documentation')) { markdownToHtml { - from('site') { + from(project.markdownSrc) { include '**/*.md' exclude '**/*.template.md' } } task createDocumentationIndex(type: MarkdownTemplateTask) { - dependsOn copyDocumentationAssets,markdownToHtml + dependsOn markdownToHtml outputFile = file("${project.docroot}/index.html") - templateFile = file('site/index.template.md') + templateFile = file("${project.markdownSrc}/index.template.md") // list all properties used by the template here to allow uptodate checks to be correct: inputs.property('version', project.version) @@ -109,11 +109,9 @@ configure(project(':solr')) { withProjectList() } - task createOnlineDocumentationIndex(type: MarkdownTemplateTask) { - dependsOn copyOnlineDocumentationAssets - - outputFile = file("${project.docrootOnline}/index.html") - templateFile = file('site/online-link.template.md') + task createMiniDocumentationIndex(type: MarkdownTemplateTask) { + outputFile = file("${project.docrootMinimal}/index.html") + templateFile = file("${project.markdownSrc}/online-link.template.md") // list all properties used by the template here to allow uptodate checks to be correct: inputs.property('version', project.version) @@ -161,6 +159,9 @@ class MarkdownFilter extends FilterReader { // produces Markdown, which is converted to HTML class MarkdownTemplateTask extends DefaultTask { + @Internal + Project productProject = project.parent + @InputFile File templateFile @@ -174,7 +175,7 @@ class MarkdownTemplateTask extends DefaultTask { /** adds a property "projectList" containing all subprojects with javadocs as markdown bullet list */ void withProjectList() { binding.put('projectList', project.providers.provider{ - def projects = project.subprojects.findAll{ it.tasks.findByName('renderSiteJavadoc')?.enabled } + def projects = productProject.subprojects.findAll{ it.tasks.findByName('renderSiteJavadoc')?.enabled } .sort(false, Comparator.comparing{ (it.name != 'core') as Boolean } .thenComparing(Comparator.comparing{ (it.name != 'solrj') as Boolean }) .thenComparing(Comparator.comparing{ (it.name == 'test-framework') as Boolean }) diff --git a/lucene/documentation/build.gradle b/lucene/documentation/build.gradle new file mode 100644 index 00000000000..4eb6bf60ade --- /dev/null +++ b/lucene/documentation/build.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +description = 'Lucene HTML documentation' diff --git a/lucene/site/html/lucene_green_300.gif b/lucene/documentation/src/assets/lucene_green_300.gif similarity index 100% rename from lucene/site/html/lucene_green_300.gif rename to lucene/documentation/src/assets/lucene_green_300.gif diff --git a/lucene/site/index.template.md b/lucene/documentation/src/markdown/index.template.md similarity index 100% rename from lucene/site/index.template.md rename to lucene/documentation/src/markdown/index.template.md diff --git a/lucene/packaging/build.gradle b/lucene/packaging/build.gradle index b21cc189ae4..151e6d505ad 100644 --- a/lucene/packaging/build.gradle +++ b/lucene/packaging/build.gradle @@ -28,8 +28,9 @@ description = 'Lucene distribution packaging' // By default everything is included, unless explicitly excluded. def includeInBinaries = project(":lucene").subprojects.findAll {subproject -> return !(subproject.path in [ - // Exclude packaging, not relevant to binary distribution. + // Exclude packaging & documentation, not relevant to binary distribution. ":lucene:packaging", + ":lucene:documentation", // Exclude parent container project of analysis modules (no artifacts). ":lucene:analysis" ]) @@ -68,7 +69,7 @@ for (Project includedProject : includeInBinaries) { } dependencies { - docs project(path: ':lucene', configuration: 'docs') + docs project(path: ':lucene:documentation', configuration: 'site') } distributions { @@ -143,10 +144,6 @@ configure(project(":lucene").subprojects) { include "README.*" }) - from(project.file('docs'), { - into 'docs' - }) - from(tasks.findByName("jar")) into packagingDir diff --git a/settings.gradle b/settings.gradle index c25071dcf45..61cf6719813 100644 --- a/settings.gradle +++ b/settings.gradle @@ -51,6 +51,7 @@ include "lucene:spatial-extras" include "lucene:spatial3d" include "lucene:suggest" include "lucene:test-framework" +include "lucene:documentation" include "lucene:packaging" include "solr:solrj" @@ -69,6 +70,7 @@ include "solr:test-framework" include "solr:solr-ref-guide" include "solr:example" +include "solr:documentation" include "solr:packaging" include "solr:docker" include "solr:docker:package" \ No newline at end of file diff --git a/solr/documentation/build.gradle b/solr/documentation/build.gradle new file mode 100644 index 00000000000..a5061c58b45 --- /dev/null +++ b/solr/documentation/build.gradle @@ -0,0 +1,18 @@ +/* + * 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. + */ + +description = 'Solr HTML documentation' diff --git a/solr/site/assets/images/solr.svg b/solr/documentation/src/assets/solr.svg similarity index 100% rename from solr/site/assets/images/solr.svg rename to solr/documentation/src/assets/solr.svg diff --git a/solr/site/SYSTEM_REQUIREMENTS.md b/solr/documentation/src/markdown/SYSTEM_REQUIREMENTS.md similarity index 100% rename from solr/site/SYSTEM_REQUIREMENTS.md rename to solr/documentation/src/markdown/SYSTEM_REQUIREMENTS.md diff --git a/solr/site/index.template.md b/solr/documentation/src/markdown/index.template.md similarity index 93% rename from solr/site/index.template.md rename to solr/documentation/src/markdown/index.template.md index d961c23f200..e1d11be3d87 100644 --- a/solr/site/index.template.md +++ b/solr/documentation/src/markdown/index.template.md @@ -1,6 +1,6 @@