0

Hi I'm new to Haxe and trying to build ANT script that executes the Haxe file to js file. Bellow is my build.xml file please correct me if I'm missing something, the error says it can't find the Haxe class "HelloWorld". The HelloWorld.hx resides in the aha/ folder which I've included in the "Sourcefiles"

<?xml version="1.0" ?>

<project name="AHA" default="main" basedir=".">
    <description>
        Simple example build file
    </description>
    <property name="buildDir" value="./buildFiles"/>

  <taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
      <pathelement location="./tools/ant/ant-contrib-0.3.jar" />
    </classpath>
  </taskdef>

    <target name="clean" description="Remove all generated files.">
        <delete dir="${buildDir}/" />
    </target>

    <target name="main" depends="clean">
        <!-- <property name="debug.target.app" value="app.js" /> -->
        <mkdir dir="${buildDir}" />
    <outofdate>
        <sourcefiles>
        <fileset dir="./aha/">
          <include name="**/*.hx" />
        </fileset>
    </sourcefiles>
    <targetfiles path="${buildDir}/*.js" />
    <sequential>
        <exec failonerror="true" executable="haxe">
          <!-- arg line="-lib polygonal-core -lib createjs" /-->
          <arg value="-js" />
          <arg file="${buildDir}" />
          <arg line="HelloWorld" />
    </exec>
    </sequential>
  </outofdate>
  </target>

</project>

when I run the ant command line I get the error as

C:\Users\vishwanath.kolkar\Desktop\ahaproject>ant
Buildfile: C:\Users\vishwanath.kolkar\Desktop\ahaproject\build.xml

clean:
   [delete] Deleting directory C:\Users\vishwanath.kolkar\Desktop\ahaproject\bui
ldFiles

main:
    [mkdir] Created dir: C:\Users\vishwanath.kolkar\Desktop\ahaproject\buildFile
s
     [exec] Class not found : HelloWorld

BUILD FAILED
C:\Users\vishwanath.kolkar\Desktop\ahaproject\build.xml:30: exec returned: 1

Total time: 0 seconds
Mark Knol
  • 9,663
  • 3
  • 29
  • 44
Vishwa
  • 134
  • 3
  • 3
  • 14

1 Answers1

0
<exec failonerror="true" executable="haxe">
          <!-- arg line="-lib polygonal-core -lib createjs" /-->
          <arg value="-js" />
          <arg line="-cp aha/" />
          <arg file="${buildDir}" />
          <arg line="HelloWorld" />
    </exec>

This will find the class I'm trying to access, I forgot to add the class path i.e -cp aha/ this aha/ folder contains my HelloWorld.hx and the class name is HelloWorld.

Vishwa
  • 134
  • 3
  • 3
  • 14