Author Topic: Using SlickEdit to edit NAnt build files  (Read 8589 times)

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Using SlickEdit to edit NAnt build files
« on: July 01, 2006, 05:09:50 AM »
<CreditAndKudos>
GaryMC has a nice blog entry about this topic at http://jesq.blogspot.com/2006/06/nant-with-slickedit.html
</CreditAndKudos>

Inhouse, we use NAnt to automate our builds for the SlickEdit Tools for Visual Studio project. (Setting up the schema URL mapping is key to maintaining ones sanity)

Anyhow, I found that as my build files grew, it was a good idea to separate a lot of the commonly used properties and tasks into several files and simply use NAnt's <include buildfile="..."> elements to pull them in. Works great, but now the declarations of my properties and tasks can be all over the map in several directories. And if I am coming back to edit a .build file that I haven't touched in a month, I usually don't remember exactly which included file contains a specific property or task definition.

Since I'm way too lazy to fully implement NAnt as a real "language" (with tagging and statement parsing), I ginned up this handy macro to do a push-tag (Ctrl + .) -style navigation to a task or property definition. So, for example, if I'm editing the line
<fileset basedir="${wix.root}">
and I can't remember where or how I defined the property wix.root, I can simply place the caret in (or select) wix.root, go to the command line and type the nant-def (or nd) command (contained in the attached nant.e macro file) and it will search the current file and any included files for the definition. Which just happens to be 
<property name="wix.root" value="${project.root_dir}\installer\Wix"/>

 Same applies when you're faced with
<call target="clean_installer_msi"/>
and the exact location of clean_installer_msi eludes you, then nd will spirit you away to 
<target name="clean_installer_msi" description="Wipe out existing compiled installer">
And it actually does push a bookmark if it finds a definition, so Ctrl+, will take you back to your previous spot.

Anyone want to take this and run with it to include support for Ant and MSBuild syntax? :-)