manifold-systems / manifold

Manifold is a Java compiler plugin, its features include Metaprogramming, Properties, Extension Methods, Operator Overloading, Templates, a Preprocessor, and more.
http://manifold.systems/
Apache License 2.0
2.41k stars 125 forks source link

Apply @NoBootstrap to Packages #634

Open ByThePowerOfScience opened 2 weeks ago

ByThePowerOfScience commented 2 weeks ago

[EDITED] Is your feature request related to a problem? Please describe. Sometimes, especially when working with DSLs, large quantities of classes should be excluded from having the static { IBootstrap.dasBoot(); } block injected into them. Rather than annotate each of them with @NoBootstrap, it would be easier to exclude the whole package at once by annotating the package-info.java file instead.

Describe the solution you'd like Allow the @manifold.rt.api.NoBootstrap annotation to be placed on package-info.java package declarations, and have that apply the property to all of its child classes and packages.

rsmckinney commented 2 weeks ago

Hi @ByThePowerOfScience. You can read more about manifold runtime bootstrapping here. But your classes probably don't need this, so you can eliminate it by modifying how you configure the manifold compiler plugin in your build using the no-bootstrap argument.

Gradle

options.compilerArgs += ['-Xplugin:Manifold no-bootstrap']

Maven

<compilerArgs>
    <arg>-Xplugin:Manifold no-bootstrap</arg>
</compilerArgs>

Regarding manifold-delegation-rt, this is needed at runtime purely as compiled runtime utility behavior. Basically, the code that is compiled to perform true delegation is encapsulated in the manifold.ext.delegation.rt.RuntimeMethods class. This is the only class in manifold-delegation-rt. It should pose no problems with minecraft. Let me know otherwise. Thanks.

ByThePowerOfScience commented 2 weeks ago

@rsmckinney

Hi @ByThePowerOfScience. You can read more about manifold runtime bootstrapping here.

Thank you for pointing me to this! I also see the @NoBootstrap annotation here, which would also do the trick should I need bootstrapping for any reason.

In that case, I should amend my feature request to be "Apply @NoBootstrap to packages".

rsmckinney commented 4 days ago

Looks good, I'll integrate this soon. thanks!