Skip to content

Commit de0ad02

Browse files
authored
Merge branch 'master' into warn-on-ignored-builddir
2 parents 6373b25 + 5fd439f commit de0ad02

File tree

12 files changed

+832
-32
lines changed

12 files changed

+832
-32
lines changed

.github/workflows/validate.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ jobs:
136136
# see https://github.com/actions/virtual-environments/issues/2619#issuecomment-788397841
137137
sudo /usr/sbin/purge
138138
fi
139-
tar -cvf cabal-head.tar -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
140-
echo "CABAL_EXEC_TAR=cabal-head.tar" >> $GITHUB_ENV
139+
export CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar.gz"
140+
tar -czvf $CABAL_EXEC_TAR -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
141+
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> $GITHUB_ENV
141142
142143
# We upload the cabal executable built with the ghc used in the release for:
143144
# - Reuse it in the dogfooding job (although we could use the cached build dir)
@@ -146,7 +147,7 @@ jobs:
146147
if: matrix.ghc == env.GHC_FOR_RELEASE
147148
uses: actions/upload-artifact@v3
148149
with:
149-
name: cabal-${{ runner.os }}-${{ matrix.ghc }}
150+
name: cabal-${{ runner.os }}-x86_64
150151
path: ${{ env.CABAL_EXEC_TAR }}
151152

152153
- name: Validate lib-tests
@@ -271,11 +272,11 @@ jobs:
271272
- name: Download cabal executable from workflow artifacts
272273
uses: actions/download-artifact@v3
273274
with:
274-
name: cabal-${{ runner.os }}-${{ matrix.ghc }}
275+
name: cabal-${{ runner.os }}-x86_64
275276
path: cabal-head
276277

277278
- name: Untar the cabal executable
278-
run: tar -xf ./cabal-head/cabal-head.tar -C ./cabal-head
279+
run: tar -xzf ./cabal-head/cabal-head-${{ runner.os }}-x86_64.tar.gz -C cabal-head
279280

280281
- name: print-config using cabal HEAD
281282
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s print-config
@@ -285,6 +286,39 @@ jobs:
285286
- name: Build using cabal HEAD
286287
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s build
287288

289+
prerelease-head:
290+
name: Create a GitHub prerelease with the binary artifacts
291+
runs-on: ubuntu-latest
292+
if: github.ref == 'refs/heads/master'
293+
294+
# IMPORTANT! Any job added to the workflow should be added here too
295+
needs: [validate, validate-old-ghcs, dogfooding]
296+
297+
steps:
298+
- uses: actions/download-artifact@v2
299+
with:
300+
name: cabal-Windows-x86_64
301+
302+
- uses: actions/download-artifact@v2
303+
with:
304+
name: cabal-Linux-x86_64
305+
306+
- uses: actions/download-artifact@v2
307+
with:
308+
name: cabal-macOS-x86_64
309+
310+
- name: Create GitHub prerelease
311+
uses: "marvinpinto/[email protected]"
312+
with:
313+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
314+
automatic_release_tag: "cabal-head"
315+
prerelease: true
316+
title: "cabal-head"
317+
files: |
318+
cabal-head-Windows-x86_64.tar.gz
319+
cabal-head-Linux-x86_64.tar.gz
320+
cabal-head-macOS-x86_64.tar.gz
321+
288322
# We use this job as a summary of the workflow
289323
# It will fail if any of the previous jobs does it
290324
# This way we can use it exclusively in branch protection rules

Cabal/src/Distribution/Simple/BuildTarget.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import Distribution.Utils.Path
5757

5858
import qualified Distribution.Compat.CharParsing as P
5959

60+
import Control.Arrow ( (&&&) )
6061
import Control.Monad ( msum )
6162
import Data.List ( stripPrefix, groupBy )
6263
import qualified Data.List.NonEmpty as NE
@@ -320,7 +321,8 @@ resolveBuildTarget pkg userTarget fexists =
320321
where
321322
classifyMatchErrors errs
322323
| Just expected' <- NE.nonEmpty expected
323-
= let (things, got:|_) = NE.unzip expected' in
324+
= let unzip' = fmap fst &&& fmap snd
325+
(things, got:|_) = unzip' expected' in
324326
BuildTargetExpected userTarget (NE.toList things) got
325327
| not (null nosuch) = BuildTargetNoSuch userTarget nosuch
326328
| otherwise = error $ "resolveBuildTarget: internal error in matching"

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Ways to get the `cabal-install` binary
3030
2. _[Download from official website](https://www.haskell.org/cabal/download.html)_:
3131
the `cabal-install` binary download for your platform should contain the `cabal` executable.
3232
33+
_Getting unreleased versions of `cabal-install`_: gives you a chance to try out yet-unreleased features.
34+
Currently, we only provide binaries for `x86_64` platforms.
35+
36+
1. _[GitHub preview release built from the tip of the `master` branch](https://github.com/haskell/cabal/releases/tag/cabal-head)_:
37+
38+
2. Even more cutting-edge binaries built from pull requests are always available
39+
from the `Validate` worklow page on GitHub, at the very bottom of the page.
40+
3341
Ways to build `cabal-install` for everyday use
3442
--------------------------------------------
3543

cabal-install/src/Distribution/Client/Config.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,8 @@ commentSavedConfig = do
915915
globalInstallDirs <- defaultInstallDirs defaultCompiler False True
916916
let conf0 = mempty {
917917
savedGlobalFlags = defaultGlobalFlags {
918-
globalRemoteRepos = toNubList [defaultRemoteRepo]
918+
globalRemoteRepos = toNubList [defaultRemoteRepo],
919+
globalNix = mempty
919920
},
920921
savedInitFlags = mempty {
921922
IT.interactive = toFlag False,

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,17 @@ rebuildProjectConfig verbosity
326326
}
327327
cliConfig = do
328328

329+
progsearchpath <- liftIO $ getSystemSearchPath
330+
331+
let fileMonitorProjectConfig = newFileMonitor (distProjectCacheFile "config")
332+
329333
fileMonitorProjectConfigKey <- do
330334
configPath <- getConfigFilePath projectConfigConfigFile
331-
return (configPath, distProjectFile "")
335+
return (configPath, distProjectFile "",
336+
(projectConfigHcFlavor, projectConfigHcPath, projectConfigHcPkg),
337+
progsearchpath,
338+
packageConfigProgramPaths,
339+
packageConfigProgramPathExtra)
332340

333341
(projectConfig, localPackages) <-
334342
runRebuild distProjectRootDirectory
@@ -359,18 +367,11 @@ rebuildProjectConfig verbosity
359367

360368
where
361369

362-
ProjectConfigShared { projectConfigConfigFile } =
363-
projectConfigShared cliConfig
364-
365-
ProjectConfigShared { projectConfigIgnoreProject } =
370+
ProjectConfigShared { projectConfigHcFlavor, projectConfigHcPath, projectConfigHcPkg, projectConfigIgnoreProject, projectConfigConfigFile } =
366371
projectConfigShared cliConfig
367372

368-
fileMonitorProjectConfig ::
369-
FileMonitor
370-
(FilePath, FilePath)
371-
(ProjectConfig, [PackageSpecifier UnresolvedSourcePackage])
372-
fileMonitorProjectConfig =
373-
newFileMonitor (distProjectCacheFile "config")
373+
PackageConfig { packageConfigProgramPaths, packageConfigProgramPathExtra } =
374+
projectConfigLocalPackages cliConfig
374375

375376
-- Read the cabal.project (or implicit config) and combine it with
376377
-- arguments from the command line

cabal-install/src/Distribution/Client/Setup.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ globalCommand commands = CommandUI {
369369
optArg' "(True or False)" (maybeToFlag . (readMaybe =<<)) (\case
370370
Flag True -> [Just "enable"]
371371
Flag False -> [Just "disable"]
372-
NoFlag -> [Just "disable"]) "" ["nix"]
372+
NoFlag -> []) "" ["nix"] -- Must be empty because we need to return PP.empty from viewAsFieldDescr
373373
"Nix integration: run commands through nix-shell if a 'shell.nix' file exists (default is False)",
374374
noArg (Flag True) [] ["enable-nix"]
375375
"Enable Nix integration: run commands through nix-shell if a 'shell.nix' file exists",

0 commit comments

Comments
 (0)