Skip to content
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

Add picocli annotation processor #500

Closed
remkop opened this issue Sep 28, 2018 · 2 comments
Closed

Add picocli annotation processor #500

remkop opened this issue Sep 28, 2018 · 2 comments
Milestone

Comments

@remkop
Copy link
Owner

remkop commented Sep 28, 2018

Annotation processor to build a CommandSpec model from the picocli annotations in the source code at compile time.

This would make it possible to build tools for picocli-based applications that do more interesting work during the build:

@remkop remkop changed the title Add module picocli-ann-proc Add picocli annotation processor Nov 6, 2018
@remkop
Copy link
Owner Author

remkop commented Nov 6, 2018

Work in progress is to add an abstract annotation processor to the picocli-codegen module (no new module). This annotation processor will inspect the source code and build up a list of CommandSpec models from the annotations. Subclasses can override and implement a method to do useful work with these CommandSpec objects.

@remkop remkop added this to the 4.0 milestone Nov 10, 2018
remkop added a commit that referenced this issue Jan 30, 2019
* add separate module picocli-annotation-processing-tests for testing (com.google.testing.compile:compile-testing requires Java 8)
* (API) add ITypeInfo that encapsulated type information available at both runtime and compile time
* add RuntimeTypeInfo implementation used at runtime (reflection)
* (API) add IAnnotatedElement as public API for method and fields annotated with any picocli annotation
* internal class TypedMember now implements IAnnotatedElement
* (API) CommandSpec.resourceBundleBaseName() getter and setter
* (API) Messages.resourceBundleBaseName() getter
* (API) ArgSpec.userObject() getter
* (API) made MethodParam public
* IGetter/ISetter implementations now have informative toString() methods
* removed internal class ArgsReflection
remkop added a commit that referenced this issue Jan 31, 2019
@remkop remkop modified the milestones: 4.0, 4.0-beta-1 May 13, 2019
remkop added a commit that referenced this issue May 19, 2019
remkop added a commit that referenced this issue May 20, 2019
remkop added a commit that referenced this issue May 21, 2019
remkop added a commit that referenced this issue May 21, 2019
* fix test for improved validation
* load ResourceBundle if possible
* add fatalError and warn protected methods for processor subclasses
remkop added a commit that referenced this issue May 22, 2019
remkop added a commit that referenced this issue May 23, 2019
@remkop
Copy link
Owner Author

remkop commented May 24, 2019

TODO:

  • change relative path to META-INF/picocli-generated/$groupId/$artifactId/...
  • if no groupId and artifactId are specified, insert a UUID to ensure a unique location? -> No, that would result in many subdirecties under picocli-generated/...
  • cleanup: remove JUL logging (WONT DO)
  • polish: add logging via the Messager.printMessage(Diagnostic.Kind) API (at NOTE level?)
    • log user-specified option values, log path where file is generated
    • TBD change groupId and artifactId to group and name? (WONT DO)
    • TBD change groupId and artifactId to a single option: path or coordinates or id or project?
    • log class/method names of @Command-annotated elements in abstract processor (WONT DO)
  • warn if ResourceBundle not found? Include ResourceBundle even if not found? fixed bug
  • documentation
  • Add options disable.reflect.config, disable.proxy.config, disable.resource.config, project
  • Other processors may need options like location, relative.path, full.path (but each processor may need a different output location, e.g., autocompletion script, man pages, ...)
  • logInfo should prefix simple name instead of full class name
  • add isEnabled protected method to abstract proc. Skip processing if disabled. Log "$proc is available but not enabled" when processing done
  • test that no files are generated when disabled

remkop added a commit that referenced this issue May 24, 2019
* fixed resource bundle related bugs in CommandLine (bundle may be null while bundleBaseName is not null in annotation processors)
* all annotation processors now support a `relative.path` option (replaces the `groupId` and `artifactId` options)
* DynamicProxyConfigGeneratorProcessor now supports a `interfaceClasses` option for additional interface names
* ResourceConfigGeneratorProcessor now supports a `bundles` option for additional resource bundles and a `resourceRegex` option for additional other resources
* added tests
remkop added a commit that referenced this issue May 24, 2019
remkop added a commit that referenced this issue May 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant