mirror of
https://github.com/anoma/juvix.git
synced 2024-12-15 01:52:11 +03:00
68d4314c78
This PR: * Modifies entry point `_entryPointBuildDir` to use the `BuildDir` type instead of `SomeBase Dir`. This allows delayed resolution of the default build directory which was useful for the Package -> Concrete translation point below. * Modifies `juvix dev root` to render the current package as a Package.juvix file. * Modifies the Package -> Concrete translation to recognise default arguments. So, for example, an empty `juvix.yaml` file will be translated into the following (instead of the `name`, `version`, and `dependencies` arguments being populated). module Package; import Stdlib.Prelude open; import PackageDescription.V1 open; package : Package := defaultPackage; * Adds a temporary command (removed when juvix.yaml support is removed) `juvix dev migrate-juvix-yaml` that translates `juvix.yaml` into an equivalent `Package.juvix` in the current project. * Adds a temporary script `migrate-juvix-yaml.sh` (removed when juvix.yaml support is removed) which can be run in the project to translate all Juvix projects in the repository. * Actually translate all of the `juvix.yaml` files to `Package.juvix` using the script. * Part of https://github.com/anoma/juvix/issues/2487
149 lines
3.9 KiB
Haskell
149 lines
3.9 KiB
Haskell
module Commands.Dev.Options
|
|
( module Commands.Dev.Options,
|
|
module Commands.Dev.Asm.Options,
|
|
module Commands.Dev.Core.Options,
|
|
module Commands.Dev.Geb.Options,
|
|
module Commands.Dev.Internal.Options,
|
|
module Commands.Dev.Parse.Options,
|
|
module Commands.Dev.Highlight.Options,
|
|
module Commands.Dev.Scope.Options,
|
|
module Commands.Dev.Termination.Options,
|
|
module Commands.Dev.DisplayRoot.Options,
|
|
)
|
|
where
|
|
|
|
import Commands.Dev.Asm.Options hiding (Compile)
|
|
import Commands.Dev.Core.Options
|
|
import Commands.Dev.DisplayRoot.Options
|
|
import Commands.Dev.Geb.Options
|
|
import Commands.Dev.Highlight.Options
|
|
import Commands.Dev.Internal.Options
|
|
import Commands.Dev.MigrateJuvixYaml.Options
|
|
import Commands.Dev.Parse.Options
|
|
import Commands.Dev.Repl.Options
|
|
import Commands.Dev.Runtime.Options
|
|
import Commands.Dev.Scope.Options
|
|
import Commands.Dev.Termination.Options
|
|
import Commands.Repl.Options
|
|
import CommonOptions
|
|
|
|
data DevCommand
|
|
= DisplayRoot RootOptions
|
|
| Highlight HighlightOptions
|
|
| Internal InternalCommand
|
|
| Core CoreCommand
|
|
| Geb GebCommand
|
|
| Asm AsmCommand
|
|
| Runtime RuntimeCommand
|
|
| Parse ParseOptions
|
|
| Scope ScopeOptions
|
|
| Termination TerminationCommand
|
|
| JuvixDevRepl ReplOptions
|
|
| MigrateJuvixYaml MigrateJuvixYamlOptions
|
|
deriving stock (Data)
|
|
|
|
parseDevCommand :: Parser DevCommand
|
|
parseDevCommand =
|
|
hsubparser
|
|
( mconcat
|
|
[ commandHighlight,
|
|
commandInternal,
|
|
commandCore,
|
|
commandGeb,
|
|
commandAsm,
|
|
commandRuntime,
|
|
commandParse,
|
|
commandScope,
|
|
commandShowRoot,
|
|
commandTermination,
|
|
commandJuvixDevRepl,
|
|
commandMigrateJuvixYaml
|
|
]
|
|
)
|
|
|
|
commandHighlight :: Mod CommandFields DevCommand
|
|
commandHighlight =
|
|
command "highlight" $
|
|
info
|
|
(Highlight <$> parseHighlight)
|
|
(progDesc "Highlight a Juvix file")
|
|
|
|
commandInternal :: Mod CommandFields DevCommand
|
|
commandInternal =
|
|
command "internal" $
|
|
info
|
|
(Internal <$> parseInternalCommand)
|
|
(progDesc "Subcommands related to Internal")
|
|
|
|
commandGeb :: Mod CommandFields DevCommand
|
|
commandGeb =
|
|
command "geb" $
|
|
info
|
|
(Geb <$> parseGebCommand)
|
|
(progDesc "Subcommands related to JuvixGeb")
|
|
|
|
commandCore :: Mod CommandFields DevCommand
|
|
commandCore =
|
|
command "core" $
|
|
info
|
|
(Core <$> parseCoreCommand)
|
|
(progDesc "Subcommands related to JuvixCore")
|
|
|
|
commandAsm :: Mod CommandFields DevCommand
|
|
commandAsm =
|
|
command "asm" $
|
|
info
|
|
(Asm <$> parseAsmCommand)
|
|
(progDesc "Subcommands related to JuvixAsm")
|
|
|
|
commandRuntime :: Mod CommandFields DevCommand
|
|
commandRuntime =
|
|
command "runtime" $
|
|
info
|
|
(Runtime <$> parseRuntimeCommand)
|
|
(progDesc "Subcommands related to the Juvix runtime")
|
|
|
|
commandParse :: Mod CommandFields DevCommand
|
|
commandParse =
|
|
command "parse" $
|
|
info
|
|
(Parse <$> parseParse)
|
|
(progDesc "Parse a Juvix file")
|
|
|
|
commandScope :: Mod CommandFields DevCommand
|
|
commandScope =
|
|
command "scope" $
|
|
info
|
|
(Scope <$> parseScope)
|
|
(progDesc "Parse and scope a Juvix file")
|
|
|
|
commandShowRoot :: Mod CommandFields DevCommand
|
|
commandShowRoot =
|
|
command "root" $
|
|
info
|
|
(DisplayRoot <$> parseRoot)
|
|
(progDesc "Show the root path for a Juvix project")
|
|
|
|
commandTermination :: Mod CommandFields DevCommand
|
|
commandTermination =
|
|
command "termination" $
|
|
info
|
|
(Termination <$> parseTerminationCommand)
|
|
(progDesc "Subcommands related to termination checking")
|
|
|
|
commandJuvixDevRepl :: Mod CommandFields DevCommand
|
|
commandJuvixDevRepl =
|
|
command
|
|
"repl"
|
|
( info
|
|
(JuvixDevRepl <$> parseDevRepl)
|
|
(progDesc "Run the Juvix dev REPL")
|
|
)
|
|
|
|
commandMigrateJuvixYaml :: Mod CommandFields DevCommand
|
|
commandMigrateJuvixYaml =
|
|
command "migrate-juvix-yaml" $
|
|
info
|
|
(MigrateJuvixYaml <$> parseMigrateJuvixYaml)
|
|
(progDesc "Migrate juvix.yaml to Package.juvix in the current project")
|