sbt-haxe is a Sbt plugin to compile Haxe sources in Java/Scala projects.
Add the following line to your project/plugins.sbt
:
addSbtPlugin("com.thoughtworks.microbuilder" % "sbt-haxe" % "3.0.11")
package yourPackage;
import haxe.ds.Vector;
class YourHaxeClass
{
public static function main(args:Vector<String>)
{
trace("Hello, World!");
}
}
$ sbt run
[info] Loading global plugins from C:\Users\user\.sbt\0.13\plugins
[info] Loading project definition from D:\Documents\sbt-haxe-test\project
[info] Set current project to sbt-haxe-test (in build file:/D:/Documents/sbt-haxe-test/)
[info] "haxe" "-cp" "D:\Documents\sbt-haxe-test\src\haxe" "-cp" "D:\Documents\sbt-haxe-test\target\scala-2.10\src_managed\haxe" "-java-lib" "C:\Users\user\.sbt\boot\scala-2.10.3\lib\scala-library.jar" "-java" "D:\cygwin\tmp\sbt_97a26bd9" "-D" "no-compilation" "yourPackage.YourHaxeClass"
[info] Compiling 1 Java source to D:\Documents\sbt-haxe-test\target\scala-2.10\classes...
[info] Running yourPackage.YourHaxeClass
YourHaxeClass.hx:7: Hello, World!
[success] Total time: 1 s, completed 2014-7-25 10:00:23
Currently sbt-haxe
supports all targets that haxe supported, but all of them are disabled by default except java
. If you want to compile to specific target other than java
, you need to enable it manually in build.sbt
.
And here's a sbt-haxe-sample project to show how to use them.
- JavaScript
enablePlugins(HaxeJsPlugin)
- PHP
enablePlugins(HaxePhpPlugin)
- Neko
enablePlugins(HaxeNekoPlugin)
- C#
enablePlugins(HaxeCSharpPlugin)
- Python
enablePlugins(HaxePythonPlugin)
- C++
enablePlugins(HaxeCppPlugin)
- Flash
enablePlugins(HaxeFlashPlugin)
- ActionScript 3
enablePlugins(HaxeAs3Plugin)
sbt-haxe
provides following tasks and settings:
- haxe
- haxe:doc
- haxe:publish
See HaxeKeys.scala for more information.
sbt-haxe
requires Sbt 0.13, Haxe 3.1, hxjava 3.1.0 and Dox 1.0.0.