Lucene - Core
  1. Lucene - Core
  2. LUCENE-2488

Fix 2.9 contrib builds to succeed when JDK 1.4 is used (leaving out contribs that require 1.5)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.9, 2.9.1, 2.9.2
    • Fix Version/s: 2.9.3
    • Component/s: general/build
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      When you build and test Lucene 2.9 with Java 1.4, building and testing of contrib fails. This patch fixes this to repect the current compiler version and disables all contribs that need Java 1.5 by checking their javac.source property.

      This patch can be ported to 3.x or trunk, when 1.6 contribs will appear.

      1. LUCENE-2488.patch
        13 kB
        Uwe Schindler
      2. LUCENE-2488.patch
        13 kB
        Uwe Schindler

        Activity

        Hide
        Uwe Schindler added a comment -

        Patch for build.xmls. This also marks benchmark as 1.5, as it depends on fast-vector-highlighter that is 1.5.

        I will commit this soon and build the final artifacts of 2.9.3 and 3.0.2!

        Show
        Uwe Schindler added a comment - Patch for build.xmls. This also marks benchmark as 1.5, as it depends on fast-vector-highlighter that is 1.5. I will commit this soon and build the final artifacts of 2.9.3 and 3.0.2!
        Hide
        Robert Muir added a comment -

        This patch fixes this to repect the current compiler version and disables all contribs that need Java 1.5 by checking their javac.source property.

        This patch can be ported to 3.x or trunk, when 1.6 contribs will appear.

        I don't think we should do this. Please don't commit this it should be discussed more.

        I know you hate java 1.6, etc. but i don't want to write code that silently fails depending upon environment. a hard error is best.

        Show
        Robert Muir added a comment - This patch fixes this to repect the current compiler version and disables all contribs that need Java 1.5 by checking their javac.source property. This patch can be ported to 3.x or trunk, when 1.6 contribs will appear. I don't think we should do this. Please don't commit this it should be discussed more. I know you hate java 1.6, etc. but i don't want to write code that silently fails depending upon environment. a hard error is best.
        Hide
        Uwe Schindler added a comment -

        Hi Robert,

        in Lucene 2.9, it was intended to work like this, as this code is already there, but the recent added contribs did not use the property at all! Lucene 2.9 is Java 1.4, so it must compile, if you run it with this JDK version.

        Without this, it's impossible to check the dependency correctly, and because of this I fixed this. I dont want to commit this in 3.x or trunk! So please just tell, if you are fine with fixing it in Lucebe 2.9, so it works as expected!

        This patch can be ported to 3.x or trunk, when 1.6 contribs will appear.

        This patch is for Lucene 2.9 branch only!

        Show
        Uwe Schindler added a comment - Hi Robert, in Lucene 2.9, it was intended to work like this, as this code is already there, but the recent added contribs did not use the property at all! Lucene 2.9 is Java 1.4, so it must compile, if you run it with this JDK version. Without this, it's impossible to check the dependency correctly, and because of this I fixed this. I dont want to commit this in 3.x or trunk! So please just tell, if you are fine with fixing it in Lucebe 2.9, so it works as expected! This patch can be ported to 3.x or trunk, when 1.6 contribs will appear. This patch is for Lucene 2.9 branch only!
        Hide
        Uwe Schindler added a comment -

        More ant magic.

        This patch does not automatically exclude 1.5 only contribs, it fails per default with an error message:

        Buildfile: build.xml
             [echo] Building fast-vector-highlighter...
        
        javacc-uptodate-check:
        
        javacc-notice:
        
        jflex-uptodate-check:
        
        jflex-notice:
        
        common.init:
        
        fail-jdk14-version:
        
        BUILD FAILED
        contrib-build.xml:98: Contrib 'fast-vector-highlighter' needs at least JDK 1.5 to build. If you only want to compile Java 1.4 compatible contribs, add '-Dforce.jdk14.build=true' to command line.
        
        Total time: 0 seconds
        

        For testing a whole "ant test" with JDK 1.4 you can pass the mentioned property, so it excludes als Java 1.5 contribs. With this its possible for me as release manager of 2.9, to test compatibility with Java 1.4.

        Robert, are you fine with that for 2.9.3? If we need something similar in trunk, we may think about adding a similar ant magic to the trunk/3x build scripts. But this is not part of this issue, this is fix for 2.9.3 only.

        Show
        Uwe Schindler added a comment - More ant magic. This patch does not automatically exclude 1.5 only contribs, it fails per default with an error message: Buildfile: build.xml [echo] Building fast-vector-highlighter... javacc-uptodate-check: javacc-notice: jflex-uptodate-check: jflex-notice: common.init: fail-jdk14-version: BUILD FAILED contrib-build.xml:98: Contrib 'fast-vector-highlighter' needs at least JDK 1.5 to build. If you only want to compile Java 1.4 compatible contribs, add '-Dforce.jdk14.build=true' to command line. Total time: 0 seconds For testing a whole "ant test" with JDK 1.4 you can pass the mentioned property, so it excludes als Java 1.5 contribs. With this its possible for me as release manager of 2.9, to test compatibility with Java 1.4. Robert, are you fine with that for 2.9.3? If we need something similar in trunk, we may think about adding a similar ant magic to the trunk/3x build scripts. But this is not part of this issue, this is fix for 2.9.3 only.
        Hide
        Michael McCandless added a comment -

        This looks like a great step forward – we can now [optionally; off by default] assert those modules (core, contribs) that "claim" to be <= JDK X in fact compile & pass tests with JDK X.

        So we now default to a hard error.... but if you want (eg you are the RM), you can pass -Dforce.jdk14.build=true, and skip those contribs requiring > X. I agree the default should be brittle (hard error).

        Can we use this for Solr/Lucene on trunk/3x? Ie Solr requires JDK >= 1.6, but Lucene is >= 1.5; we don't want 1.6 features to accidentally sneak into Lucene...

        Show
        Michael McCandless added a comment - This looks like a great step forward – we can now [optionally; off by default] assert those modules (core, contribs) that "claim" to be <= JDK X in fact compile & pass tests with JDK X. So we now default to a hard error.... but if you want (eg you are the RM), you can pass -Dforce.jdk14.build=true, and skip those contribs requiring > X. I agree the default should be brittle (hard error). Can we use this for Solr/Lucene on trunk/3x? Ie Solr requires JDK >= 1.6, but Lucene is >= 1.5; we don't want 1.6 features to accidentally sneak into Lucene...
        Hide
        Robert Muir added a comment -

        The new option is great, thanks Uwe.

        i understood all along the patch is for 2.9.x only. I didnt want us to set a precedent where the build allows things to be skipped depending on environment.
        Then the tests are passing for one developer and not for another, releasers could accidentally not build all artifacts, ...

        Show
        Robert Muir added a comment - The new option is great, thanks Uwe. i understood all along the patch is for 2.9.x only. I didnt want us to set a precedent where the build allows things to be skipped depending on environment. Then the tests are passing for one developer and not for another, releasers could accidentally not build all artifacts, ...
        Hide
        Uwe Schindler added a comment -

        I didnt want us to set a precedent where the build allows things to be skipped depending on environment. Then the tests are passing for one developer and not for another, releasers could accidentally not build all artifacts, ...

        Thanks, I think the new option is fine now and works in all combinations. I already verified that the whole build and test suite (with the ignore 1.5 contribs option) succeed with JDK 1.4.2_19. This is good to know as the release manager.

        Can we use this for Solr/Lucene on trunk/3x? Ie Solr requires JDK >= 1.6, but Lucene is >= 1.5; we don't want 1.6 features to accidentally sneak into Lucene...

        Of course, but we should do this in another issue. I will commit this evening and create the release artifacts!

        Show
        Uwe Schindler added a comment - I didnt want us to set a precedent where the build allows things to be skipped depending on environment. Then the tests are passing for one developer and not for another, releasers could accidentally not build all artifacts, ... Thanks, I think the new option is fine now and works in all combinations. I already verified that the whole build and test suite (with the ignore 1.5 contribs option) succeed with JDK 1.4.2_19. This is good to know as the release manager. Can we use this for Solr/Lucene on trunk/3x? Ie Solr requires JDK >= 1.6, but Lucene is >= 1.5; we don't want 1.6 features to accidentally sneak into Lucene... Of course, but we should do this in another issue. I will commit this evening and create the release artifacts!
        Hide
        Uwe Schindler added a comment -

        Committed revision: 951767

        Show
        Uwe Schindler added a comment - Committed revision: 951767

          People

          • Assignee:
            Uwe Schindler
            Reporter:
            Uwe Schindler
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development