Derby
  1. Derby
  2. DERBY-5200

[patch] embellish build.xml to automatically install junit.jar in the correct directory if it doesn't exist.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.9.1.0
    • Component/s: Build tools
    • Labels:
      None

      Description

      if tools/java/junit.jar doesn't exist, automatically install it from the central maven repository (location overrideable in local.properties) when running junit.

      1. auto_download_junit.diff
        1 kB
        Dave Brosius
      2. auto_download_junit.diff
        1 kB
        Dave Brosius
      3. auto_download_junit.diff
        1 kB
        Dave Brosius
      4. update_instructions.diff
        0.6 kB
        Knut Anders Hatlen
      5. DERBY_5200_2.diff
        2 kB
        Myrna van Lunteren

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Downloading junit.jar automatically when needed sounds like a useful improvement. If I understand the patch correctly, it will install junit.jar when running the junit-all target, which is the target that runs the tests. But before running the tests, one would have to build the tests, which also requires junit.jar. So it is very likely that junit.jar is already there when junit-all is invoked, otherwise the test couldn't have been built. Should perhaps the testing target (the target that builds the tests) also depend on install_junit?

        Show
        Knut Anders Hatlen added a comment - Downloading junit.jar automatically when needed sounds like a useful improvement. If I understand the patch correctly, it will install junit.jar when running the junit-all target, which is the target that runs the tests. But before running the tests, one would have to build the tests, which also requires junit.jar. So it is very likely that junit.jar is already there when junit-all is invoked, otherwise the test couldn't have been built. Should perhaps the testing target (the target that builds the tests) also depend on install_junit?
        Hide
        Dave Brosius added a comment -

        Good point, pretty silly by me, added new patch that does this work in 'init'

        Show
        Dave Brosius added a comment - Good point, pretty silly by me, added new patch that does this work in 'init'
        Hide
        Dave Brosius added a comment -

        version 2

        Show
        Dave Brosius added a comment - version 2
        Hide
        Dag H. Wanvik added a comment -

        I cloned a fresh sandbox and tested this patch, and it did the right thing. +1 from me.

        Aside: I did need to set up proxy for my ant first, though (I was behind a firewall in this case). My Gnome desktop is configured correctly to handle proxies, so setting and exporting ANT_ARGS="-autoproxy" in my shell worked for me. Cf. http://ant.apache.org/manual/proxy.html

        Show
        Dag H. Wanvik added a comment - I cloned a fresh sandbox and tested this patch, and it did the right thing. +1 from me. Aside: I did need to set up proxy for my ant first, though (I was behind a firewall in this case). My Gnome desktop is configured correctly to handle proxies, so setting and exporting ANT_ARGS="-autoproxy" in my shell worked for me. Cf. http://ant.apache.org/manual/proxy.html
        Hide
        Knut Anders Hatlen added a comment -

        Perhaps init is a bit too early? That target is also invoked if you build the product only, not just when you build the tests. If you have for example a packaging script that runs something like "ant buildsource buildjars", this doesn't currently require junit.jar, but now it will start trying to download junit.jar automatically, and will fail if it's running in an environment without connectivity. I think it would be good to limit the downloading to the case where junit.jar is needed and doesn't already exist.

        Show
        Knut Anders Hatlen added a comment - Perhaps init is a bit too early? That target is also invoked if you build the product only, not just when you build the tests. If you have for example a packaging script that runs something like "ant buildsource buildjars", this doesn't currently require junit.jar, but now it will start trying to download junit.jar automatically, and will fail if it's running in an environment without connectivity. I think it would be good to limit the downloading to the case where junit.jar is needed and doesn't already exist.
        Hide
        Dave Brosius added a comment -

        if the download fails for some reason, log messages, but don't fail the built in case developer is in a disconnected state.

        Show
        Dave Brosius added a comment - if the download fails for some reason, log messages, but don't fail the built in case developer is in a disconnected state.
        Hide
        Knut Anders Hatlen added a comment -

        Thanks, Dave!

        As a future improvement we may consider limiting the downloading to when we're building the tests, so that those who only care about building the product don't need to download it at all. But this looks like an improvement that's worth checking in as it is. Committed revision 1102636.

        Show
        Knut Anders Hatlen added a comment - Thanks, Dave! As a future improvement we may consider limiting the downloading to when we're building the tests, so that those who only care about building the product don't need to download it at all. But this looks like an improvement that's worth checking in as it is. Committed revision 1102636.
        Hide
        Knut Anders Hatlen added a comment -

        The attached patch updates the build instructions with a note about JUnit now being downloaded automatically if it's missing. Committed revision 1102645.

        Show
        Knut Anders Hatlen added a comment - The attached patch updates the build instructions with a note about JUnit now being downloaded automatically if it's missing. Committed revision 1102645.
        Hide
        Myrna van Lunteren added a comment -

        I have a question regarding this fix.
        I thought an alternative to having junit.jar in java/tools/junit.jar was if you have a property for junit in a properties file.
        So I have a line like this in my local.properties:
        junit=/local1/junit/junit.jar
        This way I keep out one more non-checked in file and I need only one junit.jar for a number of checked-out branches.

        Since the fix for this bug went in, the build downloads junit.jar, which I think is pointless in my set-up.

        Did I do something wrong in making use of this property? Or is it ok to change this so it will only download junit.jar if the junit property is not set?

        Show
        Myrna van Lunteren added a comment - I have a question regarding this fix. I thought an alternative to having junit.jar in java/tools/junit.jar was if you have a property for junit in a properties file. So I have a line like this in my local.properties: junit=/local1/junit/junit.jar This way I keep out one more non-checked in file and I need only one junit.jar for a number of checked-out branches. Since the fix for this bug went in, the build downloads junit.jar, which I think is pointless in my set-up. Did I do something wrong in making use of this property? Or is it ok to change this so it will only download junit.jar if the junit property is not set?
        Hide
        Dave Brosius added a comment -

        that seems reasonable.

        Show
        Dave Brosius added a comment - that seems reasonable.
        Hide
        Dave Brosius added a comment -

        >> Or is it ok to change this so it will only download junit.jar if the junit property is not set?

        that seems reasonable

        Show
        Dave Brosius added a comment - >> Or is it ok to change this so it will only download junit.jar if the junit property is not set? that seems reasonable
        Hide
        Myrna van Lunteren added a comment -

        Adding a patch that checks if junit is set; if it's set, but junit.jar is not there, the build will error out; if it's set and junit.jar is there, it will use that one; if junit is not set, it will get junit.jar and copy it into basedir/tools/java and use it from there.
        Added a comment to BUILDING.html too.

        This worked for me, if there are no comments, I'll commit tomorrow.

        Show
        Myrna van Lunteren added a comment - Adding a patch that checks if junit is set; if it's set, but junit.jar is not there, the build will error out; if it's set and junit.jar is there, it will use that one; if junit is not set, it will get junit.jar and copy it into basedir/tools/java and use it from there. Added a comment to BUILDING.html too. This worked for me, if there are no comments, I'll commit tomorrow.
        Hide
        Myrna van Lunteren added a comment -

        I changed the BUILDING.html a little, so now there's more about the junit property under the customized build area, and the requirements section is unchanged. Committed to trunk with revision 1124438.

        Show
        Myrna van Lunteren added a comment - I changed the BUILDING.html a little, so now there's more about the junit property under the customized build area, and the requirements section is unchanged. Committed to trunk with revision 1124438.
        Hide
        Knut Anders Hatlen added a comment -

        [bulk update] Close all resolved issues that haven't been updated for more than one year.

        Show
        Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.

          People

          • Assignee:
            Dave Brosius
            Reporter:
            Dave Brosius
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development