CodeSmith Community
Your Code. Your Way. Faster!

CodeSmith Batch Utility

Latest post 12-27-2006 1:09 PM by mphafner. 23 replies.
  • 08-13-2003 4:16 AM

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    CodeSmith Batch Utility

    Hi all,


    Here's my contribution to the CodeSmith world: The CodeSmith Batch Utility.

    This utility is comprised of a library and console executable for running xml batch files which in turn run the CodeSmith console engine with the appropriate parameters. The batch files provide a more succinct way of expressing multiple parameters to the CodeSmithConsole program.

    Basic features:


    - A batch file can be defined containing any number of tasks, each comprising templates and their parameters.
    - Multiple templates can be specified for a task, resulting in multiple files being generated from the task's parameters.
    - A default property set can be specfiied, reducing the amount of duplicated properties.
    - Custom xml can be defined, which can be passed into a template (via a temp file) or transformed with XSLT into the standard parameter format.

    Enjoy,

    Ben Mackie

    Post Edited (pneutam) : 9/7/2005 1:50:42 AM GMT

    • Post Points: 520
  • 08-13-2003 9:51 AM In reply to

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    RE: CodeSmith Batch Utility

    Updated to 1.0.1
     
    Improved error handling.
    Improved the way paths are resolved.
    [TemplatesDir] and [XsltDir] tokens in paths are replaced with their corresponding subdirs of the CodeSmithContrib.Batch.Console.dll location for common templates/xslt.

    Post Edited (pneutam) : 8/13/2003 9:43:34 AM GMT

    • Post Points: 5
  • 08-13-2003 10:07 AM In reply to

    • Taliesin
    • Top 75 Contributor
    • Joined on 08-12-2003
    • Posts 51
    • Points 1,465

    RE: CodeSmith Batch Utility

    Brilliant Idea ;>

    I am already working on a template to generate the appropriate XML to batch my groups of templates

    Cheers
    Taliesin
    • Post Points: 5
  • 08-15-2003 3:20 AM In reply to

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    RE: CodeSmith Batch Utility

    Thanks Taliesin :)

    If you come up with some useful stylesheets it'd be great to see them.

    Cheers,
    Ben
    • Post Points: 5
  • 08-15-2003 3:20 AM In reply to

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    RE: CodeSmith Batch Utility

    Updated to 1.0.2

    Changes:
    Further improved error handling and path resolution.
    Uses CodeSmith samples in sample batch files.
    Added schema for batch file validation.
    Finished basic help in readme (describes basic xml structure and path tokens).

    Cheers,
    Ben
    • Post Points: 5
  • 08-15-2003 9:53 AM In reply to

    • Taliesin
    • Top 75 Contributor
    • Joined on 08-12-2003
    • Posts 51
    • Points 1,465

    RE: CodeSmith Batch Utility

    I am curious, is it possible to supply a database table as a property. I am not sure how to do call templates that use databases using Batch utility.

    Please can you supply an example. This ability would allow you to do some really kewl stuff. I want to generate an xml file that will generate CLSA.net objects from a database. CLSA templates have table properties though :(

    Cheers
    Tali
    • Post Points: 5
  • 08-15-2003 1:51 PM In reply to

    • ejsmith
    • Top 10 Contributor
    • Joined on 12-27-2002
    • Dallas, TX USA
    • Posts 2,205
    • Points 922,460

    RE: CodeSmith Batch Utility

    The easiest way to see what your property set XML should look like for any property, is to go into the CodeSmith GUI, set all the properties to what you want them to be, expand the right hand output panel, and click the copy property set xml toolbar button at the top.

    Thanks,
    Eric J. Smith

    Eric J. Smith
    CodeSmith Tools, LLC
    Chief Software Architect

    • Post Points: 5
  • 08-15-2003 5:46 PM In reply to

    • Taliesin
    • Top 75 Contributor
    • Joined on 08-12-2003
    • Posts 51
    • Points 1,465

    RE: CodeSmith Batch Utility

    Thanks to Eric I know how to get the value for a database connection. But I can not seem to get the Batch Utility to accept the following code. I even tried the /nv switch but it still seemed to bomb out. Do I need to use a custom XLST file or something to make it accept database connection strings (perhaps you should be allowed to pass any XML data along)


    <propertySet>
    <property name="ClassNamespace"></property>
    <property name="CollectionName">RootCollection</property>
    <property name="ItemName">RootClass</property>
    <property name="RootTable">
    <connectionString>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Tali\BusinessObject\BusinessObject.mdb;</connectionString>
    <providerType>SchemaExplorer.ADOXSchemaProvider,SchemaExplorer.ADOXSchemaProvider</providerType>
    <tableName>Business</tableName>
    </property>
    <property name="MemberPrefix">m</property>
    <property name="Accessibility">Public</property>
    <property name="Serializable">True</property>
    <property name="MustBeInherited">False</property>
    </propertySet>


    Cheers
    Taliesin
    • Post Points: 5
  • 08-17-2003 2:24 PM In reply to

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    RE: CodeSmith Batch Utility

    Currently only property elements are passed as parameters to the batch engine. I'm not using schema based generation at this stage, and didn't know it used different element names. I could just pass through anything, but I would prefer to keep using a schema. Perhaps I'll just pass through everything when /nv is passed. Eric, is there a schema of some kind (or a list of valid element names) that I could reference?

    Regards,
    Ben
    • Post Points: 5
  • 08-17-2003 4:31 PM In reply to

    • ejsmith
    • Top 10 Contributor
    • Joined on 12-27-2002
    • Dallas, TX USA
    • Posts 2,205
    • Points 922,460

    RE: CodeSmith Batch Utility

    Ben,
     
    No, you should be using the any element for the contents of property because CodeSmith is extensible to allow any object to serialize and deserialize from an XML property set.
     
    Thanks,
    Eric J. Smith

    Eric J. Smith
    CodeSmith Tools, LLC
    Chief Software Architect

    • Post Points: 5
  • 08-18-2003 2:10 AM In reply to

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    RE: CodeSmith Batch Utility

    Updated to 1.0.3

    Changes:
    Support custom properties (see “defaultPropertySet element” section in readme for difference in behaviour).

    Cheers,
    Ben
    • Post Points: 5
  • 09-04-2003 9:45 AM In reply to

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    RE: CodeSmith Batch Utility

    Updated to 1.0.4

    Changes:
    Added support for defining Xml in a batch file and passing it to a template (it is written to the temp folder and its path is passed to the template).
    Added support for using CodeSmith.Engine.dll directly for much better performance. This can be turned on with the /e option.
    Made temporary file names match the template/task numbers shown on the console.

    Cheers,
    Ben
    • Post Points: 5
  • 09-11-2003 8:58 AM In reply to

    • pneutam
    • Top 150 Contributor
    • Joined on 07-30-2003
    • Posts 38
    • Points 735

    RE: CodeSmith Batch Utility

    Updated to 1.0.5

    - Now checks if an output file is read-only. If it is, it outputs to <file>.tmp instead, compares with the output file, and only raises an error if it is different. You can leave files you know haven't changed in source control! The /nr option suppresses this behaviour.
    - The /e option now writes out the same output (banner etc.) as when CodeSmithConsole is used.
    - Added excludeTemplates attribute on propertySet element to prevent certain property sets from being passed to certain templates (I use it to prevent multiple IList generations).

    Cheers,
    Ben

    Post Edited (pneutam) : 9/11/2003 8:54:48 AM GMT

    • Post Points: 5
  • 09-11-2003 2:09 PM In reply to

    • ejsmith
    • Top 10 Contributor
    • Joined on 12-27-2002
    • Dallas, TX USA
    • Posts 2,205
    • Points 922,460

    RE: CodeSmith Batch Utility

    Ben,

    Looks great!! Keep up the good work!

    Eric J. Smith

    Eric J. Smith
    CodeSmith Tools, LLC
    Chief Software Architect

    • Post Points: 5
  • 09-11-2003 2:38 PM In reply to

    • ejsmith
    • Top 10 Contributor
    • Joined on 12-27-2002
    • Dallas, TX USA
    • Posts 2,205
    • Points 922,460

    RE: CodeSmith Batch Utility

    Ben,

    FYI: You may want to take a look at the latest builds (available to any registered forum user in the Beta Builds forum) so that you can be ready for the command line interface changes. I think the new CodeSmithConsole interface is much cleaner and should be stable for a long time.

    Thanks,
    Eric J. Smith

    Eric J. Smith
    CodeSmith Tools, LLC
    Chief Software Architect

    • Post Points: 5
Page 1 of 3 (42 items) 1 2 3 Next > | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems