4.0.2 New Nant Tasks Missing Examples
Moderator: SourceGear
4.0.2 New Nant Tasks Missing Examples
Hello All,
It would appear that the new Nant Contrib files for Valut 4.0.2 have changed . So after updating to the new version on Vault and to the new contrib files all my checkin, checkout, getlatest scripts are now failing as it is expecting parameters I do not pass. Can anyone tell me the general parameters need to be passed to a task in the NEW contrib files as the new documentation does not provide any examples.
Example of the old get file: What should be passed for the new files 4.0.2 (Poor documentation on SourceGears Part)
<vaultgetfile url="http://localhost"
username="username"
password="password"
repository="repository"
path="$/Project/Directory/File.cs"
destination="C:\Directory\File.cs"/>
Thanks Again,
Adam
It would appear that the new Nant Contrib files for Valut 4.0.2 have changed . So after updating to the new version on Vault and to the new contrib files all my checkin, checkout, getlatest scripts are now failing as it is expecting parameters I do not pass. Can anyone tell me the general parameters need to be passed to a task in the NEW contrib files as the new documentation does not provide any examples.
Example of the old get file: What should be passed for the new files 4.0.2 (Poor documentation on SourceGears Part)
<vaultgetfile url="http://localhost"
username="username"
password="password"
repository="repository"
path="$/Project/Directory/File.cs"
destination="C:\Directory\File.cs"/>
Thanks Again,
Adam
There is a chm file that is included in the NAnt tasks distribution. That has all of the documentation for the new tasks. For examples using the new NAnt tasks, look at: http://support.sourcegear.com/viewtopic.php?t=8019
All of the 4.0.1 examples work for 4.0.2 as well, and will continue to work for all 4.0.x releases.
Here's the example of how to do the get that you posted in your first post
You can optionally provide a getoptions structure to control how the get behaves with regard to writable flags and file time.
You're right that our chm file is not as explicit as it should be in the description of which attributes are required and which are not. I'll log a bug against our documentation and make sure that it's fixed soon.
Here's the example of how to do the get that you posted in your first post
Code: Select all
<vaultgettolocationoutsideworkingfolder destPath="C:\Directory">
<vaultfileset>
<include name="$/Project/Directory/File.cs" />
</vaultfileset>
</vaultgettolocationoutsideworkingfolder>
You're right that our chm file is not as explicit as it should be in the description of which attributes are required and which are not. I'll log a bug against our documentation and make sure that it's fixed soon.
As is shown in the NAnt examples post above, here's the steps to set your connection:
Any subsequent Vault NAnt task calls will use that connection.
Code: Select all
<!--Load the Fortress or Vault Nant tasks-->
<loadtasks path="c:/path/to/nant/tasks/dll" verbose="true" />
<!--Set the login options: username, password, and server url-->
<vaultsetloginoptions user="username" password="password" URL="http://VaultServer/VaultService" />
<!--Connect to NantTestRep-->
<vaultsetrepository repositoryName="NantTestRep" />
Solution
Thank You Very Much!
Ok below I have posted the complete solution for how to create a task called get latest using 4.0.2 Nant Task (although from the documentation it might have been hard to determine that the old getLatest task name has been changed to vaultgettolocationoutsideworkingfolder )
<target name="getLatest">
<!--Load the Vault Nant tasks-->
<!-- The folder you point to CAN ONLY CONTAIN THE NANT .DLL's for the new Contrib Files so NO other contrib files -->
<loadtasks path="C:\BuildTools\nant\bin\dll" verbose="true" />
<!--Set the login options: username, password, and server url URL="http://vaultserver/VaultService-->
<vaultsetloginoptions user="${UserName}" password="${Password}" URL="${VaultServer}" />
<!-- Set the Nant Repository you can get this when you log into vault or via options -->
<vaultsetrepository repositoryName="${Repository}" />
<vaultgettolocationoutsideworkingfolder destPath="C:\SolutionFolderLocal">
<vaultfileset>
<include name="$/SolutionFolderVault" />
</vaultfileset>
</vaultgettolocationoutsideworkingfolder>
</target>
- I am also assuming this gets latest on everything. So this should overwrite all files in the solution regardless if they are checked out, not ther etc.
Ok below I have posted the complete solution for how to create a task called get latest using 4.0.2 Nant Task (although from the documentation it might have been hard to determine that the old getLatest task name has been changed to vaultgettolocationoutsideworkingfolder )
<target name="getLatest">
<!--Load the Vault Nant tasks-->
<!-- The folder you point to CAN ONLY CONTAIN THE NANT .DLL's for the new Contrib Files so NO other contrib files -->
<loadtasks path="C:\BuildTools\nant\bin\dll" verbose="true" />
<!--Set the login options: username, password, and server url URL="http://vaultserver/VaultService-->
<vaultsetloginoptions user="${UserName}" password="${Password}" URL="${VaultServer}" />
<!-- Set the Nant Repository you can get this when you log into vault or via options -->
<vaultsetrepository repositoryName="${Repository}" />
<vaultgettolocationoutsideworkingfolder destPath="C:\SolutionFolderLocal">
<vaultfileset>
<include name="$/SolutionFolderVault" />
</vaultfileset>
</vaultgettolocationoutsideworkingfolder>
</target>
- I am also assuming this gets latest on everything. So this should overwrite all files in the solution regardless if they are checked out, not ther etc.
Jeremy,
Is there a way to use the above command but specify the dest folder as a working folder. I tried removing it but it says its required. But when I have it set to the actual working folder it tells me to remove it this should be a bug of sorts. Or you should enable the destFolder to be specified in the standard valutget class not sure why it was removed or create an override for that constructor etc.
Let me know thanks,
Adam
Is there a way to use the above command but specify the dest folder as a working folder. I tried removing it but it says its required. But when I have it set to the actual working folder it tells me to remove it this should be a bug of sorts. Or you should enable the destFolder to be specified in the standard valutget class not sure why it was removed or create an override for that constructor etc.
Let me know thanks,
Adam
If you want to do a get to a working folder, then use the <vaultget> task. It doesn't take a destPath, so you will need to verify that you've already set the working folder before calling the vaultget task. All of this is covered in the second example on this page: http://support.sourcegear.com/viewtopic.php?t=8019
Hello, my name is Joe and I work with AdamL3024. The information you have given us so far has worked perfectly and we are now able to get latest and Build. The only problem we are still having is that CheckInVersion fails every other time we run the script. It seems to always be failing the first time we run the script and check out the code. When we rerun the script and the file is already checked out from the precious run it Checks in fine, it's only occurring as I said when we first Check Out the File. If you have any ideas on how we can fix this I would really appreciate it and if you need any other information about the error or something please let me know as soon as possible. Thanks.
Hi Joe,
Glad to hear you've got your build back up and running again. Can you give me any more information about this error? The output/error messages and the section of the script that seems to be failing would probably be helpful.
Also, is it only one particular file the operations are failing on or several?
Glad to hear you've got your build back up and running again. Can you give me any more information about this error? The output/error messages and the section of the script that seems to be failing would probably be helpful.
Also, is it only one particular file the operations are failing on or several?
Hello Shannon,
Sorry it took so long to respond. We are running into a few different issues with the file still. The first issue that has been occurring is the issue I stated in the previous Post. Going in order on the file, first we Log into Vault. Next we check out the version file, then call an executable to change the version file, and then we check the file back into Vault. As I stated before the issue occurs when a Target is called. All this target does is use the task vaultcheckin and the vaultfileset task to check the file back in. Here is an example of the tasks below.
<vaultcheckin unchanged="checkin">
<vaultfileset>
<include name="C:\project\directory\file.cs>
</vaultfileset>
</vaultcheckin>
Originally I had it setup without the unchanged parameter, but added it later when the checkin kept failing.
Here is the exact Error Message that I receive when the CheckIn fails:
"INTERNAL ERROR
System.exception: The current change set does not have any items for C:\project\directory\file.cs
at VaultClientIntegrationLib.ServerOperations.ProcessCommandCommit(String[] objectPaths, UnchangedHandler unchanged, Boolean keepChe
ckedOut, LocalCopyType localCopy)
at VaultClientIntegrationLib.ServerOperations.ProcessCommandCheckIn(String[] objectPaths, UnchangedHandler unchanged, Boolean keepCh
eckedOut, LocalCopyType localCopy)
at NAnt.Contrib.Tasks.SourceGearVault.vaultcheckin.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Tasks.CallTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
Please send bug report to nant-developers@lists.sourceforge.net."
-- END OF ERROR MESSAGE --
Any Suggestions, the SOONER the better, we need this to be working ASAP!!. Thank you. Joe
Sorry it took so long to respond. We are running into a few different issues with the file still. The first issue that has been occurring is the issue I stated in the previous Post. Going in order on the file, first we Log into Vault. Next we check out the version file, then call an executable to change the version file, and then we check the file back into Vault. As I stated before the issue occurs when a Target is called. All this target does is use the task vaultcheckin and the vaultfileset task to check the file back in. Here is an example of the tasks below.
<vaultcheckin unchanged="checkin">
<vaultfileset>
<include name="C:\project\directory\file.cs>
</vaultfileset>
</vaultcheckin>
Originally I had it setup without the unchanged parameter, but added it later when the checkin kept failing.
Here is the exact Error Message that I receive when the CheckIn fails:
"INTERNAL ERROR
System.exception: The current change set does not have any items for C:\project\directory\file.cs
at VaultClientIntegrationLib.ServerOperations.ProcessCommandCommit(String[] objectPaths, UnchangedHandler unchanged, Boolean keepChe
ckedOut, LocalCopyType localCopy)
at VaultClientIntegrationLib.ServerOperations.ProcessCommandCheckIn(String[] objectPaths, UnchangedHandler unchanged, Boolean keepCh
eckedOut, LocalCopyType localCopy)
at NAnt.Contrib.Tasks.SourceGearVault.vaultcheckin.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Tasks.CallTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
Please send bug report to nant-developers@lists.sourceforge.net."
-- END OF ERROR MESSAGE --
Any Suggestions, the SOONER the better, we need this to be working ASAP!!. Thank you. Joe
I have copied the portion of the script that is used to CheckOut, Change, and then CheckIn the Version.cs file.
<?xml version="1.0" encoding="utf-8" ?>
<project name="DefaultBuild" default="complete" basedir="." >
<description>This file Gets Latest on All Solutions Rebuilds and Publishes the Website </description>
<property name="ProjectName" value="C:\Folder\Folder\Project" />
<call target="CheckOutVersion"/>
<call target="ChangeVersion"/>
<call target="CheckInVersion"/>
<!-- Check Out VersionInfo.cs -->
<target name="CheckOutVersion">
<vaultcheckout>
<vaultfileset>
<include name="${ProjectName}\directory\VersionFile.cs" />
</vaultfileset>
</vaultcheckout>
</target>
<target name="ChangeVersion">
<exec program="C:\ExecutablePath\ChangeXMLVersion.exe"/>
</target>
<target name="CheckInVersion">
<vaultcheckin unchanged="CheckIn">
<vaultfileset>
<include name="${ProjectName}\directory\VersionFile.cs" />
</vaultfileset>
</vaultcheckin>
</target>
</project>
This is exactly what occurs during the change version tasks. First we set the project paths at the top of the file. Followed by the paths we call targets, here we are calling CheckOut, Change, and finally CheckIn "VersionFile.cs" targets. During CheckOut we declare the Project Path that the VersionFile.cs is located, CheckOut that file using the CheckOut and FileSet tasks. Then we wrote an executable that changes the version number, and finally we use the VaultCheckIn and FileSet tasks to check the VersionFile.cs back into Valut. So what is happening is if the VersionFile.cs is checked in and the task checks it out, when it comes time to check it back in the error I copied in above occurs. If we then rerun the file without manually checking the VersionFile.cs back in before the CheckIn works fine. So there must be something occurring during the CheclOut that stops the file from being checked in again. The example I copied in above is the exact tasks we use in the exact order we use them, this should be enough info to discover the problem. Again, the sooner the better, we are trying to release 2 versions this week and we NEED this script to be working ASAP. Thank you very much for all the help and I hope to hear from you soon. Thanks again. Joe
<?xml version="1.0" encoding="utf-8" ?>
<project name="DefaultBuild" default="complete" basedir="." >
<description>This file Gets Latest on All Solutions Rebuilds and Publishes the Website </description>
<property name="ProjectName" value="C:\Folder\Folder\Project" />
<call target="CheckOutVersion"/>
<call target="ChangeVersion"/>
<call target="CheckInVersion"/>
<!-- Check Out VersionInfo.cs -->
<target name="CheckOutVersion">
<vaultcheckout>
<vaultfileset>
<include name="${ProjectName}\directory\VersionFile.cs" />
</vaultfileset>
</vaultcheckout>
</target>
<target name="ChangeVersion">
<exec program="C:\ExecutablePath\ChangeXMLVersion.exe"/>
</target>
<target name="CheckInVersion">
<vaultcheckin unchanged="CheckIn">
<vaultfileset>
<include name="${ProjectName}\directory\VersionFile.cs" />
</vaultfileset>
</vaultcheckin>
</target>
</project>
This is exactly what occurs during the change version tasks. First we set the project paths at the top of the file. Followed by the paths we call targets, here we are calling CheckOut, Change, and finally CheckIn "VersionFile.cs" targets. During CheckOut we declare the Project Path that the VersionFile.cs is located, CheckOut that file using the CheckOut and FileSet tasks. Then we wrote an executable that changes the version number, and finally we use the VaultCheckIn and FileSet tasks to check the VersionFile.cs back into Valut. So what is happening is if the VersionFile.cs is checked in and the task checks it out, when it comes time to check it back in the error I copied in above occurs. If we then rerun the file without manually checking the VersionFile.cs back in before the CheckIn works fine. So there must be something occurring during the CheclOut that stops the file from being checked in again. The example I copied in above is the exact tasks we use in the exact order we use them, this should be enough info to discover the problem. Again, the sooner the better, we are trying to release 2 versions this week and we NEED this script to be working ASAP. Thank you very much for all the help and I hope to hear from you soon. Thanks again. Joe
Thank you for your patience. I've reproduced this and I have a fix and a workaround.
The fix will be in the 4.0.3 release.
In the meantime, I have this workaround: if you call vaultlistcheckouts between your vaultcheckout and vaultcheckin calls it should detect the checkout and checkin properly.
Sorry for the trouble you've had with this.
The fix will be in the 4.0.3 release.
In the meantime, I have this workaround: if you call vaultlistcheckouts between your vaultcheckout and vaultcheckin calls it should detect the checkout and checkin properly.
Sorry for the trouble you've had with this.