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

enable to run commands from a standalone java file #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rmannibucau
Copy link
Contributor

Idea behind this PR is to enable to use crest in standalone files (for simple and quick automotion).

Content should be plain commands.
To avoid the issue to have to add crest to the classpath, we have the hack to support to drop some special comments from the source (//-- is dropped, we should likely enhance it to support /*-- xxx --*/ to become xxx for options) which enables to code with a plain JDK.
To run the source file directly we use the JDK and ToolProvider (to get javac).
Then last trick is to pass as first parameter to crest --crest.source=/path/to/commands.java and we are done.
To ease this usage, a fatjar including tomitribe-util was done in tomitribe-crest.
Last change was to support not public commands (a detail but very nice in scripts).

The big benefit is to not require a project for all the small automotion we can write in our projects.

There are still some enhancements to this feature but I guess it is big enough for a first PR but here what can be the follow up:

  1. commands for inline annotations (options, defaultvalue etc)
  2. support multiple source files (CSV) enabling to have one command per file for ex
  3. enable to configure the compilation classpath if needed
  4. David special one: we are not far to be able to write commands source as a script if first line is a shebang and we ignore it, requires to drop the line + offset the compilation errors (if any) + have a special "input" path which would be "self" but does not sound crazy and can be quite promishing as usage

Hope it makes sense.

@rmannibucau
Copy link
Contributor Author

Up?

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

Successfully merging this pull request may close these issues.

1 participant