So what? There is not a macro for that? ;)
The same cache problem can happen for other use cases...
If I want to initialize an array of instances from a list of files in a
specific folder it will only works the first time. If I add or remove a
file in this folder it will not be taken into account. To make it works
I have to edit the class where the macro is called just to change its
timestamp...and this is not a good design for shared libraries.
Am I the only one to have this kind of problem?
Seriously, the compilation server is great but a simple way to manage it
could be useful. We just need a method to remove the cache of a module...
Le 15/07/2013 15:01, Fabien Antoine a �crit :
> Well, of course the code of the macro is in a class. Sorry, I think
> I'm not very clear.
>
> Take this piece of code :
>
> #if !macro @:build(pack.Foo.build()) #end
> class Foo {
> #if macro
> private static var _params : Array<String>;
>
> // This is the macro method I call from --macro argument
> public static funcation bar(params : Array<String>) : Void {
> Foo._params = params;
> }
>
> public static function build() {
> // I need to use Foo._params here
> return Context.getBuildFields();
> }
> #end
> }
>
> I compile my project with : haxe --macro Foo.bar(['a','b']) ...
>
> So which dependency should I use?
> I tried to add "Context.registerModuleDependency("Foo", "Foo.hx");" in
> the build() method but it doesn't work.
> If I change the parameters in the Foo.bar(...) call the class is not
> built again.
>
> I would like to be able to call Foo.params() from my main() method but
> the class is built before the macro is called.
>
> Le 15/07/2013 14:26, Andreas Mokros a �crit :
>> Hi.
>>
>> On Mon, 15 Jul 2013 14:19:39 +0200
>> Fabien Antoine <
fab.a...@gmail.com> wrote:
>>> The macro call is not in a file but specified with the "--macro"
>>> compiler argument.
>> But the code for the macro call is in a file, isn't it?
>>
>