8000 Is support aot? · Issue #617 · sebastienros/fluid · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Is support aot? #617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Cricle opened this issue Jan 3, 2024 · 11 comments
Open

Is support aot? #617

Cricle opened this issue Jan 3, 2024 · 11 comments

Comments

@Cricle
Copy link
Cricle commented Jan 3, 2024

I try

class A
{
    public int D1 { get; set; }
    public int D2 { get; set; }

    public B B { get; set; }

    public IList<B> Bs { get; set; }
}
class B
{
    public string W1 { get; set; }
}

            var f = new FluidParser(new FluidParserOptions { AllowFunctions = true });
            var temp=f.Parse("""
                These shoes are awesome! {{ D1 }} {{ B.W1 }}
""");
            var a = new A { D1 = 123, B = new B { W1 = "456" } };
            Console.WriteLine(temp.Render(new TemplateContext(a)));
dotnet run

Result is These shoes are awesome! 123, but when I try dotnet publish -c Release -r win-x64 -p:PublishAot=true, result is These shoes are awesome!

@hishamco
Copy link
Collaborator
hishamco commented Jan 3, 2024

Which version?

@lahma
Copy link
Collaborator
lahma commented Jan 3, 2024

Fluid currently isn't AOT compatible so as types are dynamically accessed the results will be wrong, like you've noticed.

@hishamco
Copy link
Collaborator
hishamco commented Jan 3, 2024

-p:PublishAot=true

Oops I didn't notice the flag, thanks @lahma, that's why I was asking myself why the title contains AOT :)

@Cricle
Copy link
Author
Cricle commented Jan 3, 2024

Has any plan to support aot compile in the feature?
Or has any method to make it work?

@sebastienros
Copy link
Owner

Has any plan to support aot compile in the feature?

I started some work around it, but haven't made progress in a year.
Could you describe your scenario where you need AOT?

@Cricle
Copy link
Author
Cricle commented Jan 4, 2024

I am currently trying to create a program that interacts with GitLab and other websites through webhook. I want to use Microsoft's' cloud native 'approach. Currently, all components used except for Fluid can be AOT enabled, so I am wondering if Fluid also supports AOT.

Thanks

@lahma
Copy link
Collaborator
lahma commented Jan 4, 2024

Would probably require use of source generators and non-trivial amount of work.

@Cricle
Copy link
Author
Cricle commented Jan 4, 2024

I would try to write object to FluidValue source generation use roslyn, but it will be defined like json serialization such as ignore, deep...

I think it will drop the reflection in model use.

@lahma
Copy link
Collaborator
lahma commented Jan 4, 2024

Please draft a PR to demonstrate your ideas 👍🏻

@Cricle
Copy link
Author
Cricle commented Jan 4, 2024

I will try to do it

@jinjaeyeon
Copy link

Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0