ghcide/.azure/windows-stack.yml
Matthew Pickering 373c4060df
Multi Component (#522)
* Multi component support

In this commit we add support for loading multiple components into one
ghcide session.

The current behaviour is that each component is loaded lazily into the
session. When a file from an unrecognised component is loaded, the
cradle is consulted again to get a new set of options for the new
component. This will cause all the currently loaded files to be
reloaded into a new HscEnv which is shared by all the currently known
components. The result of this is that functions such as go-to
definition work between components if they have been loaded into the
same session but you have to open at least one file from each component
before it will work.

Only minimal changes are needed to the internals to ghcide to make the
file searching logic look in include directories for all currently
loaded components. The main changes are in exe/Main.hs which has been
heavily rewritten to avoid shake indirections. A global map is created
which maps a filepath to the HscEnv which should be used to compile it.
When a new component is created this map is completely refreshed so each
path maps to a new

Which paths belong to a componenent is determined by the targets listed
by the cradle. Therefore it is important that each cradle also lists all
the targets for the cradle. There are some other choices here as well
which are less accurate such as mapping via include directories  which
is the aproach that I implemented in haskell-ide-engine.

The commit has been tested so far with cabal and hadrian.

Also deleted the .ghci file which was causing errors during testing and
seemed broken anyway.

Co-authored-by: Alan Zimmerman <alan.zimm@gmail.com>
Co-authored-by: fendor <power.walross@gmail.com>

* Final tweaks?

* Fix 8.4 build

* Add multi-component test

* Fix hlint

* Add cabal to CI images

* Modify path

* Set PATH in the right place (hopefully)

* Always generate interface files and hie files

* Use correct DynFlags in mkImportDirs

You have to use the DynFlags for the file we are currently compiling to
get the right packages in the package db so that lookupPackage doesn't
always fail.

* Revert "Always generate interface files and hie files"

This reverts commit 820aa24189.

* remove traces

* Another test

* lint

* Unset env vars set my stack

* Fix extra-source-files

As usual, stack doesn’t understand Cabal properly and doesn’t seem to
like ** wildcards so I’ve enumerated it manually.

* Unset env locally

Co-authored-by: Alan Zimmerman <alan.zimm@gmail.com>
Co-authored-by: fendor <power.walross@gmail.com>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-06-02 14:44:16 +02:00

69 lines
2.6 KiB
YAML

jobs:
- job: ghcide_stack_windows
timeoutInMinutes: 60
pool:
vmImage: 'windows-2019'
strategy:
matrix:
stack_810:
STACK_YAML: "stack810.yaml"
stack_88:
STACK_YAML: "stack88.yaml"
stack_86:
STACK_YAML: "stack.yaml"
stack_84:
STACK_YAML: "stack84.yaml"
stack_ghc_lib_88:
STACK_YAML: "stack-ghc-lib.yaml"
variables:
STACK_ROOT: "C:\\sr"
steps:
- checkout: self
- task: Cache@2
inputs:
key: stack-cache-v2 | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Cache stack artifacts"
- bash: |
mkdir -p $STACK_ROOT
tar -vxzf .azure-cache/stack-root.tar.gz -C /c
mkdir -p .stack-work
tar -vxzf .azure-cache/stack-work.tar.gz
displayName: "Unpack cache"
condition: eq(variables.CACHE_RESTORED, 'true')
- bash: |
./fmt.sh
displayName: "HLint via ./fmt.sh"
- bash: |
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip
unzip -o /usr/bin/stack.zip -d /usr/bin/
mkdir -p "$STACK_ROOT"
displayName: 'Install Stack'
- bash: stack setup --stack-yaml $STACK_YAML
displayName: 'stack setup'
- bash: |
# Installing happy and alex standalone to avoid error "strip.exe: unable to rename ../*.exe; reason: File exists"
stack install happy --stack-yaml $STACK_YAML
stack install alex --stack-yaml $STACK_YAML
stack install cabal-install --stack-yaml $STACK_YAML
stack build --only-dependencies --stack-yaml $STACK_YAML
displayName: 'stack build --only-dependencies'
- bash: stack test --no-run-tests --ghc-options=-Werror --stack-yaml $STACK_YAML
displayName: 'stack test --ghc-options=-Werror'
# TODO: run test suite when failing tests are fixed or marked as broken. See https://github.com/digital-asset/ghcide/issues/474
- bash: |
mkdir -p .azure-cache
tar -vczf .azure-cache/stack-root.tar.gz $(cygpath $STACK_ROOT)
tar -vczf .azure-cache/stack-work.tar.gz .stack-work
displayName: "Pack cache"
- bash: |
set -euo pipefail
MESSAGE=$(git log --pretty=format:%s -n1)
curl -XPOST \
-i \
-H 'Content-type: application/json' \
--data "{\"text\":\"<!here> *FAILED* $(Agent.JobName): <https://dev.azure.com/digitalasset/ghcide/_build/results?buildId=$(Build.BuildId)|$MESSAGE>\n\"}" \
$(Slack.URL)
condition: and(failed(), eq(variables['Build.SourceBranchName'], 'master'))