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

Execute global directives before runtime config #56

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

hinerm
Copy link
Collaborator

@hinerm hinerm commented Sep 18, 2024

Fixes #47 by executing global directives before the runtime is configured.

@hinerm
Copy link
Collaborator Author

hinerm commented Sep 18, 2024

@ctrueden the only reason I didn't merge directly is that there is a bit of oddness with user args not being validated until they've already been used in the global directives. So I can imagine a situation where a user launches an app with some invalid argument, it successfully applies an update, but then quits because of the arg.

Personally I find this tolerable given that I prefer the two passes of executing directives to one with maybe a second runtime configuration.

I didn't see any utility in checking args before executing the global directives, since we can't definitively reject any args until we have the runtimes later.

Copy link
Member

@ctrueden ctrueden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Very nice, logical solution.

I can imagine a situation where a user launches an app with some invalid argument, it successfully applies an update, but then quits because of the arg.

Yeah, I agree it's a bit strange, but also that it's a minor issue... maybe even a non-issue. Unless/until a third global directive besides help and apply-updates comes along, we shouldn't really have to worry about it much, eh? 😄

src/commonMain/kotlin/main.kt Outdated Show resolved Hide resolved
Global directives are necessarily runtime-agnostic, and may have impact
on building the subsequent runtimes (e.g. in the case of applying
updates and then building a classpath that includes those updated
libraries).

Thus we split directive execution into two phases: first global
directives, then runtime directives (after runtimes have been
configured).

Closes #47
Closes #55
@hinerm hinerm merged commit 2b48423 into main Sep 19, 2024
4 checks passed
@hinerm hinerm deleted the separate-global-directives branch September 19, 2024 14:56
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.

apply-update directive does not reconfigure runtimes afterward
2 participants