* language: fix: move interface files to a different
This fixes https://github.com/digital-asset/daml/issues/1009. We move
the created interface files and hie files to a hidden directory
".interfaces" when creating a package.
* removing the ifaceDir option and hardcode the dir
* compiler: follow ghc convention and put conf files in package.conf.d dir
We follow the ghc convention and locate all .conf files for the package
database in the `package.conf.d` dir.
* addressed neil's comment
* Implement cross-package goto definition
This is more tricky than one might think at first:
- The interface files do not contain proper source spans so we cannot
use the information in there.
- We could theoretically try to get the source location from the DALFs
but that is the wrong layer and also not an option when we want to
act as a Haskell IDE.
So what we do instead is whenever we write interface files we also
write .hie files and consult those instead when we get useless source
spans otherwise.
* Move optLocateHieFile and optLocateSrcFile to a separate type
* Remove a duplicated comment
* Remove traverse from the convertor
* Move removing typeable to the converter
* Don't reexport getGhcCore
* Move coresForFile to its usage
* Just print out the GHC Core for everything, including internal modules
* Move modIsInternal out of haskell-ide-core
* Move some DynFlags setters over to Config
* Remove an unused orphan instance
* Move the orphans out to a different module
* Move functions for generating import syntax out of haskell-ide-core
* Expose fakeDynFlags as a blob, not the pieces
* Clean up the definition of fakeDynFlags
* Inline showSDocDefault
* HLint
* Fix the comment on IDE.Orphans
* Split the Options into a separate module
* Make the Logger handle live in IO
* Reduce the amount of IDE logging to just two
* Rename CompileOpts to IdeOptions
* Rename PackageState to PackageDynFlags
* Clean up setting the PackageDynFlags
* Stop hiding PackageState, we no longer clash on it
* Introduce a helper for collecting the package flags
* Move the StringBuffer conversion to its only use
* I have no idea now LPat and Pat previously managed to unify...
* Avoid using unRealSrcSpan as its only introduced for GHC 8.8
* Add some CPP to permit compiling with GHC 8.6
* Permit CPP in one more place
* Remove the requirement for Binary on Shake rules (was not used)
* Add a deriving Show on Event, easier for external integrations
* Rename GeneratePackageState to LoadPackageState and move its fields to the rule, rather than the key
* Inline getPackageState away
* Change to passing a ModRenaming to the package loader. Two reasons:
1) When loading non-DAML things we might want to omit the renaming
2) The type ModRenaming has documentation of semantics, unlike [(String, String)]
Before it was garbled and wrong:
Range: Range Start: Position Line: 2Character: 15End: Position Line: 2Character: 15
After it's correct and like it was before:
Range: 3:15-3:17
* Move from prettyDiagnostic to prettyDiagnostics
* Remove as much pretty print stuff as we can
* Try moving duplicate named functions with similar semantics and identical types to different names
* Change to returning pretty printed outputs from Diagnostics
* Remove a redundant import
* Make the ScenarioService take an IO callback, not STM
* Remove a redundant space
* Use IO in preference to STM where we really don't care which is in use
* #564, always print out diagnostics for tests
* #564, fix getting the scenario names so if they can't be computed you give an answer
* Add a proper data type to represent pass/fail in the tests
* Centrailse printing a failure message
* Pull the test execution into a separate file, ensuring it always gives back an exit code
* Use nubOrd instead of Set
* Clean up how we figure out which files to test
* Fail if there are any errors
* Delete all the brittle failure tracking stuff
* Rename the compiler handle to h
* Only print out the successful results to stdout, since the unsuccessful ones end up in diagnostics
* Make JUnit output still print out the test results
* Make JUnit print out all the details
* Delete the stdio command path
* Break the bigger pieces apart in the test runner
* Inline testJUnit
* Shorten to UseColor
* Shorten to color
* Inline and comment part of the JUnit tests
* HLint
* Update daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Test.hs
Co-Authored-By: neil-da <35463327+neil-da@users.noreply.github.com>
* Fix an HLint refactoring snafu
* Fix up the damlc tests
* Tighten up a test by demanding it throws ExitFailure
* Move the IdeResult term into the A data type
* Nothing ever consults the errors stored in A, so stop storing them
* Use the new Shake MonadFail Rules instance
* Document the information in the Shake database
* More documentation of the data in the Shake service
* Change getValues to avoid getting the diagnostics
* Avoid fmap over a pair, a bit weird
* Add buildifier targets.
The tool allows to check and format BUILD files in the repo.
To check if files are well formatted, run:
bazel run //:buildifier
To fix badly-formatted files run:
bazel run //:buildifier-fix
* Cleanup dade-copyright-headers formatting.
* Fix dade-copyright-headers on files with just the copyright.
* Run buildifier automatically on CI via 'fmt.sh'.
* Reformat all BUILD files with buildifier.
Excludes autogenerated Bazel files.
* Add location information to DAML-LF produced by damlc
This is required to get error locations in the scenario view. Rigth now,
the location information for `create`/`exercise` still points to the
template/choice. I'll fix that in a separate PR.
* Fix test expectations
* Fix more tests
* Turn off -Woverlowed-literals in damlc
This flag does not play well with location information obtained via `-ticky`.
Also, the error message you get from overflowed literals suggests to use
`-XNegativeLiterals`, which is a bad idea since it changes the meaning of
`(-1)` from `\x -> x - 1` to `negate 1`.
* Fix module name in test
Co-Authored-By: martin-drhu-da <31696042+martin-drhu-da@users.noreply.github.com>
* HOTFIX damlc: allow for passing options to the underlying GHC
As `damlc` is based on GHC, it "understands" all options that GHC understands.
This PR introduces a way to use GHC options that are not exposed by the `damlc`
driver, by passing any number of `--ghc-option CUSTOM_OPTION` on the command line.
The code uses the GHC function which parses options inside files, so
prohibiting a few options that we would not want to expose (package db, output
file, etc).
All warnings that GHC emits during flag processing are presented to the user.
If an option contradicts a DAML compiler setting, the compilation will be
aborted with a GHC exception (calls makeDynFlagsConsistent internally).
* HOTFIX damlc: small clean-up