ErickErickson commented on issue #1186: LUCENE-9134: Port ant-regenerate tasks 
to Gradle build
URL: https://github.com/apache/lucene-solr/pull/1186#issuecomment-576384783
 
 
   Dawid:
   
   Thanks, I’ll implement your comments.
   
   Meanwhile I’m trying to get the regenerate task to _not_ kick in when 
executing things like “gw assemble” by using constructs like:
   
   regenerate.onlyIf {
     gradle.startParameter.taskRequests.args.findAll { String s -> s == 
"regenerate" }.size() > 0
   }
   
   is there a better way? So far this works on an individual task in a gradle 
file. I’d like a way for it to apply to _all_ tasks in a particular gradle 
file, including dependency resolution…. Digging.
   
   As for the other files that changed, almost all of the differences are 
results of things I did intentionally. 
   
   - Some tasks themselves use a replaceregexp with quoted lines that I decided 
to “fix” indentation on. Unnecessary and distracting I agree.
   
   - The SuppressWarnings were moved around so that once this runs, people 
don’t have to go back in and hand-edit the generated files to suppress them.
   
   - This little jewel: “implemetation’s” is because javacc apparently 
generates the misspelling it was hand-corrected.
   
   - As for changes like: 
   
   private java.util.List<int[]> jj_expentries = new java.util.ArrayList<>(); 
   changed to:
   private java.util.List<int[]> jj_expentries = new 
java.util.ArrayList<int[]>();
   
   removing the redundancies were hand-edits, see: LUCENE-5512. and I don’t see 
the harm in leaving them in. Hmmm. I’ll try doing a replaceregexp on them to 
avoid compiler warnings and thrashing on it.
   
   - I can’t explain at all why invoking javacc in this environment decided to 
move some methods around in StandardSyntaxParser.java I certainly changed the 
jj file in order to put the SuppressWarnings in, so it makes sense that the 
java file was regenerated. But the methods are identical, just in different 
places so I’m not worrying about it.
   
   - As for the cast changes, all I can say is that I get no warnings. Hmmm, 
let me add -Xlint:cast to the parameters and see if they come back and fix as 
part of the task if so.
   
   Thanks!
   
   
   > On Jan 20, 2020, at 10:12 AM, Dawid Weiss <notificati...@github.com> wrote:
   > 
   > @dweiss commented on this pull request.
   > 
   > I only had time for a quick scan through the patch. I think it needs some 
love in how we use javacc (the current way is not right). I also didn't quite 
understand from the diff file which changes are part of the patch and which are 
caused by regenerated files... and why those regenerated files are not 
identical to what they were before (does ant regenerate also leave them in a 
changed state?)
   > 
   > In gradle/defaults-java.gradle:
   > 
   > > @@ -6,6 +6,8 @@ allprojects {
   >      targetCompatibility = "11"
   >  
   >      compileJava.options.encoding = "UTF-8"
   > +    compileJava.options.compilerArgs << '-Xlint:unchecked'
   > 
   > I added linting options in a separate commit.
   > 
   > In lucene/queryparser/build.gradle:
   > 
   > > +  File inputFile
   > +
   > +  @OutputDirectory
   > +  File target
   > +
   > +  String lineSeparator = System.lineSeparator()
   > +  @TaskAction
   > +  void javacc() {
   > +
   > +
   > +    String javaCCClasspath = 
project.project(":lucene:queryparser").configurations.javaCCDeps.asPath
   > +    String javaCCHome = javaCCClasspath.substring(0, 
javaCCClasspath.lastIndexOf("/"))
   > +
   > +    // This bit seems really awkward, but I didn't find a good way to 
either convince the ant task to accept a different
   > +    // name than javacc.jar...
   > +    // nocommit So I'm taking the javacc-5.0.jar file that's downloaded 
to Gradle's cache and renaming it.
   > 
   > You shouldn't be doing anything with those files. I think it'd be better 
to use javacc directly rather than through ant - then you could just invoke the 
javacc with the classpath you declared in the dependency, that's it.
   > 
   > —
   > You are receiving this because you authored the thread.
   > Reply to this email directly, view it on GitHub, or unsubscribe.
   > 
   
   

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