#1
|
|||
|
|||
Automating check out /check in of each step?
The company I work for uses Visual Sourcesafe, and Visual Build Pro. I need to check out the current step, build it, then check it back in (so the version number in the project file is altered correctly, for instance in a .VBP for visual basic). I also need to make it so that if the file cannot be checked out (because someone else has the file checked out) that it does not continue with the build / check in.
How can I script something along these lines or automate it somehow ... if not isCheckedOut(currStep.project) then checkOut(currStep.project) build(currStep) checkIn(currStep.project) Thanks for any advice in advance. |
#2
|
|||
|
|||
It's normally automatic. If the checkout step fails (which it will if a file that you attempt to checkout is already checked out [provided that you don't have multiple checkouts enabled in VSS]) and the step is not marked to ignore failure, the build will not continue.
|
#3
|
|||
|
|||
Sorry, maybe I phrased my question badly. What I'm after is some generic piece of code that I can run before and after each step (preferably automatically so i dont have to add it before / after each step) which checks out that steps project then checks it back in after build.
The machine we use to build our software keeps a local copy of the entire of sourcesafe which is automatically grabbed at the start of our Build script, so with each step we are compiling from that local (non-checked out) project. The problem is, the original project files are not registering any version change because they were never updated (checked out and in). So although the version number is being udpated LOCALLY each time, the version in sourcesafe still has the old version number. Because our build script is so large we need the ability to be able to build an individual project, so we dont want to check out ALL of our projects each time. So basically i want something like the following. Steps... Get All of SourceSafe Build App1 (auto check out / in) Build App2 (auto check out / in) Build App3 (auto check out / in) Thanks for the prompt response, sorry if I'm not explaining this very well. |
#4
|
|||
|
|||
One way to do this would be to create a subroutine that generically checks out a VBP, builds it, and checks it in, and then call this subroutine for each project that needs to be built.
|
#5
|
|||
|
|||
Thats really what i'm getting at, how would I build a 'generic' sub.
How can i get the filename of the current project so that I can check it out / in? I had a look at the pre-defined variables but I couldnt quite what I needed. |
#6
|
|||
|
|||
See the Advanced.bld sample. The 'Call a Subroutine' step passes a macro SUB_PARM1 to the 'Another Sub' subroutine, which uses that macro in a Log Message step.
|
#7
|
|||
|
|||
Okay, thanks that is how I pass values to a sub - but how can i pass the filename of the main step in that group? If i have to type the entire filename again for the checkout / checkin step then i'm better creating 40 checkout and 40 checkin steps for each of the 40 programs. It just seems very tedious
|
#8
|
|||
|
|||
What do you mean by 'the filename of the main step in that group'?
|
#9
|
|||
|
|||
Okay, we tend to put each app in its own group
so what i really want is mygroup -Checkthisprogout (generically so i dont have to type info in) -buildthisprog (the main step in the group, probably referring to a visual basic project, so a local .vbp file) -Checkthisprogin (generically so i dont have to type info in) |
#10
|
|||
|
|||
I'm not sure if you are using 'group' and 'project' interchangeably, or if you actually have VBGs that each contain one VBP, but it sounds like you want a single step in your .bld file for each .VBP that might get built (so that you can selectively include only the ones you want to build at a certain time). You can use a single Subroutine Call step for each .VBP file, which passes the .VBP filename in a macro, then use that filename in the subroutine to checkout, build, and checkin. You will need to convert the filename to a VSS path for the checkin/out steps, and how that conversion is done depends on your directory and VSS structure. See the attached sample for one approach. Let me know if that helps or if I'm totally off track.
|
#11
|
|||
|
|||
Thanks very much for all your help so far, im off home now but i'll check this out first thing in the morning.
|
#12
|
|||
|
|||
I think with this and looking at the other samples I have this thing licked, thanks a lot for your help!
|
|
|