Skip to content

Commit 4d75549

Browse files
author
kokobd
committed
Merge branch 'master' into feat/selection-range
2 parents 23ea08e + 92a8cc0 commit 4d75549

File tree

5 files changed

+82
-79
lines changed

5 files changed

+82
-79
lines changed

.github/actions/setup-build/action.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
os:
1212
description: "Operating system: Linux, Windows or macOS"
1313
required: true
14+
cache-prefix:
15+
description: "To allow make unique the cache key"
16+
required: false
17+
default: ""
1418
runs:
1519
using: "composite"
1620
steps:
@@ -54,15 +58,6 @@ runs:
5458
fi
5559
shell: bash
5660

57-
# some alpines come with integer-simple instead of integer-gmp
58-
- if: inputs.os == 'Linux'
59-
name: Force integer-simple
60-
run: |
61-
if ghc --info | grep -q integer-simple ; then
62-
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
63-
fi
64-
shell: bash
65-
6661
- if: inputs.os == 'Windows' && inputs.ghc == '8.8.4'
6762
name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults
6863
run: |
@@ -123,11 +118,11 @@ runs:
123118
cache-name: compiled-deps
124119
with:
125120
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
126-
key: ${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
121+
key: ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
127122
restore-keys: |
128-
${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-
129-
${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-
130-
${{ env.cache-name }}-${{ inputs.os }}-
123+
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-
124+
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-
125+
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-
131126
132127
# We remove the freeze file because it could interfere with the build
133128
- name: "Remove freeze file"

.github/workflows/build.yml

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ on:
1111
jobs:
1212
build:
1313
runs-on: ${{ matrix.os }}
14-
container: ${{ (matrix.os == 'ubuntu-18.04' && 'alpine:3.12') || '' }}
14+
container: ${{ (startsWith(matrix.os,'ubuntu') && 'alpine:3.12') || '' }}
1515
defaults:
1616
run:
17-
shell: ${{ (matrix.os == 'windows-latest' && 'bash') || 'sh' }}
17+
shell: ${{ (startsWith(matrix.os,'windows') && 'bash') || 'sh' }}
1818
strategy:
1919
fail-fast: false
2020
matrix:
@@ -35,58 +35,45 @@ jobs:
3535

3636
steps:
3737
- name: Install system dependencies
38-
if: matrix.os == 'ubuntu-18.04'
38+
if: runner.os == 'Linux'
3939
run: |
4040
apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold
4141
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
4242
- uses: actions/checkout@v2
4343

4444
- name: Disable tests and bechmarks
4545
run: |
46-
echo -e 'tests: false' >> cabal.project.local
47-
echo -e 'benchmarks: false' >> cabal.project.local
46+
echo "tests: false" >> cabal.project.local
47+
echo "benchmarks: false" >> cabal.project.local
4848
4949
- uses: ./.github/actions/setup-build
5050
with:
5151
ghc: ${{ matrix.ghc }}
5252
os: ${{ runner.os }}
5353

5454
- name: (Windows) Platform specifics
55-
if: matrix.os == 'windows-latest'
56-
env:
57-
GHC_VER: ${{ matrix.ghc }}
55+
if: runner.os == 'Windows'
5856
run: |
5957
echo "EXE_EXT=.exe" >> $GITHUB_ENV
60-
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
6158
6259
- name: (Linux) Platform specifics
63-
if: matrix.os == 'ubuntu-18.04'
64-
env:
65-
GHC_VER: ${{ matrix.ghc }}
66-
run: |
67-
echo "LINUX_CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections" >> $GITHUB_ENV
68-
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
69-
70-
- name: (macOS) Platform specifics
71-
if: matrix.os == 'macOS-latest'
72-
env:
73-
GHC_VER: ${{ matrix.ghc }}
60+
if: runner.os == 'Linux'
7461
run: |
75-
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
62+
echo "CABAL_ARGS=--enable-executable-static --ghc-options=-split-sections" >> $GITHUB_ENV
7663
7764
- name: Build the server
7865
# Try building it twice in case of flakey builds on Windows
7966
run: |
80-
cabal build exe:hls -O2 $LINUX_CABAL_ARGS || cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1
67+
cabal build exe:hls -O2 $CABAL_ARGS || cabal build exe:hls -O2 $CABAL_ARGS -j1
8168
8269
- name: Compress server binary
8370
id: compress_server_binary
8471
run: |
8572
HLS_BUILD=$(find dist-newstyle \( -name 'hls' -o -name 'hls.exe' \) -type f)
86-
HLS=haskell-language-server-${{env.GHC_VERSION}}
87-
mv $HLS_BUILD $HLS${{env.EXE_EXT}}
88-
if [[ "$OSTYPE" == "msys" ]]; then
89-
7z a $HLS.zip $HLS${{env.EXE_EXT}}
73+
HLS=haskell-language-server-${{ matrix.ghc }}
74+
mv $HLS_BUILD $HLS${{ env.EXE_EXT }}
75+
if [[ "${{ runner.os }}" == "Windows" ]]; then
76+
7z a $HLS.zip $HLS${{ env.EXE_EXT }}
9077
echo ::set-output name=path::$HLS.zip
9178
echo ::set-output name=content_type::application/zip
9279
echo ::set-output name=extension::zip
@@ -97,36 +84,36 @@ jobs:
9784
echo ::set-output name=extension::gz
9885
fi
9986
100-
- name: (not check) Upload server to release
101-
if: ${{ !contains(github.ref_name, 'check') }}
87+
- name: Upload server to release
88+
if: ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != ''}}
10289
uses: actions/[email protected]
10390
env:
10491
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10592
with:
10693
upload_url: ${{ github.event.release.upload_url }}
10794
asset_path: ${{ steps.compress_server_binary.outputs.path }}
108-
asset_name: haskell-language-server-${{ runner.OS }}-${{ env.GHC_VERSION }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
95+
asset_name: haskell-language-server-${{ runner.os }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
10996
asset_content_type: ${{ steps.compress_server_binary.outputs.content_type }}
11097

11198
- name: Upload server to workflow artifacts
11299
uses: actions/upload-artifact@v2
113100
with:
114-
name: haskell-language-server-${{ runner.OS }}-${{ matrix.ghc }}${{env.EXE_EXT}}.${{ steps.compress_server_binary.outputs.extension }}
101+
name: haskell-language-server-${{ runner.os }}-${{ matrix.ghc }}${{ env.EXE_EXT }}.${{ steps.compress_server_binary.outputs.extension }}
115102
path: ${{ steps.compress_server_binary.outputs.path }}
116103

117-
- name: (GHC 8.10) Build the wrapper
104+
- name: Build the wrapper
118105
if: matrix.ghc == '8.10.7'
119106
run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
120107

121-
- name: (GHC 8.10) Compress wrapper binary
108+
- name: Compress wrapper binary
122109
if: matrix.ghc == '8.10.7'
123110
id: compress_wrapper_binary
124111
run: |
125112
HLS_WRAPPER_BUILD=$(find dist-newstyle \( -name 'hls-wrapper' -o -name 'hls-wrapper.exe' \) -type f)
126113
HLS_WRAPPER=haskell-language-server-wrapper
127-
mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{env.EXE_EXT}}
128-
if [[ "$OSTYPE" == "msys" ]]; then
129-
7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{env.EXE_EXT}}
114+
mv $HLS_WRAPPER_BUILD $HLS_WRAPPER${{ env.EXE_EXT }}
115+
if [[ "${{ runner.os }}" == "Windows" ]]; then
116+
7z a $HLS_WRAPPER.zip $HLS_WRAPPER${{ env.EXE_EXT }}
130117
echo ::set-output name=path::$HLS_WRAPPER.zip
131118
echo ::set-output name=content_type::application/zip
132119
echo ::set-output name=extension::zip
@@ -137,22 +124,22 @@ jobs:
137124
echo ::set-output name=extension::gz
138125
fi
139126
140-
- name: (GHC 8.10, not check) Upload wrapper to the release
141-
if: ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') }}
127+
- name: Upload wrapper to the release
128+
if: ${{ matrix.ghc == '8.10.7' && !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
142129
uses: actions/[email protected]
143130
env:
144131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145132
with:
146133
upload_url: ${{ github.event.release.upload_url }}
147134
asset_path: ${{ steps.compress_wrapper_binary.outputs.path }}
148-
asset_name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
135+
asset_name: haskell-language-server-wrapper-${{ runner.os }}${{ env.EXE_EXT }}.${{ steps.compress_wrapper_binary.outputs.extension }}
149136
asset_content_type: ${{ steps.compress_wrapper_binary.outputs.content_type}}
150137

151-
- name: (GHC 8.10) Upload wrapper to workflow artifacts
138+
- name: Upload wrapper to workflow artifacts
152139
uses: actions/upload-artifact@v2
153140
if: matrix.ghc == '8.10.7'
154141
with:
155-
name: haskell-language-server-wrapper-${{ runner.OS }}${{env.EXE_EXT}}.${{ steps.compress_wrapper_binary.outputs.extension }}
142+
name: haskell-language-server-wrapper-${{ runner.os }}${{ env.EXE_EXT }}.${{ steps.compress_wrapper_binary.outputs.extension }}
156143
path: ${{ steps.compress_wrapper_binary.outputs.path }}
157144

158145
# generates a custom tarball with sources, used by `ghcup compile hls`
@@ -163,29 +150,38 @@ jobs:
163150
steps:
164151
- uses: actions/checkout@v2
165152

153+
- name: Set hls release version
154+
run: |
155+
HLS_VER="${{ github.event.release.tag_name }}"
156+
if [[ -z $HLS_VER ]]; then
157+
HLS_VER=${{ github.sha }}
158+
HLS_VER=${HLS_VER:0:5}
159+
fi
160+
echo "HLS_VER=$HLS_VER" >> $GITHUB_ENV
161+
166162
- name: Create source tarball
167163
run: |
168164
mkdir src-dist
169-
git archive --prefix=haskell-language-server-${{ github.event.release.tag_name }}/ \
165+
git archive --prefix=haskell-language-server-${{ env.HLS_VER }}/ \
170166
--format=tar.gz \
171167
-o src-dist/haskell-language-server.tar.gz \
172168
HEAD
173169
174-
- name: (not check) Upload source tarball to the release
175-
if: ${{ !contains(github.ref_name, 'check') }}
170+
- name: Upload source tarball to the release
171+
if: ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
176172
uses: actions/[email protected]
177173
env:
178174
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179175
with:
180176
upload_url: ${{ github.event.release.upload_url }}
181177
asset_path: src-dist/haskell-language-server.tar.gz
182-
asset_name: haskell-language-server-${{ github.event.release.tag_name }}-src.tar.gz
178+
asset_name: haskell-language-server-${{ env.HLS_VER }}-src.tar.gz
183179
asset_content_type: application/gzip
184180

185181
- name: Upload source tarball to workflow artifacts
186182
uses: actions/upload-artifact@v2
187183
with:
188-
name: haskell-language-server-${{ github.event.release.tag_name }}-src.tar.gz
184+
name: haskell-language-server-${{ env.HLS_VER }}-src.tar.gz
189185
path: src-dist/haskell-language-server.tar.gz
190186

191187
# this generates .gz tarfiles containing binaries for all GHC versions and OS's
@@ -195,44 +191,53 @@ jobs:
195191
runs-on: ubuntu-18.04
196192
strategy:
197193
matrix:
198-
os: [ "Linux"
199-
, "macOS"
200-
, "Windows"
201-
]
194+
target-os: [ "Linux"
195+
, "macOS"
196+
, "Windows"
197+
]
202198
steps:
203199
- uses: actions/download-artifact@v2
204200

205201
- name: Generate tarball with all binaries
206202
run: |
207203
# move the binaries for the specific platform into bin/
208204
mkdir bin
209-
mv haskell-language-server-${{ matrix.os }}-*/* bin
210-
mv haskell-language-server-wrapper-${{ matrix.os }}.*/* bin
205+
mv haskell-language-server-${{ matrix.target-os }}-*/* bin
206+
mv haskell-language-server-wrapper-${{ matrix.target-os }}.*/* bin
211207
# decompress them
212208
cd bin
213-
if [[ "${{ matrix.os }}" == "Windows" ]]; then
209+
if [[ "${{ matrix.target-os }}" == "Windows" ]]; then
214210
7z x "*.zip"
215211
rm *.zip
216212
else
217213
gzip -d *.gz
218214
fi
219215
tar -czpf haskell-language-server.tar.gz *
220216
221-
- name: (not check) Upload binaries tarball to the release
222-
if: ${{ !contains(github.ref_name, 'check') }}
217+
- name: Upload binaries tarball to the release
218+
if: ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
223219
uses: actions/[email protected]
224220
env:
225221
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
226222
with:
227223
upload_url: ${{ github.event.release.upload_url }}
228224
asset_path: bin/haskell-language-server.tar.gz
229-
asset_name: haskell-language-server-${{ matrix.os }}-${{ github.event.release.tag_name }}.tar.gz
225+
asset_name: haskell-language-server-${{ matrix.target-os }}-${{ github.event.release.tag_name }}.tar.gz
230226
asset_content_type: application/gzip
231227

228+
- name: Set hls release version
229+
run: |
230+
HLS_VER="${{ github.event.release.tag_name }}"
231+
if [[ -z $HLS_VER ]]; then
232+
HLS_VER=${{ github.sha }}
233+
HLS_VER=${HLS_VER:0:5}
234+
fi
235+
echo "HLS_VER=$HLS_VER" >> $GITHUB_ENV
236+
232237
- name: Upload binaries tarball to workflow artifacts
233238
uses: actions/upload-artifact@v2
234239
with:
235-
name: haskell-language-server-${{ matrix.os }}-${{ github.event.release.tag_name }}.tar.gz
240+
name: haskell-language-server-${{ matrix.target-os }}-${{ env.HLS_VER }}.tar.gz
236241
path: bin/haskell-language-server.tar.gz
237242

238243
sha256sum:
@@ -247,8 +252,8 @@ jobs:
247252
# we clean up tags to match the release file names
248253
sed -i 's/\/.*)/)/g' SHA256SUMS
249254
250-
- name: (not check) Upload sha256sums to the release
251-
if: ${{ !contains(github.ref_name, 'check') }}
255+
- name: Upload sha256sums to the release
256+
if: ${{ !contains(github.ref_name, 'check') && github.event.release.upload_url != '' }}
252257
uses: actions/[email protected]
253258
env:
254259
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

haskell-language-server.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ library
7171
, data-default
7272
, ghc
7373
, ghcide ^>=1.4 || ^>=1.5
74-
, gitrev
74+
, githash
7575
, lsp
7676
, hie-bios
7777
, hiedb

src/Ide/Arguments.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Ide.Arguments
1717
) where
1818

1919
import Data.Version
20-
import Development.GitRev
20+
import GitHash (tGitInfoCwdTry, giHash)
2121
import Development.IDE (IdeState)
2222
import Development.IDE.Main (Command (..), commandP)
2323
import Ide.Types (IdePlugins)
@@ -141,11 +141,11 @@ haskellLanguageServerNumericVersion = showVersion version
141141
haskellLanguageServerVersion :: IO String
142142
haskellLanguageServerVersion = do
143143
path <- getExecutablePath
144-
let gitHashSection = case $(gitHash) of
145-
x | x == "UNKNOWN" -> ""
146-
x -> " (GIT hash: " <> x <> ")"
144+
let gi = $$tGitInfoCwdTry
145+
gitHashSection = case gi of
146+
Right gi -> " (GIT hash: " <> giHash gi <> ")"
147+
Left _ -> ""
147148
return $ "haskell-language-server version: " <> haskellLanguageServerNumericVersion
148149
<> " (GHC: " <> VERSION_ghc
149150
<> ") (PATH: " <> path <> ")"
150151
<> gitHashSection
151-

src/Ide/Version.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Ide.Version where
99

1010
import Data.Maybe (listToMaybe)
1111
import Data.Version
12-
import Development.GitRev (gitCommitCount)
12+
import GitHash (tGitInfoCwdTry, giCommitCount)
1313
import Options.Applicative.Simple (simpleVersion)
1414
import qualified Paths_haskell_language_server as Meta
1515
import System.Directory
@@ -21,7 +21,10 @@ import Text.ParserCombinators.ReadP
2121
-- >>> hlsVersion
2222
hlsVersion :: String
2323
hlsVersion =
24-
let commitCount = $gitCommitCount
24+
let gi = $$tGitInfoCwdTry
25+
commitCount = case gi of
26+
Right gi -> show $ giCommitCount gi
27+
Left _ -> "UNKNOWN"
2528
in concat $ concat
2629
[ [$(simpleVersion Meta.version)]
2730
-- Leave out number of commits for --depth=1 clone

0 commit comments

Comments
 (0)