remkop / picocli

Picocli is a modern framework for building powerful, user-friendly, GraalVM-enabled command line apps with ease. It supports colors, autocompletion, subcommands, and more. In 1 source file so apps can include as source & avoid adding a dependency. Written in Java, usable from Groovy, Kotlin, Scala, etc.
https://picocli.info
Apache License 2.0
4.8k stars 414 forks source link

picocli-codegen does not generate native-image.properties #2220

Closed nreid260 closed 2 months ago

nreid260 commented 4 months ago

According to the native-image docs at https://www.graalvm.org/latest/reference-manual/native-image/overview/BuildConfiguration/, a native-image.properties file is needed to inform the tool about config files under META-INF/native-image. picocli-codegen generates config files, but not the native-image.properties.

remkop commented 4 months ago

It looks like this configuration file is recommended and not mandatory.

Also, looking at the documentation, I am not sure that picocli can provide many of the values to be configured. Which values can be autogenerated by the annotation processor? It seems that many values require human decision-making, or am I missing something?

nreid260 commented 4 months ago

It's possible to specify the -H:ReflectionConfigurationResources, -H:ResourceConfigurationResources, and -H:DynamicProxyConfigurationResources flags, which correspond to the existing generators.

I agree this file might not be necessary. I honestly can't tell from the Graal docs. I think the existing file names are auto-detected by native-image, but https://www.graalvm.org/latest/reference-manual/native-image/overview/BuildConfiguration/ says nothing about that. Minimally, generating a native-image.properties would clarify.

I filed this after spending several hours guessing why native-image was ignoring the generated config files. But that seems to be an unrelated bug in the tool about the JAR format (maybe zip64?).

remkop commented 2 months ago

Sorry for the long silence. Looking at the documentation, the native-image.properties file is optional. It is recommended, but not required.

I prefer not to generate a native-image.properties file, and instead keep the current behaviour, which is to generate config files under META-INF/native-image/.

You mentioned you were experiencing issues where native-image was ignoring the generated config files. Have you been able to resolve that, and was that caused by picocli?

nreid260 commented 2 months ago

I have confirmed the issue was https://github.com/oracle/graal/issues/8500

remkop commented 2 months ago

Excellent, thank you for the confirmation!