PDA

View Full Version : True unattended build?


sr91
01-28-2008, 03:41 AM
I was happy to read that Visual Patch supports for unattended builds and was almost decided in my mind that our company would by the software, but after looking closer it seems that the unattended build features are not enough to feed our needs. Please tell me that I am wrong.

My build process is based on Nant (which can of course call any program and pass arguments). For the patching consideration, we were looking for a program that could:

- Take two directories: DirA and DirB, containing the old and the new version. Based on those 2 directories, the program could produce a diff patch that would move any DirA into a DirB.
- Control that a patch to move from v1.4 to v1.5 will not work if applied on a v1.6 (the system controls the previous version).
- Can be automated.

It seems that the two first points are ok, but as far as I have seen, the bulk of the work is done with a GUI. We'd like to do it through a command line.

Currently, VisualPatch only support building the patch, when everything is already setup. We basically would like to setup the patch using the command line or an API in order to integrate the patch creation in an automated Nant script (having our support engineers to deal manually with a GUI every time we need a patch is not an option unfortunately).

I saw that the vp2 file is in XML so in last resort we can virtually build up our own vp2 file before calling the "unattended" build of VP. However the format of this file is not trivial and I guess not documented at all.

Thanks in advance for your advises!


Sylvain

Lorne
01-28-2008, 12:22 PM
If you're just want to build patches between two directories, then it should be possible, using build constants (Publish > Settings > Constants tab).

Here's how I would do it:

Set up a project with two version tabs. Use constants for the version names, e.g. #OLD_VERSION# and #NEW_VERSION#.

On each tab, add a folder reference to the appropriate source folder (your Dir A or Dir B). If the folder paths need to change between builds, use constants for the "Local folder" settings as well.

On each tab, add a single file from the source folder, to serve as the key file. In the file properties, make sure that "Key file" is checked. (Visual Patch requires that a key file is defined in order to build the patch.) If this file will need to change between builds, use constants for the "Filename" and "Local folder" settings.

Now you can use the /CONST command line option to specify an INI file containing values for the constants you defined. For example:

[Constants]
#OLD_VERSION#=1.5
#NEW_VERSION#=1.6
#DIR_A#=C:\Patch\My App\1.5
#DIR_B#=C:\Patch\My App\1.6
#KEYFILE_A#=myapp.exe
#KEYFILE_B#=myapp.exe

sr91
06-04-2008, 11:06 AM
Thank you Lorne.

I managed to make this work (it has been some time since I asked the question and it is only today we are really looking for implementing our processes).

I have a problem though: how can I exclude 1 or more files from a diff?

In my #DIR_A# and #DIR_B#, I want the diff to take in consideration all my files by default, except a few files (like the configuration files of the patched application, that I dont want to get changed because it contains user's changes).

in my list of files for my patch, I have (with x: A or B):
- #DIR_x#\*.*
- #DIR_x#\MyKeyFile

I can't figure out how to "exclude" one or two files. I tried to add a new file like:

- #DIR_x#\app1.config
- #DIR_x#\app2.config

and I set the script condition to be "false". It does not work. My app1.config and app2.config are still considered in my patch.

I also tried to uncheck the "All Build Configurations" for the files I want to exclude in their properties, but still, i keep having them in my patch...


I also tried with the (NOT app1.config) in the properties of the *.* folder but I cant specify more than one file.


Any solution would be greatly appreciated.


Thanks in advance.

Sylvain

Lorne
06-04-2008, 12:45 PM
I was going to suggest adding the files that you want to "override" as individual files and then excluding them from that build configuration, but I just tried that and it doesn't work. The files get excluded from the build before the folder references are expanded, so the reference expansion overrides the exclusions (instead of the other way around).

I've logged that to be looked at; we might be able to add another exclusion pass after references are expanded in a future release. REF: 17488

In the mean time, I would use a different mask for the folder reference, for example set up a mask for files that do not match *.config, instead of *.*. Then add the .config files that you do want to patch, as individual items.

You can select the type of file mask ("Files that match" or "Files that do not match") on the Folder Reference Properties dialog.