This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch jira/solr-15556-antora
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/jira/solr-15556-antora by this 
push:
     new df36ac8  Use local javadocs (solr & lucene) when building local site
df36ac8 is described below

commit df36ac81ae9a14e9969504896e391e9c9fadd42b
Author: Houston Putman <[email protected]>
AuthorDate: Tue Feb 1 17:13:22 2022 -0500

    Use local javadocs (solr & lucene) when building local site
---
 gradle/documentation/pull-lucene-javadocs.gradle   |  6 ++--
 solr/solr-ref-guide/antora.yml                     |  6 ++--
 solr/solr-ref-guide/antora.yml.template            |  6 ++--
 solr/solr-ref-guide/build.gradle                   | 36 ++++++++++++++++------
 .../ui/src/partials/header-content.hbs             |  2 +-
 5 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/gradle/documentation/pull-lucene-javadocs.gradle 
b/gradle/documentation/pull-lucene-javadocs.gradle
index 73700f0..1172fdf 100644
--- a/gradle/documentation/pull-lucene-javadocs.gradle
+++ b/gradle/documentation/pull-lucene-javadocs.gradle
@@ -28,6 +28,8 @@ configure(project(":solr:documentation")) {
       // Not sure why we need this, otherwise regular JARs get sucked in, not 
just
       // javadoc-classifier JARs
       transitive = false
+      canBeResolved = true
+      canBeConsumed = true
     }
   }
 
@@ -57,7 +59,7 @@ configure(project(":solr:documentation")) {
 
     dependsOn configurations.javadocs
     inputs.files configurations.javadocs
-    outputs.dir luceneDocsDir
+    outputs.dir project.ext.luceneDocsDir
 
     doFirst {
       def resolved = configurations.javadocs.resolvedConfiguration
@@ -72,7 +74,7 @@ configure(project(":solr:documentation")) {
         def path = id.name.replaceFirst('^lucene-', 
'').replaceFirst('^analysis-','analysis/')
         project.sync {
           from zipTree(artifact.file)
-          into file("${luceneDocsDir}/${path}/")
+          into file("${project.ext.luceneDocsDir}/${path}/")
         }
       }
     }
diff --git a/solr/solr-ref-guide/antora.yml b/solr/solr-ref-guide/antora.yml
index ef46819..27411b1 100644
--- a/solr/solr-ref-guide/antora.yml
+++ b/solr/solr-ref-guide/antora.yml
@@ -18,9 +18,9 @@ asciidoc:
     idseparator: '-'
     idprefix: ''
     # 'patch-version' is the 'z' part of x.y.z semantic version
-    page-solr-javadocs: https://solr.apache.org/docs/10_0_0
-    solr-javadocs: https://solr.apache.org/docs/10_0_0
-    lucene-javadocs: https://lucene.apache.org/core/9_0_0
+    page-solr-javadocs: 'https://solr.apache.org/docs/10_0_0'
+    solr-javadocs: 'https://solr.apache.org/docs/10_0_0'
+    lucene-javadocs: 'https://lucene.apache.org/core/9_0_0'
     java-javadocs: 
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/
     # Some constructed  links may be 404 TODO to check
     solr-docs-version: '10.0'
diff --git a/solr/solr-ref-guide/antora.yml.template 
b/solr/solr-ref-guide/antora.yml.template
index feafa50..0a7d8e2 100644
--- a/solr/solr-ref-guide/antora.yml.template
+++ b/solr/solr-ref-guide/antora.yml.template
@@ -18,9 +18,9 @@ asciidoc:
     idseparator: '-'
     idprefix: ''
     # 'patch-version' is the 'z' part of x.y.z semantic version
-    page-solr-javadocs: 
https://solr.apache.org/docs/${solr_version_major}_${solr_version_minor}_${solr_version_patch}
-    solr-javadocs: 
https://solr.apache.org/docs/${solr_version_major}_${solr_version_minor}_${solr_version_patch}
-    lucene-javadocs: https://lucene.apache.org/core/${lucene_version_docs}
+    page-solr-javadocs: '${solr_javadocs_link}'
+    solr-javadocs: '${solr_javadocs_link}'
+    lucene-javadocs: '${lucene_javadocs_link}'
     java-javadocs: 
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/
     # Some constructed  links may be 404 TODO to check
     solr-docs-version: '${solr_version_major}.${solr_version_minor}'
diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradle
index 415f3b2..da17b13 100644
--- a/solr/solr-ref-guide/build.gradle
+++ b/solr/solr-ref-guide/build.gradle
@@ -49,6 +49,7 @@ configurations {
     refGuide
     officialPlaybook
     localPlaybook
+    localJavadocs
 }
 
 dependencies {
@@ -82,6 +83,9 @@ dependencies {
     gems 'rubygems:slim:4.1.0'
     gems 'rubygems:concurrent-ruby:1.1.9'
     gems 'rubygems:http_parser.rb:0.6.0'
+
+    localJavadocs project(path: ":solr:documentation", configuration: 
'javadocs')
+    localJavadocs project(path: ":solr:documentation", configuration: 'site')
 }
 
 sourceSets {
@@ -301,7 +305,11 @@ node {
   version = "16.13.2" // LTS
 }
 
+// TODO document these properties in help
+def isLocalGuide = propertyOrEnvOrDefault("refguide.local", "REFGUIDE_LOCAL", 
"true").trim().toLowerCase().startsWith("t")
+
 ext {
+    siteDir = "${buildDir}/site"
     playbooksDir = "${buildDir}/playbooks"
     playbookTemplate = "playbook.template.yml"
     localPlaybook = "local-playbook.yml"
@@ -321,10 +329,10 @@ task buildAntoraYaml {
     doLast {
         def splitVersion = version.toString().split("\\p{Punct}")
         def props = [
-            'solr_version'      : 
"${splitVersion[0]}.${splitVersion[1]}.${splitVersion[2]}",
-            'solr_version_major': splitVersion[0],
-            'solr_version_minor': splitVersion[1],
-            'solr_version_patch': splitVersion[2],
+            solr_version       : 
"${splitVersion[0]}.${splitVersion[1]}.${splitVersion[2]}",
+            solr_version_major : splitVersion[0],
+            solr_version_minor : splitVersion[1],
+            solr_version_patch : splitVersion[2],
         ]
         // Set these dependency versions as lazy gstrings so that they're 
resolved after evaluation.
         // These variable names must use underscores, not dashes or periods
@@ -343,7 +351,8 @@ task buildAntoraYaml {
             solrRootPath        : project(':solr').projectDir.toString() + 
File.separator,
             buildDate           : rootProject.ext['buildDate'],
             buildYear           : rootProject.ext['buildYear'],
-            lucene_version_docs : props.dep_version_lucene.replaceAll("\\.", 
"_")
+            solr_javadocs_link : 
"https://solr.apache.org/docs/${props.solr_version.replaceAll("\\.", "_")}",
+            lucene_javadocs_link :  
project(':solr:documentation').luceneDocUrl,
         ])
 
         copy {
@@ -402,20 +411,27 @@ dependencies {
     }
 }
 
-def isLocalGuide = propertyOrEnvOrDefault("refguide.local", "REFGUIDE_LOCAL", 
"true").trim().toLowerCase().startsWith("t")
-
 // Documentation for Antora-Gradle plugin at
 // https://gitlab.com/antora/antora-gradle-plugin
 antora {
-    // TODO document these properties in help
     playbookFile = file("${project.ext.playbooksDir}/${isLocalGuide ? 
project.ext.localPlaybook : project.ext.officialPlaybook}")
     antoraVersion = "3.0.1"
     // TODO this is duplicated but I think the other instance of this is going 
away because it's specific to jekyll?
     // Set these dependency versions as lazy gstrings so that they're resolved 
after evaluation.
+    def extraArgs = []
+    if (isLocalGuide) {
+        // Use a local build of the Lucene and Solr javadocs if building a 
local refGuide
+        extraArgs.addAll([
+            // This attribute should not include ":link", the other 2 should
+            "--attribute", 
"page-solr-javadocs=${project(':solr:documentation').docroot.toPath()}",
+            "--attribute", 
"solr-javadocs=link:${project(':solr:documentation').docroot.toPath()}",
+            "--attribute", 
"lucene-javadocs=link:${project(':solr:documentation').luceneDocsDir.toPath()}"
+        ])
+    }
     arguments = [
         "--fetch",
         "--to-dir=${buildDir}/site",
-    ]
+    ] + extraArgs
 
     // TODO figure out if we can fail the build when this task outputs errors 
about broken links
     // TODO declare inputs and outputs so that we can cache the results
@@ -424,6 +440,8 @@ antora {
 tasks.antora.dependsOn tasks.buildAntoraYaml
 if (isLocalGuide) {
     tasks.antora.dependsOn configurations.localPlaybook
+
+    tasks.antora.dependsOn configurations.localJavadocs
 } else {
     tasks.antora.dependsOn configurations.officialPlaybook
 }
\ No newline at end of file
diff --git a/solr/solr-ref-guide/ui/src/partials/header-content.hbs 
b/solr/solr-ref-guide/ui/src/partials/header-content.hbs
index 6e1b2f2..3abffcf 100644
--- a/solr/solr-ref-guide/ui/src/partials/header-content.hbs
+++ b/solr/solr-ref-guide/ui/src/partials/header-content.hbs
@@ -15,7 +15,7 @@
         <div class="navbar-item has-dropdown is-hoverable">
           <a class="navbar-link" href="#">Resources</a>
           <div class="navbar-dropdown">
-            <a class="navbar-item" 
href="{{{page.attributes.solr-javadocs}}}/solr-core/index.html" target="_blank" 
rel="noreferrer nopener">Solr Javadocs</a>
+            <a class="navbar-item" 
href="{{{page.attributes.solr-javadocs}}}/index.html" target="_blank" 
rel="noreferrer nopener">Solr Javadocs</a>
             <a class="navbar-item" 
href="https://solr.apache.org/community.html#version-control"; target="_blank" 
rel="noreferrer nopener">Source Code</a>
             <a class="navbar-item" 
href="https://solr.apache.org/community.html"; target="_blank" rel="noreferrer 
nopener">Community Links</a>
             <a class="navbar-item" 
href="https://github.com/apache/solr/tree/main/dev-docs/ref-guide"; 
target="_blank" rel="noreferrer nopener">Contribute</a>

Reply via email to