Wednesday, August 14, 2013

Flex: Generating ASDoc

Rather than searching high and low for a particular function, wouldn't it be much more easier if you can just search through a set of HTML files in case you need to reference some codes that you have writen back then? Therefore, I have created a ant file to auto generated the HTML for the Flex 3 and Flex 4 projects that I have shown on this blog.

Main Ant file - build.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<project basedir="." default="dist.asdocs">
 <!-- project root directory -->
 <property name="APP_ROOT" location="${basedir}/.." />
 <property file="build.properties" />

 <target name="dist.asdocs" description="Create asdocs">
  <cleanAsdocsDir3 />
  <createAsdocs3 />
  <cleanAsdocsDir4 />
  <createAsdocs4 />
 </target>

 <macrodef name="createAsdocs3">
  <sequential>
      <tstamp prefix="dateStamp">
          <format property="date" pattern="MMM/dd/yyyy hh:mm:ss aa" unit="hour" />
      </tstamp>
   <java taskname="asdoc" jar="${FLEX_HOME_3}/lib/asdoc.jar" 
    failonerror="true" fork="true">
    <jvmarg value="-Dapplication.home=${FLEX_HOME_3}"/>
    <!-- Need to assign lots for memory for the ant job -->
    <jvmarg value="-Dsun.io.useCanonCaches=false"/>
    <jvmarg value="-Xms512m"/>
    <jvmarg value="-Xmx1024m"/>
    <jvmarg value="-XX:MaxPermSize=256m"/>

    <arg value="-warnings=false" />
    <!-- Root directory of files -->
    <arg value="-source-path" />
    <arg value="${APP_ROOT}/../AccessingSWFLoaderFunctions/src" />
    <arg value="${APP_ROOT}/../BubbleEventTest/src" />
    <arg value="${APP_ROOT}/../ClippingContent/src" />
    <arg value="${APP_ROOT}/../CustomiseToolTip/src" />
    <arg value="${APP_ROOT}/../DateCheckerApplication/src" />
    <arg value="${APP_ROOT}/../drawingShapes/src" />
    <arg value="${APP_ROOT}/../FlexCustomPreloader/src" />
    <arg value="${APP_ROOT}/../htmlEntity/src" />
    <arg value="${APP_ROOT}/../LinkList/src" />
    <arg value="${APP_ROOT}/../ListDragAndDrop/src" />
    <arg value="${APP_ROOT}/../MeasurePosition/src" />
    <arg value="${APP_ROOT}/../MultipleViewWithAlivePDF/src" />
    <arg value="${APP_ROOT}/../PlayingWithAlivePDF/src" />
    <arg value="${APP_ROOT}/../PlayingWithAlivePDF/fonts" />
    <arg value="${APP_ROOT}/../PlayingWithRegExp/src" />
    <arg value="${APP_ROOT}/../PopUpOverlay/src" />
    <arg value="${APP_ROOT}/../ScreenCaptureView/src" />
    <arg value="${APP_ROOT}/../SimpleChartHorizontalAxis/src" />
    <arg value="${APP_ROOT}/../SimpleSingleton/src" />
    <arg value="${APP_ROOT}/../stopBubbleEventTest/src" />
    <!-- List of files to document -->
    <arg value="-doc-sources" />
    <arg value="${APP_ROOT}/../AccessingSWFLoaderFunctions/src" />
    <arg value="${APP_ROOT}/../BubbleEventTest/src" />
    <arg value="${APP_ROOT}/../ClippingContent/src" />
    <arg value="${APP_ROOT}/../CustomiseToolTip/src" />
    <arg value="${APP_ROOT}/../DateCheckerApplication/src" />
    <arg value="${APP_ROOT}/../drawingShapes/src" />
    <arg value="${APP_ROOT}/../FlexCustomPreloader/src" />
    <arg value="${APP_ROOT}/../htmlEntity/src" />
    <arg value="${APP_ROOT}/../LinkList/src" />
    <arg value="${APP_ROOT}/../ListDragAndDrop/src" />
    <arg value="${APP_ROOT}/../MeasurePosition/src" />
    <arg value="${APP_ROOT}/../MultipleViewWithAlivePDF/src" />
    <arg value="${APP_ROOT}/../PlayingWithAlivePDF/src" />
    <arg value="${APP_ROOT}/../PlayingWithRegExp/src" />
    <arg value="${APP_ROOT}/../PopUpOverlay/src" />
    <arg value="${APP_ROOT}/../ScreenCaptureView/src" />
    <arg value="${APP_ROOT}/../SimpleChartHorizontalAxis/src" />
    <arg value="${APP_ROOT}/../SimpleSingleton/src" />
    <arg value="${APP_ROOT}/../stopBubbleEventTest/src" />
    <!-- Adding a external library, if u are using one -->
    <arg value="-external-library-path" />
    <arg value="${APP_ROOT}/../PlayingWithAlivePDF/libs" />
    <!-- Title of the generated asdoc webpage -->
    <arg value="-window-title" />
    <arg value="Flex 3.5.0 Projects Documentation" />
    <!-- Header shown in the generated asdoc webpage -->
    <arg value="-main-title" />
    <arg value="Flex 3.5.0 Projects Documentation" />
    <!-- Footer shown in the generated asdoc webpage -->
    <arg value="-footer" />
    <arg value="Created on ${dateStamp.date}" />
    <!-- Output folder of the generated asdoc webpage -->
    <arg value="-output" />
    <arg value="${OUTPUT_DOCS_DIR_3}" />
    <!-- If your project requires some TrueType, OpenType fonts -->
    <!--<arg value="-managers" />
    <arg value="flash.fonts.AFEFontManager" />-->
   </java>
  </sequential>
 </macrodef>

 <macrodef name="cleanAsdocsDir3">
  <sequential>
   <echo message="Clean Asdocs Directory" />
   <delete dir="${OUTPUT_DOCS_DIR_3}" failonerror="false" />
   <mkdir dir="${OUTPUT_DOCS_DIR_3}" />
   <echo>Cleaned asdocs output directory</echo>
  </sequential>
 </macrodef>

 <macrodef name="createAsdocs4">
  <sequential>
      <tstamp prefix="dateStamp">
          <format property="date" pattern="MMM/dd/yyyy hh:mm:ss aa" unit="hour" />
      </tstamp>
   <java taskname="asdoc" jar="${FLEX_HOME_4}/lib/asdoc.jar" 
    failonerror="true" fork="true">
    <jvmarg value="-Dapplication.home=${FLEX_HOME_4}"/>
    <!-- Need to assign lots for memory for the ant job -->
    <jvmarg value="-Dsun.io.useCanonCaches=false"/>
    <jvmarg value="-Xms512m"/>
    <jvmarg value="-Xmx1024m"/>
    <jvmarg value="-XX:MaxPermSize=256m"/>

    <arg value="-warnings=false" />
    <!-- Root directory of files -->
    <arg value="-source-path" />
    <arg value="${APP_ROOT}/../AutoresizableTextfield/src" />
    <arg value="${APP_ROOT}/../ImageSourceIssue/src" />
    <arg value="${APP_ROOT}/../NotReallyGlobalTooltip/src" />
    <arg value="${APP_ROOT}/../OpenURLOfHTMLText/src" />
    <arg value="${APP_ROOT}/../Simple2WayBinding/src" />
    <arg value="${APP_ROOT}/../Simple3StateCheckBox/src" />
    <arg value="${APP_ROOT}/../SimpleAreaChartToolTip/src" />
    <arg value="${APP_ROOT}/../SimpleButtonBarSelect/src" />
    <arg value="${APP_ROOT}/../SimpleChartAnimation/src" />
    <arg value="${APP_ROOT}/../SimpleChartDataClick/src" />
    <arg value="${APP_ROOT}/../SimpleChartPositionOfAPoint/src" />
    <arg value="${APP_ROOT}/../SimpleChartVisibility/src" />
    <arg value="${APP_ROOT}/../SimpleCopyingOfObjects/src" />
    <arg value="${APP_ROOT}/../SimpleDataTipBorder/src" />
    <arg value="${APP_ROOT}/../SimpleDoubleClicking/src" />
    <arg value="${APP_ROOT}/../SimpleMouseReleaseOutside/src" />
    <arg value="${APP_ROOT}/../SimpleMouseReleaseOutside/src" />
    <arg value="${APP_ROOT}/../SimplePastingDetection/src" />
    <arg value="${APP_ROOT}/../SimpleStackingColumn/src" />
    <arg value="${APP_ROOT}/../SimpleSudokuGrid/src" />
    <arg value="${APP_ROOT}/../SimpleTabSequence/src" />
    <arg value="${APP_ROOT}/../SimpleTwitterPost/src" />
    <!-- List of files to document -->
    <arg value="-doc-sources" />
    <arg value="${APP_ROOT}/../AutoresizableTextfield/src" />
    <arg value="${APP_ROOT}/../ImageSourceIssue/src" />
    <arg value="${APP_ROOT}/../NotReallyGlobalTooltip/src" />
    <arg value="${APP_ROOT}/../OpenURLOfHTMLText/src" />
    <arg value="${APP_ROOT}/../Simple2WayBinding/src" />
    <arg value="${APP_ROOT}/../Simple3StateCheckBox/src" />
    <arg value="${APP_ROOT}/../SimpleAreaChartToolTip/src" />
    <arg value="${APP_ROOT}/../SimpleButtonBarSelect/src" />
    <arg value="${APP_ROOT}/../SimpleChartAnimation/src" />
    <arg value="${APP_ROOT}/../SimpleChartDataClick/src" />
    <arg value="${APP_ROOT}/../SimpleChartPositionOfAPoint/src" />
    <arg value="${APP_ROOT}/../SimpleChartVisibility/src" />
    <arg value="${APP_ROOT}/../SimpleCopyingOfObjects/src" />
    <arg value="${APP_ROOT}/../SimpleDataTipBorder/src" />
    <arg value="${APP_ROOT}/../SimpleDoubleClicking/src" />
    <arg value="${APP_ROOT}/../SimpleMouseReleaseOutside/src" />
    <arg value="${APP_ROOT}/../SimpleMouseReleaseOutside/src" />
    <arg value="${APP_ROOT}/../SimplePastingDetection/src" />
    <arg value="${APP_ROOT}/../SimpleStackingColumn/src" />
    <arg value="${APP_ROOT}/../SimpleSudokuGrid/src" />
    <arg value="${APP_ROOT}/../SimpleTabSequence/src" />
    <arg value="${APP_ROOT}/../SimpleTwitterPost/src" />
    <!-- Title of the generated asdoc webpage -->
    <arg value="-window-title" />
    <arg value="Flex 4.6.0 Projects Documentation" />
    <!-- Header shown in the generated asdoc webpage -->
    <arg value="-main-title" />
    <arg value="Flex 4.6.0 Projects Documentation" />
    <!-- Footer shown in the generated asdoc webpage -->
    <arg value="-footer" />
    <arg value="Created on ${dateStamp.date}" />
    <!-- Output folder of the generated asdoc webpage -->
    <arg value="-output" />
    <arg value="${OUTPUT_DOCS_DIR_4}" />
    <!-- If your project requires some TrueType, OpenType fonts -->
    <!--<arg value="-managers" />
    <arg value="flash.fonts.AFEFontManager" />-->
   </java>
  </sequential>
 </macrodef>

 <macrodef name="cleanAsdocsDir4">
  <sequential>
   <echo message="Clean Asdocs Directory" />
   <delete dir="${OUTPUT_DOCS_DIR_4}" failonerror="false" />
   <mkdir dir="${OUTPUT_DOCS_DIR_4}" />
   <echo>Cleaned asdocs output directory</echo>
  </sequential>
 </macrodef>
</project>

Main Ant Properties file - build.properties
# change this to your Flex SDK directory path
FLEX_HOME_3=C:/Program Files (x86)/Adobe/Adobe Flash Builder 4.5/sdks/3.6.0
FLEX_HOME_4=C:/Program Files (x86)/Adobe/Adobe Flash Builder 4.5/sdks/4.5.0

# output location for the asdocs for flex 3.6
OUTPUT_DOCS_DIR_3 = ${APP_ROOT}/../asdocs_3.6

# output location for the asdocs for flex 4.5
OUTPUT_DOCS_DIR_4 = ${APP_ROOT}/../asdocs_4.5
* Click here to find out more about ASDoc.
* Click here for the ASDoc that I have generated for my Flex 3 projects.
* Click here for the ASDoc that I have generated for my Flex 4 projects.
* Click here to download the ant build files that I have shown in this post.

No comments:

Post a Comment