Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] Third Party Tools (https://www.kinook.com/Forum/forumdisplay.php?f=3)
-   -   Vss Conditional Build (https://www.kinook.com/Forum/showthread.php?t=3450)

omar_ita 02-06-2008 04:22 AM

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 :)

omar_ita 02-06-2008 04:33 AM

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.

kinook 02-06-2008 09:36 AM

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

omar_ita 02-07-2008 03:34 AM

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:








NETAction.Test


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 . 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!


All times are GMT -5. The time now is 08:39 AM.


Copyright © 1999-2023 Kinook Software, Inc.