mocobeta commented on a change in pull request #1388: LUCENE-9278: Use 
-linkoffline instead of relative paths to make links to other projects
URL: https://github.com/apache/lucene-solr/pull/1388#discussion_r404996841
 
 

 ##########
 File path: gradle/render-javadoc.gradle
 ##########
 @@ -15,93 +15,105 @@
  * limitations under the License.
  */
 
-// generate javadocs by using Ant javadoc task
+// generate javadocs by calling javadoc tool
+// see https://docs.oracle.com/en/java/javase/11/tools/javadoc.html
+
+// utility function to convert project path to document output dir
+// e.g.: ':lucene:analysis:common' => 'analysis/common'
+def pathToDocdir = { path -> path.split(':').drop(2).join('/') }
 
 allprojects {
   plugins.withType(JavaPlugin) {
-    ext {
-      javadocRoot = project.path.startsWith(':lucene') ? 
project(':lucene').file("build/docs") : project(':solr').file("build/docs")
-      javadocDestDir = "${javadocRoot}/${project.name}"
-    }
-
     task renderJavadoc {
-      description "Generates Javadoc API documentation for the main source 
code. This invokes Ant Javadoc Task."
+      description "Generates Javadoc API documentation for the main source 
code. This directly invokes javadoc tool."
       group "documentation"
 
       ext {
-        linksource = "no"
+        linksource = false
         linkJUnit = false
-        linkHref = []
+        linkLuceneProjects = []
+        linkSorlProjects = []
       }
 
       dependsOn sourceSets.main.compileClasspath
 
       inputs.files { sourceSets.main.java.asFileTree }
-      outputs.dir project.javadocRoot
+      outputs.dir project.javadoc.destinationDir
 
       def libName = project.path.startsWith(":lucene") ? "Lucene" : "Solr"
       def title = "${libName} ${project.version} ${project.name} 
API".toString()
 
+      // absolute urls for "-linkoffline" option
+      def javaSEDocUrl = "https://docs.oracle.com/en/java/javase/11/docs/api/";
+      def junitDocUrl = "https://junit.org/junit4/javadoc/4.12/";
+      def luceneDocUrl = 
"https://lucene.apache.org/core/${project.version.replace(".", "_")}".toString()
+      def solrDocUrl = 
"https://lucene.apache.org/solr/${project.version.replace(".", "_")}".toString()
+
+      def javadocCmd = 
org.gradle.internal.jvm.Jvm.current().getJavadocExecutable()
 
 Review comment:
   > In that setting, which JVM is used for running tests?
   
   Gradle Test task has a customizable property `executable`, the documentation 
says "The name of the executable to use. Default with java plugin: java command 
for the current JVM." If my understanding is correct, it is the runtime on 
which tests are run.
   https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html
   
   I tried to print test's executable and javadoc's executable by adding 
doLast{} clause on the default test task (gradle/default-tests.gradle).
   ```
         doLast {
           println("Test executable\t " + executable)
           println("Javadoc executable\t" + 
org.gradle.internal.jvm.Jvm.current().getJavadocExecutable())
         }
   ```
   
   I set 
   `JAVA_HOME=/usr/local/java/adoptopenjdk/jdk-14+36/` and 
   `org.gradle.java.home=/usr/local/java/adoptopenjdk/jdk-11.0.3+7/`
   then, ran the tests. It said both `executable` point the gradle's java home. 
(Here we don't change the executable for test, so the default "current" JVM 
should be used.)
   
   ```
   Test executable        /usr/local/java/adoptopenjdk/jdk-11.0.3+7/bin/java
   Javadoc executable      /usr/local/java/adoptopenjdk/jdk-11.0.3+7/bin/javadoc
   ```
   
   Looks consistent to me, though i could miss something here... what do you 
think @dweiss ? 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to