typelead / etlas

Etlas, the build tool and package manager for the Eta programming language
63 stars 10 forks source link

etlas repl/install doenst work outside a project dir (global variant) #89

Closed jneira closed 5 years ago

jneira commented 5 years ago

(pointed by @rahulmutt in gitter)

C:\> etlas install pandoc
etlas: There is no etlas.dhall, <pkgname>.etlas, <pkgname>.cabal package file
or cabal.project file. To build packages locally you need at minimum an
etlas.dhall, <pkgname>.etlas or <pkgname>.cabal file. You can use 'etlas init'
to create one.

For non-trivial projects you will also want a cabal.project file in the root
directory of your project. This file lists the packages in your project and
all other build configuration. See the Etlas user guide for full details.
C:\>cabal new-repl
Resolving dependencies...
Build profile: -w ghc-8.6.3 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (lib) (first run)
Configuring library for fake-package-0..
Preprocessing library for fake-package-0..
Warning: No exposed modules
GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
Prelude>
jneira commented 5 years ago

The relevant pr adding the feature of global repl in cabal is: https://github.com/haskell/cabal/pull/5454

jneira commented 5 years ago

Maybe the etlas install global part is related to https://github.com/typelead/eta/issues/920

jneira commented 5 years ago

The etlas install outside a project should be fixed with #91. Only left etlas repl

jneira commented 5 years ago

etlas repl should be fixed fixed with #92

rahulmutt commented 5 years ago

@jneira I've built your changes and I'm still getting this:


$ etlas repl
etlas: No targets given and there is no package in the current directory. Use
the target 'all' for all packages in the project or specify packages or
components by name or location. See 'etlas build --help' for more details on
target options.
jneira commented 5 years ago

Mmm, is there some subfolder with config files?, i've tested it in a empty dir and works for me:

D:\dev\lang\eta>mkdir empty

D:\dev\lang\eta>cd empty

D:\dev\lang\eta\empty>etlas repl

Prelude> import Data.Maybe

Prelude Data.Maybe> :t fromJust
fromJust :: Maybe a -> a
rahulmutt commented 5 years ago

Yes, you're right - thanks for catching that! Doing that worked for me as well. I wonder if global repl should be triggered if there's no package description file OR a cabal.project in the current folder.

For example I just ran etlas repl in my home directory which has neither cabal.project or a .cabal file in the current directory, but yet it caused an issue. I found that to be rather counterintuitive.

jneira commented 5 years ago

I get the error when running etlas repl in a dir with subdirectories containing config files:


D:\dev\lang\eta\eta-test-multi>etlas repl
etlas: No targets given and there is no package in the current directory. Use
the target 'all' for all packages in the project or specify packages or
components by name or location. See 'etlas build --help' for more details on
target options.

D:\dev\lang\eta\eta-test-multi>tree
Listado de rutas de carpetas para el volumen DATA
El número de serie del volumen es E2A2-4E65
D:.
├───dist
│   └───cache
├───package1
│   ├───dist
│   │   └───cache
│   └───src
└───package2
    └───src

D:\dev\lang\eta\eta-test-multi>etlas repl package1
Resolving dependencies...
In order, the following will be built (use -v for more details):
 - package1-0.1.0.0 (lib) (first run)
Configuring library for package1-0.1.0.0..
Preprocessing library for package1-0.1.0.0..

╭─── Welcome to Eta REPL v0.8.6b4! ────────────────────────╮
│                                                          │
│ :help for help                                           │
│ :exit to exit                                            │
│ :type [expr] for type of expression                      │
│ :kind [type] for kind of type                            │
│ :kind! [type] for kind of simplified type                │
│                                                          │
│ it refers to the last expression                         │
│                                                          │
│ For more details, check out https://eta-lang.org         │
│                                                          │
╰──────────────────────────────────────────────────────────╯

[1 of 1] Compiling Example

Successful! One module loaded.

*Example> [0m[0m
jneira commented 5 years ago

For example I just ran etlas repl in my home directory which has neither cabal.project or a .cabal file in the current directory, but yet it caused an issue. I found that to be rather counterintuitive.

I think it is caused by the default project config. It actually has:

projectPackagesOptional = [ "./*.cabal", "./*.etlas", "./etlas.dhall"
                                  , "./*/*.cabal", "./*/*.etlas", "./*/etlas.dhall" ]

The ./*/file make any dir with package subdirs an implicit project based directory. Cabal works in a similar way (but only with ./*.cabal, ./*/*.cabal in projectPackages)

rahulmutt commented 5 years ago

Hmm I guess that's OK for now. Being able to pick up packages like that is nice.

jneira commented 5 years ago

Closing this, going forward to make new-clean the default!