Kinook Software Forums

Go Back   Kinook Software Forums > Visual Build Professional > [VBP] Third Party Tools

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-06-2008, 04:22 AM
omar_ita omar_ita is online now
Registered User
 
Join Date: 08-01-2007
Location: The Roman Empire - Italy
Posts: 7
Question Vss Conditional Build

Hello,

we are registered VBP users and are extremely satisfacted of it! Now we need to do the following:

Get the History of a VSS project and, if there are Check-ins after a label, compile and relabel with an increased version number.
For example look at this vss history output:

History of $/TestProject ...

***** test.txt *****
Version 2
User: Admin Date: 2/06/08 Time: 11:13a
Checked in $/TestProject
Comment:

***************** Version 3 *****************
Label: "1.0.0"
User: Admin Date: 2/06/08 Time: 11:02a
Labeled
Label comment:

***************** Version 2 *****************
User: Admin Date: 2/06/08 Time: 10:24a
test.txt added

***************** Version 1 *****************
User: Admin Date: 2/06/08 Time: 10:23a
Created
Comment:

As you can see, we created the file, labeled it (1.0.0), then checked it out, modified and checked it in.
We would like to get the last label version (1.0.0), rebuild project with modified sources and label it increasing version (1.0.1). So automatically go in this scenario:

History of $/TestProject ...

***************** Version 4 *****************
Label: "1.0.1"
User: Admin Date: 2/06/08 Time: 11:16a
Labeled
Label comment:

***** test.txt *****
Version 2
User: Admin Date: 2/06/08 Time: 11:13a
Checked in $/TestProject
Comment:

***************** Version 3 *****************
Label: "1.0.0"
User: Admin Date: 2/06/08 Time: 11:02a
Labeled
Label comment:

***************** Version 2 *****************
User: Admin Date: 2/06/08 Time: 10:24a
test.txt added

***************** Version 1 *****************
User: Admin Date: 2/06/08 Time: 10:23a
Created
Comment:

I think the key is to execute vss history then get vss output and process it parsing the text rows.
How can we do it?

Thnks in advance
Reply With Quote
  #2  
Old 02-06-2008, 04:33 AM
omar_ita omar_ita is online now
Registered User
 
Join Date: 08-01-2007
Location: The Roman Empire - Italy
Posts: 7
I created this .bat file that can be executed by VBP

@echo off
SET SSDIR=C:\VssTestDB
"C:\Program Files\Microsoft Visual Studio\VSS\win32\ss.exe" History $/TestProject -R -NL -I-N -Yadmin,admin > V:\Components\Build\history.txt

Now we can open output file and parse it with a C# console application. How to get this application output (for example a boot that tells "yes, compile" or "no, don't compile" or the new version number) and use it in VBP steps?

Thanks in advance.

Marius.
Reply With Quote
  #3  
Old 02-06-2008, 09:36 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,720
Use the SoureSafe action to invoke VSS, then parse the output (LASTSTEP_OUTPUT system macro) in the vbld_StepDone script event and process as needed (extract versions into temp macros, etc.).
http://www.visualbuild.com/Manual/systemmacros.htm
http://www.visualbuild.com/Manual/scriptevents.htm
Reply With Quote
  #4  
Old 02-07-2008, 03:34 AM
omar_ita omar_ita is online now
Registered User
 
Join Date: 08-01-2007
Location: The Roman Empire - Italy
Posts: 7
Thank for your reply.
I just did what you say, following the examples. So I execute Vss History, then get LASTSTEP_OUTPUT value and save it in a temp macro:

set xmlText = vbld_AllMacros.Item("LASTSTEP_OUTPUT")
vbld_TempMacros().Add "VSS_OUTPUT", xmlText

I need to treat the VSS output in a form where user decide if increase version manually or automatically and so on. So I created a C# custom action that takes VSS_OUTPUT as parameter and show a dialog:

<?xml version='1.0' encoding='utf-8'?>
<action DefaultProperty=''>
<GUI Category='Samples' Description='Test action implemented as C# .NET component' Bitmap='NETAction.ico'>
<Tab Name='NET Tab 1'>
<Field Name='VssOutput' Description='VSS History Output' Type='Edit'></Field>
</Tab>
</GUI>
<ActionComponent>NETAction.Test</ActionComponent>
</action>

In the C# code, whenever I try to get the parameter value

step.get_ExpProperty(builder, "VssOutput", (short) VarEnum.VT_BSTR);

I always get an empty string or an exception (cannot convert to void or something like that). I tryed ALL VarEnum types. No one works. Obviously if I send a string to custom Action instead of macro (for example "Hello!") then VarEnum.VT_BSTR works well.
If I look in the Macros pane, the VSS_OUTPUT value is <object>. Probably the key is to convert it to a string, isn't it?

Thanks,

Mario


***EDIT***
I just did a little change and it WORKS!!

not
set xmlText = vbld_AllMacros.Item("LASTSTEP_OUTPUT")
vbld_TempMacros().Add "VSS_OUTPUT", xmlText

but
xmlText = vbld_AllMacros.Item("LASTSTEP_OUTPUT")
vbld_TempMacros().Add "VSS_OUTPUT", xmlText

VSS_OUTPUT now is no more an object but a string and I can take it using VarEnum.VT_BSTR



Now using custom action I can do everything I want

Thanks!

Last edited by omar_ita; 02-07-2008 at 03:47 AM.
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 12:41 AM.


Copyright 1999-2019 Kinook Software, Inc.