Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
58 changes: 57 additions & 1 deletion .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
branches:
- master
pull_request:
workflow_dispatch:
release:
types:
- created
Expand Down Expand Up @@ -78,6 +79,61 @@ jobs:
name: cabal-${{ matrix.os }}-${{ matrix.ghc }}-bootstrapped
path: _build/artifacts/*

bootstrap-mhs:
name: Bootstrap ubuntu-latest mhs-0.16.12.0
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v7

- name: Get runner OS/version for cache keys
id: get-osver
run: echo "osver=$ImageOS" >> "$GITHUB_OUTPUT"

- uses: actions/cache/restore@v6
name: Restore MicroHs toolchain and packages
id: cache-mhs-toolchain
with:
path: ~/.mcabal
key: mhs-toolchain-${{ steps.get-osver.outputs.osver }}-0.16.12.0-${{ hashFiles('bootstrap/mhs/microhs-full.patch', 'mhs-compat-shims/**') }}
restore-keys: |
mhs-toolchain-${{ steps.get-osver.outputs.osver }}-0.16.12.0-

- uses: actions/cache/restore@v6
name: Restore MicroHs stage checkpoints
id: cache-mhs-checkpoints
with:
path: _build/mhs-cache
key: mhs-cache-${{ steps.get-osver.outputs.osver }}-0.16.12.0-${{ hashFiles('bootstrap/mhs/**', 'mhs-compat-shims/**', 'Cabal-syntax/src/**', 'Cabal/src/**', 'hooks-exe/**', 'cabal-install-solver/src/**', 'cabal-install/src/**', 'cabal-install/main/**') }}

- name: Build MicroHs 0.16.12.0 toolchain and packages
run: bash bootstrap/mhs/build-cabal-mhs.sh toolchain

- uses: actions/cache/save@v6
name: Save MicroHs toolchain and packages
if: always() && steps.cache-mhs-toolchain.outputs.cache-hit != 'true'
with:
path: ~/.mcabal
key: ${{ steps.cache-mhs-toolchain.outputs.cache-primary-key }}

- name: Bootstrap cabal-install with MicroHs
run: bash bootstrap/mhs/build-cabal-mhs.sh build

- uses: actions/cache/save@v6
name: Save MicroHs stage checkpoints
if: always() && steps.cache-mhs-checkpoints.outputs.cache-hit != 'true'
with:
path: _build/mhs-cache
key: ${{ steps.cache-mhs-checkpoints.outputs.cache-primary-key }}

- name: Smoke test MicroHs-built cabal
run: bash bootstrap/mhs/build-cabal-mhs.sh test

- uses: actions/upload-artifact@v7
with:
name: cabal-ubuntu-latest-mhs-0.16.12.0-bootstrapped
path: _build/artifacts/*

# 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 All @@ -87,7 +143,7 @@ jobs:
name: Bootstrap post job
runs-on: ubuntu-latest
# IMPORTANT! Any job added to the workflow should be added here too
needs: [bootstrap]
needs: [bootstrap, bootstrap-mhs]

steps:
- run: |
Expand Down
19 changes: 19 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@
- ignore: {name: "Replace case with maybe", within: [Distribution.Client.InLibrary]}
- ignore: {name: "Use fmap", within: [Distribution.Client.HttpUtils, Distribution.Simple.SrcDist]}
- ignore: {name: "Use fold", within: [Test.Laws]}
- ignore: {name: "Use uncurry", within: [Distribution.Compat.Internal.MhsProcess]}
- ignore: {name: "Use catMaybes", within: [Distribution.Compat.Internal.MhsProcess]}
- ignore: {name: "Use <$>", within: [Distribution.Client.ProjectPlanning]}
- ignore:
name: "Unused LANGUAGE pragma"
within:
- Distribution.Compat.NonEmptySet
- Distribution.Types.CondTree
- Distribution.Types.Condition
- Distribution.Utils.Path
- Distribution.Client.Types.SourceRepo
- ignore:
name: "Use fewer imports"
within:
- Distribution.Client.FetchUtils
- Distribution.Client.ProjectPlanning
- Distribution.Client.SetupWrapper
- Distribution.Client.Utils

# For lists in these rules we use single letter variables like x rather than xs,
# because "hlint considers only single-letter identifiers as rules' variables.
Expand All @@ -55,6 +73,7 @@
- Distribution.Simple.Utils from Cabal.

- arguments:
- --ignore-glob=mhs-compat-shims/**
- --ignore-glob=Cabal-syntax/src/Distribution/Fields/Lexer.hs
- --ignore-glob=Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs
- --ignore-glob=Cabal-tests/tests/custom-setup/IdrisSetup.hs
Expand Down
2 changes: 1 addition & 1 deletion Cabal-hooks/src/Distribution/Simple/SetupHooks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ import Distribution.Types.LocalBuildConfig
import Distribution.Types.TargetInfo
( TargetInfo(..) )
import Distribution.Utils.Path
( SymbolicPath, CWD, Pkg, FileOrDir(..)
( SymbolicPath, CWD, Pkg, Dir
, interpretSymbolicPath, makeRelativePathEx
, RelativePath, Source, Build
, getSymbolicPath, sameDirectory, moduleNameSymbolicPath
Expand Down
20 changes: 17 additions & 3 deletions Cabal-syntax/Cabal-syntax.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,42 @@ source-repository head
location: https://github.com/haskell/cabal/
subdir: Cabal-syntax

flag mhs
description: MicroHs build (uses -mhs package variants for array/binary/pretty)
default: False
manual: True

library
default-language: GHC2021
-- Disabling ImportQualifiedPost, otherwise fourmolu jumps ahead to apply it everywhere
default-extensions: NoImportQualifiedPost
hs-source-dirs: src

build-depends:
, array >= 0.4.0.1 && < 0.6
, base >= 4.18 && < 5
, binary >= 0.8.1 && < 0.9
, bytestring >= 0.10.4.0 && < 0.13
, containers >= 0.5.2 && < 0.9
, deepseq >= 1.4 && < 1.7
, directory >= 1.3.8.5 && < 1.4
, filepath >= 1.4.301 && < 1.6
, mtl >= 2.1 && < 2.4
, parsec >= 3.1.13.0 && < 3.2
, pretty >= 1.1.1 && < 1.2
, text >= 2.0.2 && < 2.2
, time >= 1.4.0.1 && < 1.17
-- transformers-0.4.0.0 doesn't have record syntax e.g. for Identity
-- See also https://github.com/ekmett/transformers-compat/issues/35
, transformers (>= 0.3 && < 0.4) || (>=0.4.1.0 && <0.7)

if flag(mhs)
build-depends:
array-mhs >= 0.5.8 && < 0.6,
mhs-compat-shims ^>= 0.1
else
build-depends:
array >= 0.4.0.1 && < 0.6,
binary >= 0.8.1 && < 0.9,
pretty >= 1.1.1 && < 1.2

ghc-options:
-Wall
-fno-ignore-asserts
Expand All @@ -70,8 +82,10 @@ library
Distribution.Compat.Binary
Distribution.Compat.CharParsing
Distribution.Compat.DList
Distribution.Compat.Directory
Distribution.Compat.Exception
Distribution.Compat.Graph
Distribution.Compat.Internal.LazyByteString
Distribution.Compat.Lens
Distribution.Compat.NonEmptySet
Distribution.Compat.Parsing
Expand Down
Loading
Loading