Re: WOLips Ant build ignoring wolips.properties

From: Kieran Kelleher (kelleher..mail.com)
Date: Tue Oct 19 2010 - 12:55:08 UTC

  • Next message: James Cicenia: "Re: TurnKey Installer Components"

    David,

    Probably the only effective way for this is for Mike (or some smart guy on the wolips team) to check for a custom wolips.properties file and add that property to the ant argument when someone does a WOLips Ant Tools -> Install. File a JIRA and ask for votes.

    Regards, Kieran

    PS. Below is a script snippet that gets the wolips.properties file and reads its contents into a shell script ...... you might find bits of this useful if you need a work around shell script that can work for any wolips.properties

    ## Gets eclipse workspace dir
    ## looks for presence of a dir named ".metadata"
    function eclipse_workspace {

            # Get the script dir
        WKSPACE_DIR=`script_dir`
        
        while [ -z ${ECLIPSE_WORKSPACE} ]; do
                # get parent dir
                WKSPACE_DIR=`parent_dir $WKSPACE_DIR`
                if [ -d "${WKSPACE_DIR}/.metadata/.plugins/org.eclipse.core.runtime" ]; then
                        ECLIPSE_WORKSPACE=$WKSPACE_DIR
                fi
        done

        echo "$ECLIPSE_WORKSPACE"
    }

    ## reads in a java-style properteis file, replacing non-alpha-digit-underscore characters in the property names with underscore
    # http://shrubbery.mynetgear.net/wiki/Reading_Java-style_Properties_Files_with_Shell
    function read_properties_file {
            # For both linux/osx compatability we need to use mktemp -t form and pick a reasonably unique name
            TEMPFILE=$(mktemp -t "wolips.tmp."`date +"%Y%m%d_%H%M%S"`)
            cat ${1} | \
            awk 'BEGIN { FS="="; } \
            /^\#/ { print; } \
            !/^\#/ { if (NF == 2) { n = $1; gsub(/[^A-Za-z0-9_]/,"_",n); print n "=\"" $2 "\""; } else { print; } }' \
    >$TEMPFILE
            source $TEMPFILE
            rm $TEMPFILE
    }

    function remote_enviromnent {
            REMOTE_ENV_SSH=${1}
            REMOTE_UNAME=`ssh ${REMOTE_ENV_SSH} "uname"`
            echo "$REMOTE_UNAME"
    }

    function remote_next_root {
            REMOTE_UNAME=`remote_environment ${1}`
            case "$REMOTE_UNAME" in
                    'Linux')
                            NEXT_ROOT="/opt"
                            ;;
                    *)
                            NEXT_ROOT="/"
                            ;;
            esac
            echo "$NEXT_ROOT"
    }

    # Read in the eclipse workspace wolips preferences file. It balks on two lines on wolips prefs that we don't care about, but it successfully
    # reads and sets the other properties
    read_properties_file `eclipse_workspace`/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.objectstyle.wolips.preferences.prefs

    if [ -z "${org_objectstyle_wolips_wolipsPropertiesFile}" ]; then
            # No custom wolips.properties defined, so we use the default
            org_objectstyle_wolips_wolipsPropertiesFile="wolips.properties"
    fi
    # The "find" command is different on OS X and Linux, so...
    UNIX_KIND=`uname`

    if [ "$UNIX_KIND" = "Darwin" ]; then
            # Stupidity because bash scripts cannot handle spaces in filenames in an efficient and effective way
            # Google for 'bash filenames with spaces' and you will find this solution appears to be the only one
            find "${HOME}/Library/Application Support/WOLips" -name "${org_objectstyle_wolips_wolipsPropertiesFile}" | while read WOLIPS_PROPERTIES_FILE; do
                    echo "processing $WOLIPS_PROPERTIES_FILE"
                    if [ -e "$WOLIPS_PROPERTIES_FILE" ]; then
                            # And because the awk function pukes if we quote the variable, we just ln this path-with-spaces
                            # to a temporary file path with no spaces and then proceed in the usual care-free scripting way :-)
                            ln -sfF "$WOLIPS_PROPERTIES_FILE" /tmp/${org_objectstyle_wolips_wolipsPropertiesFile}
                    fi
            done
    elif [ "$UNIX_KIND" = "Linux" ]; then
            # Stupidity because bash scripts cannot handle spaces in filenames in an efficient and effective way
            # Google for 'bash filenames with spaces' and you will find this solution appears to be the only one
            find "${HOME}/Library" -path "*/Application Support/WOLips*" -name "${org_objectstyle_wolips_wolipsPropertiesFile}" | while read WOLIPS_PROPERTIES_FILE; do
                    echo "processing $WOLIPS_PROPERTIES_FILE"
                    if [ -e "$WOLIPS_PROPERTIES_FILE" ]; then
                            # And because the awk function pukes if we quote the variable, we just ln this path-with-spaces
                            # to a temporary file path with no spaces and then proceed in the usual care-free scripting way :-)
                            ln -sfF "$WOLIPS_PROPERTIES_FILE" /tmp/${org_objectstyle_wolips_wolipsPropertiesFile}
                    fi
            done
    else
            echo "Operating system not supported. Exiting now..."
            exit 1
    fi

    read_properties_file /tmp/${org_objectstyle_wolips_wolipsPropertiesFile}

    # Check if it worked
    echo "wo_local_frameworks is ${wo_local_frameworks}"

    On Oct 19, 2010, at 8:11 AM, David Avendasora wrote:

    >
    > On Oct 19, 2010, at 7:00 AM, Kieran Kelleher wrote:
    >
    >> Dave,
    >>
    >> wolips.properties *is* a property containing a path name for the normal project build.xml (if you opened build.xml and looked at it you would see), so you need:
    >>
    >> ant -Dwolips.properties=~/Library/Application Support/WOLips/wolips.properties clean build install
    >
    > Hey Kieran,
    >
    > Thanks, but that doesn't help when I want to use the Built-in WOLips Install functionality by right-clicking on the project and selecting WOLips Ant Tools -> Install
    >
    > With that said, I figured it out with help from David LeBer:
    >
    > In the build.properties file I need to set:
    >
    > wolips.properties=/Developer/WebObjects/Versions/WebObjects543/wolips.properties
    >
    > Which will tell Ant to use that property file. The problem is that others on the team may not have their wolips.properties file in the same location so if they are trying to build the project too, theirs will break.
    >
    > So, in the end, while this gets things working, it's a lurking gotcha for the first time someone uses a custom wolips.properties file in a location other than the default. Either WOLips' built in Ant functionality will not work (as in my case) or far worse, it will appear to work but use a property file other than the one that I specified in the WOLips preferences.
    >
    > What do we do about that? I feel that if you set a custom wolips.properties file, everything you do within WOLips should use that file.
    >
    > I understand that it's dangerous/bad/evil/risking-the-wrath-of-anjo to make changes to the build.properties file that are user-specific so we really shouldn't write the location there, but how else do we tell an Ant build from within WOLips to use the custom wolips.properties file?
    >
    > Dave
    >
    >
    >
    >>
    >> HTH, Kieran
    >>
    >> PS. Wonder build on the other hand loads the wolips properties using the -propertyfile argument, which is probably why you were trying this option. Yes, it can be a source of confusion :-)
    >>
    >> On Oct 19, 2010, at 12:27 AM, David Avendasora wrote:
    >>
    >>> Hi all,
    >>>
    >>> I'm trying to get builds working from within Eclipse, and it appears that the WOLips Ant Tools -> Install is ignoring my wolips.properties file I have defined in the WOLips preferences and instead using the ~/Library/Application Support/WOLips/wolips.properties file, which is _wrong_.
    >>>
    >>> When I run with -debug and manually specify the -propertyfile, I get the following:
    >>>
    >>> [property] Loading /Developer/WebObjects/Versions/WebObjects543/wolips.properties
    >>> Override ignored for property "wo.system.root"
    >>> Override ignored for property "wo.user.frameworks"
    >>> Override ignored for property "wolips.properties"
    >>> Override ignored for property "wo.system.frameworks"
    >>> Override ignored for property "wonder.framework.install.root"
    >>> Override ignored for property "wo.bootstrapjar"
    >>> Override ignored for property "wo.network.frameworks"
    >>> Override ignored for property "wo.api.root"
    >>> Override ignored for property "wo.network.root"
    >>> Override ignored for property "wo.extensions"
    >>> Override ignored for property "web.framework.install.root"
    >>> Override ignored for property "wo.user.root"
    >>> Override ignored for property "wo.local.frameworks"
    >>> Override ignored for property "wo.apps.root"
    >>> Override ignored for property "build.root"
    >>> Override ignored for property "wo.local.root"
    >>>
    >>> Why is it ignoring my settings?
    >>>
    >>> Dave
    >>
    >



    This archive was generated by hypermail 2.0.0 : Tue Oct 19 2010 - 12:56:04 UTC