Announcement

Collapse
No announcement yet.

Pass path variable via ANT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Guest's Avatar
    Guest replied
    Re: Pass path variable via ANT

    Thanks I will give these a try.

    Leave a comment:


  • Lutz
    replied
    Re: Pass path variable via ANT

    Hi!

    adding

    [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    "DisableUNCCheck"=dword:00000001

    to the registry might solve the CMD.exe problem with UNC paths.

    Greetings Lutz

    Leave a comment:


  • Chris
    replied
    Re: Pass path variable via ANT

    It might be that CMD.exe is having trouble with the UNC paths.

    Calling Beyond Compare directly without CMD.exe worked with UNC paths on my system.

    Code:
    <project name="bcscript" default="bc" basedir=".">
    	<property name="BEYONDCOMPARE_HOME" value="c:\progra~1\beyond~1"/>
    	<property name="BEYONDCOMPARE_SCRIPT" value="c:\w\script.txt"/>
    	<property name="GA_folder" value="\\server\share\source"/>
    	<property name="compare_folder" value="\\server\share\target"/>
    	
    	<target name="bc" if="BEYONDCOMPARE_HOME">
    		<exec executable="${BEYONDCOMPARE_HOME}\bc2.exe">
    			<arg value="/silent"/>
    			<arg value="@${BEYONDCOMPARE_SCRIPT}"/>
    			<arg value="${GA_folder}"/>
    			<arg value="${compare_folder}"/>
    		</exec>
    	</target>
    </project>

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: Pass path variable via ANT

    Thanks Chris it was the double quotes in the BC script that was causing the problem DOH! Thanks for all your help. I still have one problem but I can get round it, I can't pass in a path with \\ in order to go to paths on the network. I can of course copy these paths locally and then do the compare, but just wondering...

    Leave a comment:


  • Chris
    replied
    Re: Pass path variable via ANT

    I just tried a simple setup with Ant to run a BC script, and I did get successful output.

    Here's my build.xml:
    Code:
    <project name="bcscript" default="bc" basedir=".">
     <property name="BEYONDCOMPARE_HOME" value="c:\progra~1\beyond~1\"/>
     <property name="BEYONDCOMPARE_SCRIPT" value="c:\w\script.txt"/>
     <property name="GA_folder" value="c:\w\source"/>
     <property name="compare_folder" value="c:\w\target"/>
    
     <target name="bc" if="BEYONDCOMPARE_HOME">
      <exec executable="cmd.exe">
       <arg value="/c ${BEYONDCOMPARE_HOME}\bc2.exe @${BEYONDCOMPARE_SCRIPT} "/>
       <arg value="${GA_folder} "/>
       <arg value="${compare_folder} "/>
      </exec>
     </target>
    </project>
    And the script:
    Code:
    load %1 %2
    expand all
    select all.files
    folder-report layout:side-by-side options:display-mismatches output-to:c:\w\report.txt
    I notice in your script, you have quotes inside the script. The arguments should already be quoted on the command line, so quoting inside the script around %1 and %2 might result in a double quote ""path"".

    Try removing the quotes around %1 and %2 in your Beyond Compare script and let me know if that helps.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: Pass path variable via ANT

    Yes the script runs fine on the command line, I'm able to pass in the paths to BC file no problem. Here is the log file for the ant target I'm calling:
    [exec] Current OS is Windows 2000
    [exec] Executing 'cmd.exe' with arguments:
    [exec] '/c C:\BC2\bc2.exe @C:\test\BC_file_compare.txt '
    [exec] '\\iefiles4\Groups\Builds\Builds\BWAC\BWAC_Release _builds\BWAC-020500-PATCH06-BUILD16-ga\bin\Release '
    [exec] '\\iefiles4\Groups\Builds\Builds\BWAC\BWAC_Release _builds\BWAC-020500-PATCH06-BUILD44'
    [exec]
    [exec] The ' characters around the executable and arguments are
    [exec] not part of the command.

    And here is some of the report produced:
    Report:
    FOLDER COMPARISON
    Produced: 19-02-2008 11:40:59

    Mode: Just Mismatches
    Left base folder:
    Right base folder: \\iefiles4\Groups\Builds\Builds\BWAC\BWAC_Release_ builds\BWAC-020500-PATCH06-BUILD16-ga\bin\Release
    Name Size Modified Name Size Modified
    -----------------------------------------------------------------------------------
    << BWC_CDMConfig.exe.cloned 81,920 12-02-2008 16:47:57

    Leave a comment:


  • Aaron
    replied
    Re: Pass path variable via ANT

    Does the script work if you call it manually from the command line?

    And, is there a way for ANT to output its command line call, so you can see the text it is passing/typing right before the call is made?

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Re: Pass path variable via ANT

    these are the paths:
    compare_folder="\\iefiles4\Groups\Builds\Builds\BW AC\BWAC-2506-Nightly\${DSTAMP}\bin\Release"
    GA_folder ="\\iefiles4\Groups\Builds\Builds\BWAC\BWAC_Releas e_builds\BWAC-020500-PATCH06-BUILD16-ga\bin\Release"

    Hope this helps

    Leave a comment:


  • Aaron
    replied
    Re: Pass path variable via ANT

    I cannot be positive without seeing your paths, but you may be running into an issue where the path is not passed in correctly to BC.
    In some cases, paths need to be surrounded by quotes:
    c:\bc2.exe @script.txt "c:\program files\test" "c:\temp\test"
    In this case, the space in program files then requires that there are quotes around that path.

    Is there a way for ant to output a solid command line of what it is actually calling? example:
    "c:\program files\beyond compare\bc2.exe @yourscriptname.txt c:\path1 nameseperated\folder c:\path2namenotseperated\folder"

    If there is any sensitive information you do not want to share over the forums, but are comfortable showing, you can email it to support@scootersoftware.com

    Leave a comment:


  • paulcollins
    started a topic Pass path variable via ANT

    Pass path variable via ANT

    Hi

    I have my BC and ANT scripts below, the problem I have is that while I can pass the value of the variable "GA_folder" into the BC script the "compare_folder" variable is not passed in. Can anyone tell me where I'am going wrong. <font color="black"> </font>
    Ant script:
    BEYONDCOMPARE_HOME = BC home dir
    BEYONDCOMPARE_SCRIPT = path to script and name of script.
    GA_folder = path to folder
    compare_folder = path to folder.
    <target name="testy" if="BEYONDCOMPARE_HOME">
    <exec executable="cmd.exe">
    <arg value="/c ${BEYONDCOMPARE_HOME}\bc2.exe @${BEYONDCOMPARE_SCRIPT} "/>
    <arg value="${GA_folder} "/>
    <arg value="${compare_folder} "/>
    </exec>
    </target>

    BC script:
    log verbose c:\log.log
    load "%1" "%2"
    expand all
    select all.files
    folder-report layout:side-by-side options:display-mismatches output-to:C:\test\report-test.txt
Working...
X