mocobeta commented on issue #1242: LUCENE-9201: Port documentation-lint task to 
Gradle build
URL: https://github.com/apache/lucene-solr/pull/1242#issuecomment-584574521
 
 
   Thanks @uschindler for your comments. I rewrote the task to use sourceSets 
instead of relying the assumption the target projects (for linting) have 
"src/java".
   However there is another problem, the Java source directory isn't available 
from SourceSet as far as I know. Actual source directory path is required when 
executing the ECJ.
   ```groovy
       // excerpt from the custom ECJ lint task
       project.plugins.withId('java', {
         project.sourceSets.each { sourceSet ->
           project.javaexec {
             classpath {
               project.rootProject.configurations.ecj.asPath
             }
             main = "org.eclipse.jdt.internal.compiler.batch.Main"
             args += [
               // Unfortunately, 'testCompileClasspath' is not available from 
sourceSet, so without the second term test classes cannot be compiled.
               "-classpath", sourceSet.compileClasspath.toList().join(':') + 
project.configurations.testCompileClasspath.findAll().join(":"),
               "-d", dstDir,
               "-encoding", "UTF-8",
               "-source", "11", // How this can be obtained from sourceSet or 
project?
               "-target", "11",
               "-nowarn",
               "-enableJavadoc",
               "-properties", 
"${project.rootProject.rootDir}/lucene/tools/javadoc/ecj.javadocs.prefs",
               "src/java" // ... or "src/test". How this can be obtained from 
sourceSet or project?
             ]
           }
         }
       })
   ```
   
   SourceSet has a property `allJava` that contains all Java source file, this 
is no help here.
   
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSet.html#org.gradle.api.tasks.SourceSet
   I might misses something, or another hack is required to identify the actual 
source directory path?

----------------------------------------------------------------
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