Browse files

simplified build script

  • Loading branch information...
1 parent faeb6f6 commit a487bcbc27b2e43e42bef92ed9d3bc89d79a00b0 @benstucki benstucki committed Mar 31, 2010
Showing with 120 additions and 456 deletions.
  1. +3 −3 .gitignore
  2. +79 −0 build.xml
  3. +0 −133 build/build.xml
  4. +0 −75 build/example.properties
  5. +38 −0 example.properties
  6. +0 −51 reports/link-report.css
  7. +0 −194 reports/link-report.xsl
View
6 .gitignore
@@ -5,6 +5,6 @@ bin
html-template
*.swf
docs
-build/build.properties
-reports/link-report.xml
-reports/link-report.html
+build.properties
+reports
+tests
View
79 build.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<project name="Reflex Build" basedir="." default="all">
+
+ <!-- Define variables/paths used in this build script -->
+ <property file="build.properties" />
+ <property name="FLEX_HOME" value="${flex-sdk.dir}" />
+
+ <!-- Define tasks used in this build script -->
+ <taskdef resource="flexTasks.tasks" classpath="${flex-sdk.dir}/ant/lib/flexTasks.jar"/>
+
+ <target name="all">
+ <antcall target="clean" />
+ <antcall target="compile" />
+ <antcall target="docs" />
+ <antcall target="test-reports"></antcall>
+ </target>
+
+ <target name="clean">
+ <delete includeemptydirs="true" failonerror="false">
+ <fileset dir="${bin.dir}" defaultexcludes="false">
+ <include name="**/*"/>
+ </fileset>
+ <fileset dir="${docs.dir}" defaultexcludes="false">
+ <include name="**/*"/>
+ </fileset>
+ <fileset dir="${tests.dir}" defaultexcludes="false">
+ <include name="**/*"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <!--
+ Compile all of the classes under the "src" tree into a .swc file
+ -->
+ <target name="compile">
+ <compc output="${bin.dir}/${library.name}.swc" link-report="${link-report.dir}/link-report.xml">
+ <source-path path-element="${src.dir}"/>
+ <namespace uri="http://reflex.io/2010" manifest="${src.dir}/manifest.xml" />
+ <include-namespaces>http://reflex.io/2010</include-namespaces>
+ <strict>true</strict>
+ <optimize>true</optimize>
+ <warnings>true</warnings>
+ <external-library-path dir="${flex-sdk.dir}/frameworks/libs/player/${flex-sdk.player}" append="true">
+ <include name="playerglobal.swc" />
+ </external-library-path>
+ <library-path dir="${flex-sdk.dir}/frameworks" append="true">
+ <include name="libs/*.swc" />
+ <include name="locale/${flex-sdk.locale}/*.swc" />
+ </library-path>
+ <library-path dir="libs" append="true">
+ <include name="*.swc" />
+ </library-path>
+ </compc>
+ </target>
+
+ <!--
+ Generate ASDoc output for the library
+ -->
+ <target name="docs">
+ <asdoc output="${docs.dir}" templates-path="${docs.templates}">
+ <doc-namespaces uri="http://reflex.io/2010" />
+ <namespace uri="http://reflex.io/2010" manifest="${basedir}/src/manifest.xml" />
+ <source-path path-element="${src.dir}" />
+ <library-path dir="${flex-sdk.dir}/frameworks/libs" includes="*.swc" append="true" />
+ <library-path dir="${basedir}/libs" includes="*.swc" append="true" />
+ </asdoc>
+ </target>
+
+ <!-- Generate readable JUnit-style reports -->
+ <target name="test-reports">
+ <junitreport todir="${tests.dir}">
+ <fileset dir="${reports.dir}">
+ <include name="TEST-*.xml" />
+ </fileset>
+ <report format="frames" todir="${tests.dir}" />
+ </junitreport>
+ </target>
+
+</project>
View
133 build/build.xml
@@ -1,133 +0,0 @@
-<?xml version="1.0"?>
-<project name="Reflex Build" basedir="../" default="lib">
-
- <!-- Define variables/paths used in this build script -->
- <property file="./build/build.properties" />
- <property name="FLEX_HOME" value="${flex-sdk.dir}" />
-
- <!-- Define tasks used in this build script -->
- <taskdef resource="flexTasks.tasks" classpath="${flex-sdk.dir}/ant/lib/flexTasks.jar"/>
-
- <taskdef name="pmd" classname="com.adobe.ac.pmd.ant.FlexPmdAntTask" classpath="${flex-pmd.pmd}/flex-pmd-ant-task-${flex-pmd.version}.jar">
- <classpath>
- <fileset dir="${flex-pmd.pmd}">
- <include name="**/*.jar" />
- </fileset>
- </classpath>
- </taskdef>
-
- <taskdef name="cpd" classname="com.adobe.ac.cpd.ant.FlexCpdAntTask" classpath="${flex-pmd.cpd}/flex-pmd-cpd-ant-task-${flex-pmd.version}.jar">
- <classpath>
- <fileset dir="${flex-pmd.cpd}">
- <include name="**/*.jar" />
- </fileset>
- </classpath>
- </taskdef>
-
- <taskdef name="metrics" classname="com.adobe.ac.pmd.metrics.ant.FlexMetricsAntTask" classpath="${flex-pmd.metrics}/flex-pmd-metrics-ant-task-${flex-pmd.version}.jar">
- <classpath>
- <fileset dir="${flex-pmd.metrics}">
- <include name="**/*.jar" />
- </fileset>
- </classpath>
- </taskdef>
-
- <!--
- Have you edited the properties file to make sure the paths are right on your system?
- -->
- <target name="properties">
- <fail unless="asdoc.exe">The "asdoc.exe" property must be set in ${build.dir}/build.properties.</fail>
- <fail unless="compc.exe">The "compc.exe" property must be set in ${build.dir}/build.properties.</fail>
- <fail unless="mxmlc.exe">The "mxmlc.exe" property must be set in ${build.dir}/build.properties.</fail>
- </target>
-
- <target name="clean">
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="${bin.dir}" defaultexcludes="false">
- <include name="**/*"/>
- </fileset>
- <fileset dir="${docs.dir}" defaultexcludes="false">
- <include name="**/*"/>
- </fileset>
- <fileset dir="${reports.dir}" defaultexcludes="false">
- <include name="**/*"/>
- </fileset>
- </delete>
- </target>
-
- <!--
- Compile all of the classes under the "src" tree into a .swc file
- -->
- <target name="lib" depends="properties">
- <compc output="${bin.dir}/${library.name}.swc" link-report="${reports.dir}/link-report.xml">
- <!--<load-config filename="${basedir}/build/build-config.xml"/>-->
- <source-path path-element="${src.dir}"/>
- <namespace uri="http://reflex.io/2010" manifest="${src.dir}/manifest.xml" />
- <include-namespaces>http://reflex.io/2010</include-namespaces>
- <strict>true</strict>
- <optimize>true</optimize>
- <warnings>true</warnings>
- <external-library-path dir="${flex-sdk.dir}/frameworks/libs/player/${flex-sdk.player}" append="true">
- <include name="playerglobal.swc" />
- </external-library-path>
- <library-path dir="${flex-sdk.dir}/frameworks" append="true">
- <include name="libs/*.swc" />
- <include name="locale/${flex-sdk.locale}/*.swc" />
- </library-path>
- <library-path dir="libs" append="true">
- <include name="*.swc" />
- </library-path>
- </compc>
- </target>
-
- <!--
- Generate ASDoc output for the library
- -->
- <target name="docs" depends="properties">
-
- <!-- Clean out the contents of the doc directory, without delete "docs" -->
- <delete includeemptydirs="true">
- <fileset dir="${docs.dir}" includes="**/*" />
- </delete>
-
- <exec executable="${asdoc.exe}" spawn="no">
- <!-- Place the documentation in the "docs" directory -->
- <arg line="-o '${docs.dir}'" />
-
- <!-- Include in the corelib.swc in the class path -->
- <arg line="-l 'libs'" />
- <arg line="-l '${flex-sdk.dir}/frameworks/libs'" />
-
- <!-- Specify the main source path as "src" -->
- <arg line="-sp '${src.dir}'" />
-
- <!-- Document all of the classes in the "src" tree -->
- <arg line="-ds '${src.dir}'" />
-
- <!-- Include the library name in the window title -->
- <arg line="-window-title '${library.name}' "/>
- </exec>
- </target>
-
- <target name="link-report">
- <xslt in="${link-report.dir}/${link-report.name}.xml" out="${link-report.dir}/${link-report.name}.html" style="${link-report.xsl}" />
- </target>
-
- <target name="pmd-report">
- <pmd sourceDirectory="${src.dir}" outputDirectory="${pmd-report.dir}" />
- </target>
-
- <target name="cpd-report">
- <cpd minimumTokenCount="50" outputFile="${cpd-report.dir}/{cpd-report.name}.xml">
- <fileset dir="${src.dir}">
- <include name="**/*.as"/>
- <include name="**/*.mxml"/>
- </fileset>
- </cpd>
- </target>
-
- <target name="metrics-report">
- <metrics sourcedirectory="${src.dir}" outputfile="${metrics-report.dir}/{metrics-report.name}.xml" />
- </target>
-
-</project>
View
75 build/example.properties
@@ -1,75 +0,0 @@
-###################################################################
-# User-Defined Properties
-# Modify these path values to reflect paths on your system
-###################################################################
-
-library.name = Reflex
-
-# -----------------------------------------------------------------
-# Flex SDK Properties
-# -----------------------------------------------------------------
-flex-sdk.dir = /Applications/Adobe Flash Builder Beta 2/sdks/4.0.0.14159 FlexCover
-#flex-sdk.lib.dir = ${flex-sdk.dir}/frameworks/libs
-#flex-sdk.player.dir = ${flex-sdk.lib.dir}/player/10.0
-# = ${flex-sdk.dir}/frameworks/locale/{locale}
-flex-sdk.locale = en_US
-flex-sdk.player = 10.0
-
-# -----------------------------------------------------------------
-# FlexUnit Properties
-# -----------------------------------------------------------------
-flex-unit.dir = ${flex-sdk.dir}/ant/lib
-flex-unit.version = 4.0.0
-
-# -----------------------------------------------------------------
-# FlexPMD Properties
-# -----------------------------------------------------------------
-flex-pmd.dir = /Applications/FlexPMD
-flex-pmd.pmd = ${flex-pmd.dir}
-flex-pmd.cpd = ${flex-pmd.dir}
-flex-pmd.metrics = ${flex-pmd.dir}
-flex-pmd.version = 1.0
-
-# -----------------------------------------------------------------
-# FlexCover Properties
-# -----------------------------------------------------------------
-flex-cover.exe = /Applications/CoverageViewer.app/Contents/MacOS/CoverageViewer
-flex-cover.cvm = /Users/mac/Reflex/reflex/bin/Reflex.cvm
-flex-cover.cvr = ${reports.dir}/${project.name}.cvr
-flex-cover.cobertura = ${reports.dir}/${project.name}.cobertura
-reflex.bin = /Users/mac/Reflex/reflex/bin
-
-
-###################################################################
-# Default Settings
-# The default settings below should work without customization.
-###################################################################
-
-# -----------------------------------------------------------------
-# Report/Output Directories
-# -----------------------------------------------------------------
-cpd-report.name = cpd
-metrics-report.name = javancss
-link-report.name = link-report
-link-report.xsl = ${basedir}/build/link-report.xsl
-
-docs.dir = ${basedir}/docs
-reports.dir = ${basedir}/reports
-pmd-report.dir = ${reports.dir}
-cpd-report.dir = ${reports.dir}
-metrics-report.dir = ${reports.dir}
-link-report.dir = ${reports.dir}
-
-# -----------------------------------------------------------------
-# Compiler Paths
-# -----------------------------------------------------------------
-asdoc.exe = ${flex-sdk.dir}/bin/asdoc
-compc.exe = ${flex-sdk.dir}/bin/compc
-mxmlc.exe = ${flex-sdk.dir}/bin/mxmlc
-
-# -----------------------------------------------------------------
-# Project Paths - DO NOT MODIFY
-# -----------------------------------------------------------------
-build.dir = ${basedir}/build
-src.dir = ${basedir}/src
-bin.dir = ${basedir}/bin
View
38 example.properties
@@ -0,0 +1,38 @@
+###################################################################
+# User-Defined Properties
+# Modify these path values to reflect paths on your system
+###################################################################
+
+library.name = Reflex
+
+# -----------------------------------------------------------------
+# Flex SDK Properties
+# -----------------------------------------------------------------
+flex-sdk.dir = /Applications/Adobe Flash Builder Beta 2/sdks/4.0.0.14159 FlexCover
+flex-sdk.locale = en_US
+flex-sdk.player = 10.0
+
+
+###################################################################
+# Default Settings
+# The default settings below should work without customization.
+###################################################################
+
+# -----------------------------------------------------------------
+# Report/Output Directories
+# -----------------------------------------------------------------
+
+docs.dir = ${basedir}/docs
+docs.templates = ${flex-sdk.dir}/asdoc/templates
+
+link-report.name = link-report
+link-report.dir = ${docs.dir}
+reports.dir = /Users/mac/Reflex/ReflexTests/reports
+tests.dir = ${basedir}/tests
+
+# -----------------------------------------------------------------
+# Project Paths - DO NOT MODIFY
+# -----------------------------------------------------------------
+build.dir = ${basedir}/build
+src.dir = ${basedir}/src
+bin.dir = ${basedir}/bin
View
51 reports/link-report.css
@@ -1,51 +0,0 @@
-body {
- font-family: sans-serif;
-}
-
-#link-report {
- width: 100%;
-}
-
-td {
- vertical-align: top;
-}
-
-th {
- text-align: left;
-}
-
-tfoot {
- border-top: 1px solid black;
-}
-
-.prequisites, .dependencies {
- display: none;
-
- margin-top: 0.5em;
- padding-top: 0.5em;
- border-top: 1px solid black;
-}
-
-.hierarchy:hover .prequisites,
-.hierarchy:hover .dependencies {
- display: block;
-}
-
-.class-name {
- width: 20em;
- overflow: hidden;
-}
-
-.hierarchy {
- width: 20em;
- overflow: hidden;
-}
-
-.size {
- width: 10em;
- /*text-align: right;*/
-}
-
-.external {
- color: #999999;
-}
View
194 reports/link-report.xsl
@@ -1,194 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-
-Stylesheet to transform a link report file from mxmlc into a readable HTML file.
-
-Copyright 2007 Theo Hultberg / Iconara
-
-For more info see http://blog.iconara.net/
-
-- modified by Ben Stucki
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:output method="xml" indent="yes" encoding="UTF-8" standalone="yes"
- doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
- />
-
- <xsl:variable name="nl"><xsl:text>&#xa;</xsl:text></xsl:variable>
-
- <xsl:template match="/">
- <html>
- <head>
- <title>Reflex Dependency Analysis</title>
- <link rel="stylesheet" type="text/css" href="link-report.css" />
- </head>
- <body>
- <table id="link-report">
- <thead>
- <tr>
- <th>Class name</th>
- <th>References</th>
- <th>Qualified name</th>
- <th>Optimized Size</th>
- </tr>
- </thead>
- <tbody>
- <xsl:apply-templates select="/report/scripts/script" mode="table">
- <!-- generate table rows from the script nodes, sorted by size -->
- <xsl:sort order="descending" data-type="number" select="@optimizedsize"/>
- </xsl:apply-templates>
- </tbody>
- <tfoot>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td>
- <div class="size">
- <!-- output the sum of the script sizes -->
- <xsl:value-of select="format-number(sum(/report/scripts/script/@optimizedsize) div 1024, '#.#')"/>
- <xsl:text> KB</xsl:text>
- </div>
- </td>
- </tr>
- </tfoot>
- </table>
- </body>
- </html>
- </xsl:template>
-
- <!--
- Generates a table row containg the description of a class.
- -->
- <xsl:template match="script" mode="table">
- <xsl:variable name="href">
- <!--
- $href will contain the path of the class' source file, or the
- SWC which contains the class.
- -->
-
- <xsl:choose>
- <xsl:when test="contains(@name, 'swc')">
- <xsl:value-of select="substring-before(@name, '(')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="className">
- <!--
- $className will contain the name of the class, without package specifier.
- -->
-
- <xsl:choose>
- <xsl:when test="contains(def/@id, ':')">
- <xsl:value-of select="substring-after(def/@id, ':')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="def/@id"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="qualifiedName" select="def/@id"/>
-
- <tr>
- <td>
- <div class="class-name" title="{$className}">
- <xsl:value-of select="$className"/>
- </div>
- </td>
- <td>
- <xsl:value-of select="count(/report/scripts/script/dep[@id = $qualifiedName]|/report/scripts/script/pre[@id = $qualifiedName])"/>
- </td>
- <td>
- <div class="hierarchy">
- <div title="{$qualifiedName}"><xsl:value-of select="$qualifiedName"/></div>
-
- <ul class="prequisites">
- <xsl:apply-templates select="pre" mode="list"/>
- </ul>
- <ul class="dependencies">
- <xsl:apply-templates select="dep" mode="list"/>
- </ul>
- </div>
- </td>
- <td class="number">
- <div class="size">
- <!-- the input contains the size in bytes, convert it to KB and output with one decimal -->
- <xsl:value-of select="format-number(number(@optimizedsize) div 1024, '#.#')"/>
- <xsl:text> KB</xsl:text>
- </div>
- </td>
- <!--
- <td class="number">
- <div class="size">
- <xsl:variable name="tempCost">
- <dependencies>
- <xsl:for-each select="def | pre | dep">
- <xsl:variable name="referenceName" select="@id" />
- <xsl:variable name="referenceNode" select="/report/scripts/script[def/@id = $referenceName]" />
- <xsl:if test="$referenceNode">
- <size>
- <xsl:value-of select="$referenceNode/@optimizedsize"/>
- </size>
- </xsl:if>
- </xsl:for-each>
- </dependencies>
- </xsl:variable>
- <xsl:variable name="costNodes" select="nodeset($tempCost)"/>
- <xsl:value-of select="format-number(sum($costNodes/dependencies/size) div 1024, '#.#')" />
- <xsl:text> KB</xsl:text>
- </div>
- </td>
- -->
- </tr>
- </xsl:template>
-
- <!--
- Generates a list item from either a pre or a dep node.
- The list item will have the class "dependency" or "prequisite", as well
- as "external", if the class represented by the dep/pre is an external dependency.
- -->
- <xsl:template match="dep|pre" mode="list">
- <xsl:variable name="external">
- <!--
- $external will have the value "external" if the dependency/prequisite
- appears among the external-defs, otherwise an empty string.
- -->
-
- <xsl:variable name="local-id" select="@id"/>
-
- <xsl:choose>
- <xsl:when test="/report/external-defs/ext[@id = $local-id]">
- <xsl:text>external</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- this will yield something empty -->
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="type">
- <!-- $type will be either "dependency" or "prequisite" -->
-
- <xsl:choose>
- <xsl:when test="local-name() = 'dep'">
- <xsl:text>dependency</xsl:text>
- </xsl:when>
- <xsl:when test="local-name() = 'pre'">
- <xsl:text>prequisite</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <li class="{$type} {$external}"><xsl:value-of select="@id"/></li>
- </xsl:template>
-
-</xsl:stylesheet>

0 comments on commit a487bcb

Please sign in to comment.