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

Make client thin #955

Open
cstamas opened this issue Apr 20, 2024 · 3 comments
Open

Make client thin #955

cstamas opened this issue Apr 20, 2024 · 3 comments

Comments

@cstamas
Copy link
Member

cstamas commented Apr 20, 2024

Currently there is some heavy logic in client, but IMHO it is superfluous.
Instead, make client thin as possible:

  • it should collect all maven config and create "seed" (ie. by hashing these things opaquely)
  • based on "seed" select (or start) a daemon
  • it should collect CWD and CLI params and send those those to daemon
  • sit and wait, and let m39, m40, mXX decide what it likes or dislikes out of params
@gnodet
Copy link
Contributor

gnodet commented Apr 20, 2024

The goal is to fully respect what the user environment as usually loaded by maven.

The compatibility is defined by two simple things:

  • the JVM path (a String)
  • a list of options (List<String>)
    The list of options is known as discriminating options. Those are options that actually make the daemon different and thus needs a different daemon.
    So we can definitely compute a hash of those strings, but that won't really simplify things, as the tricky part is to list and gather those options, not to compare those. See
    private final Path javaHome;
    private final List<String> options;

For point #3, I think that's what the client roughly does. Why would that be different ? Here's what is sent to the daemon:

final List<String> args;
final String workingDir;
final String projectDir;
final Map<String, String> env;

Not sure to understand #4...

@cstamas
Copy link
Member Author

cstamas commented Jun 18, 2024

Point 4 is about "client should not try to interpret ANY command, just pass it to daemon and let it interpret (and return any error if params are bad)". This way the client could be even "universal", same client could work for mvnd 1 and mvnd 2 (maybe not, but this is the idea). So make client "thin" in a way it does very same thing always, is unaware of backend, is just a mailman (between user/terminal and backend).

@gnodet
Copy link
Contributor

gnodet commented Jun 18, 2024

Point 4 is about "client should not try to interpret ANY command, just pass it to daemon and let it interpret (and return any error if params are bad)". This way the client could be even "universal", same client could work for mvnd 1 and mvnd 2 (maybe not, but this is the idea). So make client "thin" in a way it does very same thing always, is unaware of backend, is just a mailman (between user/terminal and backend).

That can be done as long as the option is "compatible" between daemons. As soon as option cannot be changed between runs (such as JVM options), the client must select an appropriate option, so it needs to understand those. Also, options that affects the display have to be well understood and handled on the client, as that's the one displaying everything. In addition, there are a few mvnd specific options that need to be handled.
All in all, if you can point to any code we can get rid of, I'm all for it, but I don't see, at first glance, any code which sounds irrelevant.

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

2 participants