简体   繁体   English

Haxe构建过程中的代币?

[英]Tokens in Haxe build process?

I'm using Haxe to make a few simple SWFs for RTMP video streaming. 我正在使用Haxe为RTMP视频流制作一些简单的SWF。 Everything is working great, but what I'd really like to do is tokenize a few properties so that the SWFs are compiled with environment specific properties ALA Ant. 一切工作都很好,但是我真正想做的是标记一些属性,以便使用环境特定的属性ALA Ant编译SWF。

EG: 例如:

var host = "rtmp://localhost:1935/broadcasts";

Becomes: 成为:

var host = "@RTMP_ADDRESS@"

And then during compile, the token is substituted with an environment specific value- local.properties contains: 然后在编译期间,将令牌替换为特定于环境的值-local.properties包含:

RTMP_ADDRESS=rtmp://localhost:1935/broadcasts

I've poked around in documentation and on forum posts and can't see how to do this, though I'm sure it's possible. 我已经在文档和论坛帖子中闲逛了,虽然我确信这是可能的,但看不到如何做到这一点。 Can anyone point me in the right direction? 谁能指出我正确的方向?

Note: I considered using flashvars and managing the address in the web application, but that seems less efficient. 注意:我考虑过使用flashvars并在Web应用程序中管理地址,但这似乎效率较低。 If that's the better way to handle this please explain why. 如果那是处理此问题的更好方法,请解释原因。

It sounds a perfect case to use macros , which is in the nightly build of haxe. 的夜晚构建中,使用听起来是一个完美的案例。 You can create a config file (maybe in xml format) inside your project, and in the body of your macro function you load the file and extract the String, finally return it as an expression. 您可以在项目内部创建一个配置文件(也许是xml格式),然后在宏函数的主体中加载该文件并提取String,最后将其作为表达式返回。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM