Skip to content

Instantly share code, notes, and snippets.

@mhenke
Created December 19, 2011 17:24
Show Gist options
  • Save mhenke/1498049 to your computer and use it in GitHub Desktop.
Save mhenke/1498049 to your computer and use it in GitHub Desktop.
compile check for ant script snippets
<target name="init">
<property name="jenkins_workspace" value="C:/Program Files/Jenkins/workspace/SSO/" />
<!--CFcompile Properties -->
<property name="webroot" location="//ricdev/servers/sso/cfusion.ear/cfusion.war" />
<property name="cfcompile.path" location="${webroot}/WEB-INF/cfusion/bin"/>
<property name="cfcompile.tmpClasses" location="${webroot}/WEB-INF/cfclasses/" />
<property name="cfuser" value="cfusion" />
<!--Compiler Properties-->
<property name="jrun.path" value="//ricdev/JRun4" />
<property name="coldfusion.home" value="${jrun.path}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion" />
<property name="coldfusion.instancepath" value="${jrun.path}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF" />
<!--Jar Files used for compiling-->
<property name="jrun.jar" value="${jrun.path}/lib/jrun.jar"/>
<property name="coldfusion.bootstrap.jar" value="${coldfusion.instancepath}/lib/cfmx_bootstrap.jar"/>
<property name="coldfusion.cfx.jar" value="${coldfusion.instancepath}/lib/cfx.jar"/>
<!--Compiler Arguments-->
<property name="coldfusion.compiler.libpath" value="${coldfusion.home}/lib"/>
<property name="coldfusion.compiler.classpath" value="${coldfusion.compiler.libpath}/updates,${coldfusion.compiler.libpath}"/>
</target>
<!--
=================================
Target: acf.compile.copy-cf
Copying files for compile test
=================================
-->
<target name="compile.copy" depends="init,clean">
<echo>Copying files to ${webroot}/compile_check from ${jenkins_workspace}</echo>
<copy todir="${webroot}/compile_check" >
<fileset dir="${jenkins_workspace}">
<include name="**"/>
<exclude name="**/mxunit/**"/>
<exclude name="**/plugins/**"/>
</fileset>
</copy>
<echo>Done copying files.</echo>
</target>
<!--
=================================
Target: compile.acf
Compiles the ColdFusion files for any syntax errors
=================================
-->
<target name="compile.acf" depends="compile.copy">
<echo>Starting compile check...</echo>
<java classname="coldfusion.tools.CommandLineInvoker" failonerror="true" fork="true" resultproperty="java.compilecheck">
<classpath>
<pathelement location="${jrun.jar}"/>
<pathelement location="${coldfusion.bootstrap.jar}"/>
<pathelement location="${coldfusion.cfx.jar}"/>
</classpath>
<sysproperty key=" coldfusion.classPath" value="${coldfusion.compiler.classpath}"/>
<sysproperty key=" coldfusion.libPath" value="${coldfusion.compiler.libpath}"/>
<arg line=" Compiler "/>
<arg line=" -webroot ${webroot} "/>
<arg line=" ${webroot}/compile_check" />
</java>
<echo>Compile checks for ${build} complete.</echo>
</target>
<?xml version="1.0"?>
<project name="Rewrite Build" default="package" basedir=".">
<description>
Build file for moving all files into a directory structure easily deployable
</description>
<!--
Committers: HOW TO CONFIGURE YOUR ENVIRONMENT
-->
<!--
=================================
Target: init
Initializes the general settings and properties used in the build
=================================
//ricdev/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/bin/
-->
<target name="init">
<property name="jenkins_workspace" value="C:/Program Files/Jenkins/workspace/SSO/" />
<!--CFcompile Properties -->
<property name="webroot" location="//ricdev/servers/sso/cfusion.ear/cfusion.war" />
<property name="cfcompile.path" location="${webroot}/WEB-INF/cfusion/bin"/>
<property name="cfcompile.tmpClasses" location="${webroot}/WEB-INF/cfclasses/" />
<property name="cfuser" value="cfusion" />
<!--Compiler Properties-->
<property name="jrun.path" value="//ricdev/JRun4" />
<property name="coldfusion.home" value="${jrun.path}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion" />
<property name="coldfusion.instancepath" value="${jrun.path}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF" />
<!--Jar Files used for compiling-->
<property name="jrun.jar" value="${jrun.path}/lib/jrun.jar"/>
<property name="coldfusion.bootstrap.jar" value="${coldfusion.instancepath}/lib/cfmx_bootstrap.jar"/>
<property name="coldfusion.cfx.jar" value="${coldfusion.instancepath}/lib/cfx.jar"/>
<!--Compiler Arguments-->
<property name="coldfusion.compiler.libpath" value="${coldfusion.home}/lib"/>
<property name="coldfusion.compiler.classpath" value="${coldfusion.compiler.libpath}/updates,${coldfusion.compiler.libpath}"/>
<taskdef resource="org/eclipse/jgit/ant/ant-tasks.properties">
<classpath>
<pathelement location="mxunit/lib/org.eclipse.jgit.ant-1.0.99.0.6-UNOFFICIAL-ROBERTO-RELEASE.jar"/>
<pathelement location="mxunit/lib/org.eclipse.jgit-1.1.0.201109151100-r.jar"/>
<pathelement location="mxunit/lib/jsch-0.1.44-1.jar"/>
</classpath>
</taskdef>
</target>
<!--
=================================
Target: publish
- compiles
- runs tests
- packages
- uploads
=================================
-->
<target name="publish" depends="init,compile.acf,package,upload" description="--> packages into a zip and uploads to google code" />
<!--
=================================
Target: package
Generates the zip archive
=================================
-->
<target name="package" depends="clean" description="--> packages the appropriate files into the deployment-ready zip file. use this for testing; otherwise, use publish">
<echo>packaging stuff</echo>
</target>
<!--
=================================
Target: clean
Cleans up un-needed files
=================================
-->
<target name="clean" depends="init">
<echo>Cleaning started</echo>
<echo>Deleting files from ${webroot}</echo>
<delete dir="${webroot}">
<exclude name="CFIDE/"/>
<exclude name="WEB-INF/"/>
<exclude name="META-INF/"/>
<exclude name="snapshots/"/>
<exclude name=".settings/"/>
</delete>
<echo>Clean-up done.</echo>
</target>
<!--
=================================
Target: acf.compile.copy-cf
Copying files for compile test
=================================
-->
<target name="compile.copy" depends="init,clean">
<echo>Copying files to ${webroot}/compile_check from ${jenkins_workspace}</echo>
<copy todir="${webroot}/compile_check" >
<fileset dir="${jenkins_workspace}">
<include name="**"/>
<exclude name="**/mxunit/**"/>
<exclude name="**/plugins/**"/>
</fileset>
</copy>
<echo>Done copying files.</echo>
</target>
<!--
=================================
Target: upload
Uploads the release zip to the Google Code site
=================================
-->
<target name="upload">
<echo>uploading stuff</echo>
</target>
<!--
=================================
Target: genApiDocs
Calls JS in build props which invokes the ColdDoc cfml script
=================================
-->
<target name="genApiDocs" depends="init">
<property file="${antrunner.file}" />
<delete dir="doc/api" failonerror="false"/>
<mkdir dir="doc/api" />
<script language="javascript" src="buildprops/scripts/http_doc_gen.js" />
<delete dir="doc/api" includes="**/*.svn/"></delete>
</target>
<!--
=================================
Target: compile.acf
Compiles the ColdFusion files for any syntax errors
=================================
-->
<target name="compile.acf" depends="compile.copy">
<echo>Starting compile check...</echo>
<java classname="coldfusion.tools.CommandLineInvoker" failonerror="true" fork="true" resultproperty="java.compilecheck">
<classpath>
<pathelement location="${jrun.jar}"/>
<pathelement location="${coldfusion.bootstrap.jar}"/>
<pathelement location="${coldfusion.cfx.jar}"/>
</classpath>
<sysproperty key=" coldfusion.classPath" value="${coldfusion.compiler.classpath}"/>
<sysproperty key=" coldfusion.libPath" value="${coldfusion.compiler.libpath}"/>
<arg line=" Compiler "/>
<arg line=" -webroot ${webroot} "/>
<arg line=" ${webroot}/compile_check" />
</java>
<echo>Compile checks for ${build} complete.</echo>
</target>
<!--
=================================
Target: testJSlint
Checks JS for errors
=================================
-->
<target name="testJSlint" depends="init,compile.copy">
<echo>Starting JS check...</echo>
<property name="rhino.jar" value="${webroot}/lib/rhino-1.7R3.jar"/>
<property name="jslint.js" value="${webroot}/lib/jslint.js"/>
<apply executable="java" parallel="false">
<filelist dir="${webroot}/javascripts">
</filelist>
<arg line="-jar"/>
<arg path="${rhino.jar}"/>
<arg path="${jslint.js}"/>
</apply>
<echo>JS checks for ${build} complete.</echo>
</target>
<!--
=================================
Target: jslint
Test for Jenkins to run on initial setup output="${webroot}/compile_check/jslint.xml"
=================================
-->
<target name="jslint" description="Run the JSLint tool on JS files" depends="compile.copy">
<fileset dir="${webroot}/compile_check/javascripts" id="jsfiles.raw">
<include name="**/*.js" />
</fileset>
<pathconvert pathsep=" " property="jsfiles.clean" refid="jsfiles.raw" />
<exec executable="java">
<arg line="-jar ${webroot}/compile_check/jslint4java-2.0.1.jar --report xml ${jsfiles.clean}" />
</exec>
</target>
<!--
=================================
Target: jenkinsTest
Test for Jenkins to run on initial setup
=================================
-->
<target name="jenkinsTest">
<echo>Full speed ahead Scotty!</echo>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment