Skip to content

1.2 Ant Coding Standards

sfloess edited this page Mar 18, 2013 · 2 revisions

This document covers Ant coding standards.

Scripts

Build Scripts

Build scripts (that use targets) should be minimally coded and instead leverage macrodefs. The idea is that the macrodef script files should be reusable outside Solenopsis in ways not considered yet!

Description

Always define a description attribute for each target.

Properties

Naming

Global properties should be named after using the following notation:

[general purpose].[more specific purpose].[All cap'd, underbar seperated words]

For example:

  • solenopsis.xsl.HOME
  • sfdc.deploy.MAX_POLL

Macrodefs

XML comments

Always denote XML comments above the macrodef and include:

  • details on the purpose.
  • attribute explanations.
  • an explanation if any global variables are set.
  • short example(s).

URIs

Always denote URI attributes s in macrodefs consistently in the same script file. Example:

<macrodef name="xml-name" backtrace="true" uri="http://www.redhat.com/sfdc" description="Generate the name XML element">

Description

Always denote a description attribute explaining what the macrodef performs.

Attributes

Always include a a description of the attributes and their purpose.

Properties

Always use Ant <local> tasks within a macrodef.

Unit Tests

Always unit test each macrodef using Ant Unit.