raamcosta / compose-destinations

Annotation processing library for type-safe Jetpack Compose navigation with no boilerplate.
https://composedestinations.rafaelcosta.xyz
Apache License 2.0
3.23k stars 134 forks source link

exclude html and mermaid graph from the apk #704

Open jzeferino opened 20 hours ago

jzeferino commented 20 hours ago

hey! can we add a configuration so that generated files like mermaid graph and other navigation html files are not shipped with the apk?

raamcosta commented 20 hours ago

Hi!

Are they included? 🤔 You mean by default if you're not setting this?

ksp {
    // .mmd file
    arg("compose-destinations.mermaidGraph", "$rootDir/docs")
    // .html file
    arg("compose-destinations.htmlMermaidGraph", "$rootDir/docs")
}

https://composedestinations.rafaelcosta.xyz/v2/defining-navgraphs#through-mermaid-graphs

jzeferino commented 20 hours ago

yes exactly, by default.

raamcosta commented 20 hours ago

Can you try the above configs?

extmkv commented 20 hours ago

Hey there, Changing the output target works. Its also possible to remove it from APK using the packaging options, as pointed by

resources {
    excludes += "com/ramcosta/composedestinations/generated/mermaid/**"
}

While it does not increase the size that much and it doesnt looks like it includes anything that would be a security risk (apart from potentially leaking upcoming features), we are still including/shipping something that is not needed.

I think it would be great to have a gradle property to disable it in general.

Screenshot 2024-11-25 at 10 30 54 Screenshot 2024-11-25 at 10 29 06

jzeferino commented 20 hours ago

would be interesting if by default those files were not added. only if explicitly set up by the developer.

raamcosta commented 20 hours ago

I failed to consider this, sorry about that. In hindsight it seems so obvious 🤦

Yes, I agree, let's disable it unless the developers provide a directory for it.