Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-15-2006, 08:43 PM
mballou mballou is online now
Registered User
 
Join Date: 04-21-2004
Posts: 8
Problem with LASTSTEP_OUTPUT and xml output

I'm using Vault 6.1 with the history command in my build script. Vault outputs the results in xml format which is perfect for my needs.

I'm writing a vbscript in Visual Build as the Stepdone event of the vault step, but it doesn't parse the xml correctly. I think I tracked the problem down to visual Build changing the xml text in the LASTSTEP_OUTPUT macro.

I use this line to get the text:
xmlText = vbld_AllMacros().Item("LASTSTEP_OUTPUT")

Instead of lines like this:
<item txid="225650" date="5/12/2006 8:57:35 AM" name="_Mainline/file.cpp" type="60" version="411" user="build" omment="Can't use single quote" actionString="Checked In" />

I get a line like this from the macro:
<item txid='225650' date='5/12/2006 8:57:35 AM' name='_Mainline/file.cpp' type='60' version='411' user='build' comment=Can't use single quote' actionString='Checked In' />

If you look closely, you will see that the double-quotes of the original output have been converted to single quotes. That by itself is still valid xml and can be loaded. My problem is that the output also contains single quotes which is not valid. the word "Can't" becomes invalid.

Is there some option that will let me get the real output of the command that hasn't been converted by Visual Build macro?

Thanks,
Mike Ballou

Last edited by mballou; 05-16-2006 at 01:02 PM.
Reply With Quote
  #2  
Old 05-16-2006, 01:07 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
VBP converts double quotes in step output macros to single quotes so that if these macros are referenced in a script expression like "%LASTSTEP_OUTPUT%", double quotes within the value will not cause problems. But this can lead to the situation you're describing if the output actually contains XML attribute values with single quotes. We'll add an option in the next release to disable conversion of double to single quotes in the output macros. For now, you can work around it by converting back to double quotes in the script event before using:

Code:
' convert single quotes surrounding XML attribute values possibly
' containing single quotes back to double quotes
output = Application.ExpandMacrosAndScript("%LASTSTEP_OUTPUT%")
Set re = New RegExp
re.Pattern = "(\s*=\s*)'(([^']|'[^\s])*)'(\s)"
re.Global = True	
output = re.Replace(output, "$1""$2""$4")
' do stuff with output
Reply With Quote
  #3  
Old 05-16-2006, 05:48 PM
mballou mballou is online now
Registered User
 
Join Date: 04-21-2004
Posts: 8
Perfect!

Thank you for the quick response. I look forward to the next version.
I tried your work around for converting the single quotes back to double quotes and it also works great.

Thanks,
Mike Ballou
Reply With Quote
  #4  
Old 08-02-2006, 10:42 AM
rmaines rmaines is online now
Registered User
 
Join Date: 08-02-2006
Posts: 11
We are also experiencing the same problem. The workaround works great for any comments containing a single quote followed by an s at the end of a word, but we've already had several comments containing single quotes in other parts of the comment field, ex: comment="Comment 'containing' single quotes"

We are building continuously, so if a comment contains a single quote, no changes are found because the xml does not load. Is there a timeframe when a new version will be available?
Reply With Quote
  #5  
Old 08-02-2006, 01:06 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The v6.2 beta (released today) has this capability. More details on the beta are here: http://www.kinook.com/Forum/showthre...?threadid=1973
Reply With Quote
  #6  
Old 08-02-2006, 06:01 PM
rmaines rmaines is online now
Registered User
 
Join Date: 08-02-2006
Posts: 11
I installed the beta and it fixed our problem. However, it introduces a new one....

The problem introduced is that in a step done event, I have a Builder.LogMessage statement, but the statement is not finding it's way into the log file.

When I uninstall the beta and reinstall 6.1, it's working fine, but I still have the single quote issue. Any ideas? let me know and i can send you the build project if needed.
Reply With Quote
  #7  
Old 08-02-2006, 09:52 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Another change (actually a bug fix) in this build is to not fire the vbld_StepStarted/vbld_StepDone events for a step that is skipped. Is that coming into play here?
Reply With Quote
  #8  
Old 08-03-2006, 09:40 AM
rmaines rmaines is online now
Registered User
 
Join Date: 08-02-2006
Posts: 11
Nope, this step is getting executed and the logic w/in the event is being processed, but the Builder.LogMessage output is no longer getting logged
Reply With Quote
  #9  
Old 08-03-2006, 01:33 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Can you ZIP and post or send a .bld file that demonstrates the problem, and the info from Help | About | Install Info? Thanks.
Reply With Quote
  #10  
Old 08-07-2006, 10:57 AM
rmaines rmaines is online now
Registered User
 
Join Date: 08-02-2006
Posts: 11
Attached are the bld files. Basically, the MediLinksCIC.bld fires the ChainMaster.bld. The ChainMaster fires a bunch that do basically the same thing. We can focus in on the MediLinks.bld one to keep it simple. This one is an example of the Builder.LogMessage not getting fired. You probably won't need the first 2 .bld's, but just so you can see our process in its entirety.
Attached Files
File Type: zip nobuilderlogmessage.zip (15.5 KB, 2015 views)
Reply With Quote
  #11  
Old 08-07-2006, 01:24 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
I can't find a Builder.LogMessage call in any vbld_StepDone event in the attached files. Please pare things down to a reproducible sample we can build here. Thanks.
Reply With Quote
  #12  
Old 08-07-2006, 01:28 PM
rmaines rmaines is online now
Registered User
 
Join Date: 08-02-2006
Posts: 11
So sorry, i should have pointed out that the StepDone calls a Global Function which contains the Builder.LogMessage, which you probably don't get by me sending you the .bld files.

In the Build Solution step of MediLinks.bld, there is a call to CreateReportLink (the global function). It is in this function that the message does not get logged. Below is the global function note that it is also calling a URLEncode function which i've also provided below):

Sub CreateReportLink(LinkHeader, ReportDir, FileName)

Dim strHTML
Dim file

Builder.LogMessage LinkHeader

strHTML = "<HTML>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<a href='..\" & URLEncode(ReportDir & FileName) & "'>" & FileName & "</a>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

Builder.LogMessage(strHTML)

End Sub

Public Function URLEncode(sRawURL)
Const sValidChars = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm nopqrstuvwxyz:/.?=_-$(){}~&\"

If Len(sRawURL) > 0 Then
' Loop through each char
For iLoop = 1 To Len(sRawURL)
sTmp = Mid(sRawURL, iLoop, 1)

If InStr(1, sValidChars, sTmp, vbBinaryCompare) = 0 Then
' If not ValidChar, convert to HEX and prefix with %
sTmp = Hex(Asc(sTmp))

If sTmp = "20" Then
sTmp = "+"
ElseIf Len(sTmp) = 1 Then
sTmp = "%0" & sTmp
Else
sTmp = "%" & sTmp
End If
End If
sRtn = sRtn & sTmp
Next
URLEncode = sRtn
End If
End Function
Reply With Quote
  #13  
Old 08-07-2006, 02:55 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
LogMessage calls from script event code for a step with logging disabled were incorrectly suppressed. This is fixed in the latest beta download.
Reply With Quote
  #14  
Old 08-07-2006, 03:33 PM
rmaines rmaines is online now
Registered User
 
Join Date: 08-02-2006
Posts: 11
Thank you very much. I don't see a new download though, just the same one (6.2). Will this be available soon?
Reply With Quote
  #15  
Old 08-07-2006, 03:42 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
It is, just download it again (it's still the v6.2 beta, only better). VisBuildBld.dll version (Help | About | Install Info) will be 6.1.9.37 after installing.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 02:01 AM.


Copyright © 1999-2023 Kinook Software, Inc.