Re: Debugging a Framework

From: Zak Burke (zdbw..artmouth.EDU)
Date: Tue Apr 24 2007 - 15:28:12 EDT

  • Next message: Serethos: "Noticing changes to a WOTextField"

    Mike Schrag wrote on 4/23/07 11:06 PM:
    > For what it's worth, if i ever build with ant, I always kill the dist
    > folder first. I find that ant often plays fun little games like this.
    > However, the build folder is "us," so if that's out of date, then it is
    > quite possibly our fault.

    Operations in the local directory work correctly, or at least they
    work the way I would expect.

    That is, if my build directory contains an updated model or
    WOComponent, and then I restore from my repository and do Project ->
    Clean, Project-> Build Project, my build directory will contain the
    files as restored from the repository.

    The problem lies in deployment via WOLips Ant Tools -> Install.

    When you clean and build, the build directory is scrubbed and all
    files are copied into it. When you deploy, however, the deployment
    directory is NOT scrubbed; deployed files are updated if their
    timestamps are older than those in the build directory. This means
    your build directory and your deployment directory can very easily
    get out of sync.

    The problem is that when model and component (wod, html) files are
    copied into the build directory, they retain their old meta-data.
    Curiously, a component's .wo directory is freshly created, but the
    .html and .wod files it contains retain their old meta-data. In
    Unix-land, I'd say this looks like a "cp -p" instead of a straight
    "cp". Thus, even though the build directory contains the right
    files, they won't be copied to the deployment directory.

     From ant's point of view, only updating files that have changed,
    (i.e. that are newer) is sensible and very efficient. make does the
    same thing. "Newer is better" is an understandable assumption. It
    just that in this case, it leads to somewhat unanticipated
    consequences. It's more of a loophole than a bug.

    That said, the loophole could easily be closed by touching every
    file in the build directory. That makes deployment less efficient,
    but also makes it a bit harder to shoot yourself in the foot.

    zak.

    p.s. Incidentally, this kind of problem is why I deploy to versioned
    directories and then have my apps use un-versioned symlinks pointing
    to a versioned directory. For example,

            i3pkb.woa -> i3pkb.woa-kb-1-6-6
            i3pkb.woa-kb-1-6-4
            i3pkb.woa-kb-1-6-5
            i3pkb.woa-kb-1-6-6

    Then I'm never worried about the contents on i3pkb.woa getting
    updated or not, and it's really easy to roll back to a previous
    release if I encounter bugs. I am happy to share build and
    deployment scripts that do this automatically; send me a note and
    I'll forward 'em to you.

    > On Apr 23, 2007, at 10:20 PM, Zak Burke wrote:
    >
    >> Chuck Hill wrote on 4/23/07 12:19 PM:
    >>> That is Mike Scrhag's tip, IIRC. I just copied it into the Wiki for
    >>> him.
    >>> Chuck
    >>> On Apr 23, 2007, at 3:43 AM, Andrew Lindesay wrote:
    >>>> Hello Chuck;
    >>>>
    >>>> I was reading your Wiki entry...
    >>>>
    >>>>
    >>>> http://wiki.objectstyle.org/confluence/display/WOL/Debug+Code+in+a+Framework
    >>>>
    >>
    >> Here's a wrinkle with that that drove me crazy for a few hours last week:
    >>
    >> Say you have a framework with a model and an app that uses the
    >> framework. Then you make a change to the model and click WOLips Ant
    >> Tools -> deploy, and then build your app. Then you decide the change
    >> was a bad idea and you replace your changed model files with those
    >> from your repository.
    >>
    >> Here's the tricky part: when you deploy the framework, ant (or is it
    >> Eclipse, or WOLips?) will see that the model files in your deployment
    >> directory are NEWER than those you just pulled out of the repository,
    >> therefore leaving your deployed framework in a different state than
    >> your local build directory. Doing a clean build doesn't help because,
    >> of course, the model doesn't get compiled so its timestamp isn't updated.
    >>
    >> So what kind of error is this? A bug in ant? In Eclipse? In WOLips? Or
    >> is it just a PEBKAC* error? Once I figured out what was going on, the
    >> whole problem became obvious. Ah, hindsight; the smack on the forehead
    >> after the kick in the pants. All I had to do was clean the deployment
    >> directory in addition to the build directory, but man, what pain
    >> before I figured that out.
    >>
    >> zak.
    >>
    >>
    >> * Problem Exists Between Keyboard And Chair
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Apr 24 2007 - 15:29:08 EDT