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

Proposal: js/native subcommands instead of arg prefixing #2796

Open
keynmol opened this issue Mar 13, 2024 · 5 comments
Open

Proposal: js/native subcommands instead of arg prefixing #2796

keynmol opened this issue Mar 13, 2024 · 5 comments

Comments

@keynmol
Copy link
Contributor

keynmol commented Mar 13, 2024

Problem and current state

Both Scala.js and Scala Native have a long list of supported features, which are currently encoded as --(js|native)-... flags that get progressively longer.

Managing those flags in the CLI invocations can get difficult, especially with Native linking/compilation flags.

The flags are separately named to avoid clashing, but if you are working on a pure JS or pure Native project, having to repeat --native- or --js- becomes annoying

Flags from two different platforms are meaningless when used in a single invocaiton, e.g. this is a valid command:

> scli package . -f -o package.js --js --native-linking -lm

Proposal

  • Introduce scala-cli js and scala-cli native subcommands,
  • remove --native-/--js- prefixes from flags when used in one of those subcommands
  • finetune the set of flags, subcommands, and behaviours when used as part of js or native subcommand

Under this proposal:

JVM: scala-cli compile/package/etc.. Open question - leaving the prefixed flags as part of this for compatibility?

Native: scala-cli native compile/package/etc., flags: --linking, --compilation, --version, etc. without suffixes + various "shared" flags, such as Scala version, options, etc.

JS: scala-cli js compile/package/etc., flags: --es-module-import-map, --dom, --version, etc. without suffixes + various "shared" flags, such as Scala version, options, etc.

@Gedochao
Copy link
Contributor

Closely related discussion: #1794
cc @lbialy

@lbialy
Copy link

lbialy commented Mar 14, 2024

I'm deeply interested in sorting this whole area out. The default for artifact format (bootstraped jars) leaks into docker delivery format, can't be changed to assembly and limits the usability a lot. I have some ideas around the artifact format (and artifact wrapper if necessary) x artifact delivery format (deb, rpm, docker) matrix and it's somewhat similar to what is proposed here.

@keynmol
Copy link
Contributor Author

keynmol commented Mar 15, 2024

Worth mentioning that this applies to commands like run and compile as well - there are platform-specific flags that affect the compiler plugin behaviour even before any physical artifact is produced (compile), or if the physical artifact format is pre-selected for the user (like run).

So it's not about packaging per se - it's a general issue of platform separation, with packaging matrix being one aspect of it.

@lbialy
Copy link

lbialy commented Mar 16, 2024

Ah, but there's a problem that some of these commands are already covered by SIP and are not --power or experimental :/ @Gedochao what do you think? The option proliferation is an actual problem because of non-sensical combinations and verbosity but if we fix this is just package with subcommands it will bring inconsistency with other commands :(

Moreover, I don't think case-app supports subcommands out of the box? Does it support nested sealed traits and therefore kubectl like syntaxes (eg.: kubectl get pods, kubectl describe deployment, etc)? @alexarchambault

@Gedochao
Copy link
Contributor

@lbialy let's first design how would we like to fix it and then consider whether we want the changes to affect SIP-covered commands like compile and run as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants