sbt-haxe 是 Sbt 插件,用来编译 Java 或者 Scala 项目中的 Haxe 源。
在 project/plugins.sbt 中加入以下代码:
addSbtPlugin("com.qifun" % "sbt-haxe" % "1.0.0")
然后在build.sbt中增加haxeSettings:
haxeSettings
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
sbt-haxe提供了以下任务项和配置项:
haxe
dox
haxeCommand
haxelibCommand
doxPlatforms
欲知上述任务项和配置项的详情,请参见src/main/scala/com/qifun/sbtHaxe/HaxePlugin.scala。
sbt-haxe需要Sbt 0.13、Haxe 3.1、hxjava 3.1.0、Dox 1.0.0。