Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-12-2006, 03:01 AM
julien.evrard julien.evrard is online now
Registered User
 
Join Date: 08-23-2006
Posts: 10
Creating builder in script, with right context

Hi!

i saw in your samples how to create a builder, load a project, and "SyncBuild".
but even if the context of the new application is "automation ", i can't see the GUI for the created builder, even if the script is executed in a application object launched in GUI way.

In fact, i want to create a custom step, and launch a bld project in its "vbld_BuildStep". So, i want the created builder to have the context of the application the custom step is.

this is the code of the custom step:



Function vbld_BuildStep()
Dim objApp, objBld, objMacro

' create VisBuildPro app and build objects and connect
Set objBld = CreateObject( "VisBuildSvr6.Builder" )
Set objApp = CreateObject( "VisBuildSvr6.Application" )


'objApp.Initialize vbldContextGUI this generate an error: Error in Action (VBScript) script code at Line 9, Column 2 (Type mismatch: 'objApp.Initialize')

objBld.Initialize objApp
objApp.Project.Load "myfile"
objBld.SyncBuild

End Function
Reply With Quote
  #2  
Old 09-12-2006, 06:41 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The VBP automation objects wrap the underlying object model and not the GUI. The only way to get a GUI automatically is to explicitly launch the GUI app via the command-line:
http://www.visualbuild.com/Manual/command_linegui.htm

You could use the Builder.RunProgramEx method to do that from script:
http://www.visualbuild.com/Manual/ru...amexmethod.htm

Code:
If Application.Context = vbldContextGUI Then
  exe = %VISBUILD%
Else
  exe = %VISBUILDCMD%
End If

Step.BuildStatus = Builder.RunProgramEx(exe & " /b ""%VISBUILDDIR%\Samples\RegEdit.bld""")
Reply With Quote
  #3  
Old 09-12-2006, 07:04 AM
julien.evrard julien.evrard is online now
Registered User
 
Join Date: 08-23-2006
Posts: 10
i've got some problems:
1) i have to put Application.ExpandMacros( "%VISBUILD%" ) instead of %VISBUILD% (but maybe that was what you meant )
2) i don't have the logging of the created application
3) the step status is successfull, even when not.

in fact, i have to call a bld file, passing it many macros. instead of puting each time the list of macro to pass and their value in a visbuildpro step, i would like to have my custom step with GUI to set the macros.

i saw visbuildpro step used Com class "VisBuildCore6.ChainAction". any hope to use it, adding some tabs or proerty to the GUI? or any way else, i would be glad to listen to your suggestions

thanks
Reply With Quote
  #4  
Old 09-12-2006, 02:35 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
1. The sample code was from a Run Script step. If your script code is in a custom user action, macro references are not automatically expanded and Application.ExpandMacros is needed.

2. Use the same log file for both the parent and child project.

3. For custom actions, the return value of the vbld_BuildStep method indicates success/failure.
http://www.visualbuild.com/Manual/userdefaction.htm

vbld_BuildStep = Builder.RunProgramEx(...

Not sure what you're trying to achieve, but some possibilities:

1) Generate and display an HTML report from the XML build log rather than depending on a GUI VBP instance getting launched.
http://www.visualbuild.com/Manual/tr...mlogaction.htm

2) Just use a VisBuildPro Project action instead of a custom user action.
http://www.visualbuild.com/Manual/vi...projaction.htm

3) Passing macros via the command-line is fairly straightforward if you must invoke the GUI. You can also use other methods to pass the values (for instance, store in temporary macros and save the macros file in the caller, then load the temp macros in the callee).
Reply With Quote
  #5  
Old 09-13-2006, 03:14 AM
julien.evrard julien.evrard is online now
Registered User
 
Join Date: 08-23-2006
Posts: 10
i finally managed to do what i want (thanks to your help :-) ).

in fact, all i really want is to have a "custom visbuildpro step". i know you can pass macro to the called project but:
1) you have to know which macros this project might expect
2) you have either to always pass all needed macro to the project, or to create the macro in the called project, with default value.
3) the macro might not have friendly name, and for example, it's easier to check a checkbox "Compile with Visual Studio 2005" than to put value [true] to a macro called COMPILE_VS_2005... that's why i would like to set the needed macro via a GUI. because i maybe not always work for my company (we don't know!) and i want to ease the work of the next person who would have to handle the build process.
Reply With Quote
  #6  
Old 09-13-2006, 10:05 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
1) How could you meaningfully prompt for values if you don't know what to prompt for?

2) For yes/no parameters, you could use a build rule of

%MACRO_NAME% is defined

(or is undefined)

Then you don't need to predefine the macro but can toggle the behavior by passing on the command line (even to an empty value).

3) Sounds like you want your own custom GUI front-end to the build process. See here for ways to do that (2nd paragraph):
http://www.visualbuild.com/Manual/promptsample.htm
Reply With Quote
  #7  
Old 09-13-2006, 10:20 AM
julien.evrard julien.evrard is online now
Registered User
 
Join Date: 08-23-2006
Posts: 10
imagine A project call B project. to work correctly, B needs A to pass him macros. let's imagine for example that B is a project in which you do some SVN steps, VS .NET steps and NSIS steps. you need at least to pass the path to the csproj (or vbproj or sln), the SVN URL, etc.
the person who launch B from A know macro he has to pass, but maybe he doesn't know their names. so in my custom step i added a tab and properties (checkbox, etc...) very easily, but i have to transform the step properties (data entered by the user in the fields) to macros, launch a visbuildpro instance, passing the macros, retrieving the status of B, etc... all this in VBScript. it is not so hard, but it would have been handy to have an "advanced visbuildpro step".
i join a doc to explain with pictures.
Attached Files
File Type: zip custom step.zip (74.1 KB, 1511 views)
Reply With Quote
Reply


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 01:30 PM.


Copyright © 1999-2023 Kinook Software, Inc.