Skip to content

Commit

Permalink
Merge branch 'master' into warn-on-ignored-builddir
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini authored May 22, 2023
2 parents 6373b25 + 5fd439f commit de0ad02
Show file tree
Hide file tree
Showing 12 changed files with 832 additions and 32 deletions.
44 changes: 39 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ jobs:
# see https://github.com/actions/virtual-environments/issues/2619#issuecomment-788397841
sudo /usr/sbin/purge
fi
tar -cvf cabal-head.tar -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
echo "CABAL_EXEC_TAR=cabal-head.tar" >> $GITHUB_ENV
export CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar.gz"
tar -czvf $CABAL_EXEC_TAR -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> $GITHUB_ENV
# We upload the cabal executable built with the ghc used in the release for:
# - Reuse it in the dogfooding job (although we could use the cached build dir)
Expand All @@ -146,7 +147,7 @@ jobs:
if: matrix.ghc == env.GHC_FOR_RELEASE
uses: actions/upload-artifact@v3
with:
name: cabal-${{ runner.os }}-${{ matrix.ghc }}
name: cabal-${{ runner.os }}-x86_64
path: ${{ env.CABAL_EXEC_TAR }}

- name: Validate lib-tests
Expand Down Expand Up @@ -271,11 +272,11 @@ jobs:
- name: Download cabal executable from workflow artifacts
uses: actions/download-artifact@v3
with:
name: cabal-${{ runner.os }}-${{ matrix.ghc }}
name: cabal-${{ runner.os }}-x86_64
path: cabal-head

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

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

prerelease-head:
name: Create a GitHub prerelease with the binary artifacts
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'

# IMPORTANT! Any job added to the workflow should be added here too
needs: [validate, validate-old-ghcs, dogfooding]

steps:
- uses: actions/download-artifact@v2
with:
name: cabal-Windows-x86_64

- uses: actions/download-artifact@v2
with:
name: cabal-Linux-x86_64

- uses: actions/download-artifact@v2
with:
name: cabal-macOS-x86_64

- name: Create GitHub prerelease
uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "cabal-head"
prerelease: true
title: "cabal-head"
files: |
cabal-head-Windows-x86_64.tar.gz
cabal-head-Linux-x86_64.tar.gz
cabal-head-macOS-x86_64.tar.gz
# We use this job as a summary of the workflow
# It will fail if any of the previous jobs does it
# This way we can use it exclusively in branch protection rules
Expand Down
4 changes: 3 additions & 1 deletion Cabal/src/Distribution/Simple/BuildTarget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import Distribution.Utils.Path

import qualified Distribution.Compat.CharParsing as P

import Control.Arrow ( (&&&) )
import Control.Monad ( msum )
import Data.List ( stripPrefix, groupBy )
import qualified Data.List.NonEmpty as NE
Expand Down Expand Up @@ -320,7 +321,8 @@ resolveBuildTarget pkg userTarget fexists =
where
classifyMatchErrors errs
| Just expected' <- NE.nonEmpty expected
= let (things, got:|_) = NE.unzip expected' in
= let unzip' = fmap fst &&& fmap snd
(things, got:|_) = unzip' expected' in
BuildTargetExpected userTarget (NE.toList things) got
| not (null nosuch) = BuildTargetNoSuch userTarget nosuch
| otherwise = error $ "resolveBuildTarget: internal error in matching"
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ Ways to get the `cabal-install` binary
2. _[Download from official website](https://www.haskell.org/cabal/download.html)_:
the `cabal-install` binary download for your platform should contain the `cabal` executable.
_Getting unreleased versions of `cabal-install`_: gives you a chance to try out yet-unreleased features.
Currently, we only provide binaries for `x86_64` platforms.
1. _[GitHub preview release built from the tip of the `master` branch](https://github.com/haskell/cabal/releases/tag/cabal-head)_:
2. Even more cutting-edge binaries built from pull requests are always available
from the `Validate` worklow page on GitHub, at the very bottom of the page.
Ways to build `cabal-install` for everyday use
--------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion cabal-install/src/Distribution/Client/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,8 @@ commentSavedConfig = do
globalInstallDirs <- defaultInstallDirs defaultCompiler False True
let conf0 = mempty {
savedGlobalFlags = defaultGlobalFlags {
globalRemoteRepos = toNubList [defaultRemoteRepo]
globalRemoteRepos = toNubList [defaultRemoteRepo],
globalNix = mempty
},
savedInitFlags = mempty {
IT.interactive = toFlag False,
Expand Down
23 changes: 12 additions & 11 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,17 @@ rebuildProjectConfig verbosity
}
cliConfig = do

progsearchpath <- liftIO $ getSystemSearchPath

let fileMonitorProjectConfig = newFileMonitor (distProjectCacheFile "config")

fileMonitorProjectConfigKey <- do
configPath <- getConfigFilePath projectConfigConfigFile
return (configPath, distProjectFile "")
return (configPath, distProjectFile "",
(projectConfigHcFlavor, projectConfigHcPath, projectConfigHcPkg),
progsearchpath,
packageConfigProgramPaths,
packageConfigProgramPathExtra)

(projectConfig, localPackages) <-
runRebuild distProjectRootDirectory
Expand Down Expand Up @@ -359,18 +367,11 @@ rebuildProjectConfig verbosity

where

ProjectConfigShared { projectConfigConfigFile } =
projectConfigShared cliConfig

ProjectConfigShared { projectConfigIgnoreProject } =
ProjectConfigShared { projectConfigHcFlavor, projectConfigHcPath, projectConfigHcPkg, projectConfigIgnoreProject, projectConfigConfigFile } =
projectConfigShared cliConfig

fileMonitorProjectConfig ::
FileMonitor
(FilePath, FilePath)
(ProjectConfig, [PackageSpecifier UnresolvedSourcePackage])
fileMonitorProjectConfig =
newFileMonitor (distProjectCacheFile "config")
PackageConfig { packageConfigProgramPaths, packageConfigProgramPathExtra } =
projectConfigLocalPackages cliConfig

-- Read the cabal.project (or implicit config) and combine it with
-- arguments from the command line
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ globalCommand commands = CommandUI {
optArg' "(True or False)" (maybeToFlag . (readMaybe =<<)) (\case
Flag True -> [Just "enable"]
Flag False -> [Just "disable"]
NoFlag -> [Just "disable"]) "" ["nix"]
NoFlag -> []) "" ["nix"] -- Must be empty because we need to return PP.empty from viewAsFieldDescr
"Nix integration: run commands through nix-shell if a 'shell.nix' file exists (default is False)",
noArg (Flag True) [] ["enable-nix"]
"Enable Nix integration: run commands through nix-shell if a 'shell.nix' file exists",
Expand Down
Loading

0 comments on commit de0ad02

Please sign in to comment.