Skip to content

Commit

Permalink
Rename projects to have .project extension (backport #9958) (#10040)
Browse files Browse the repository at this point in the history
* Rename projects to cabal.*.project

- Rename cabal.bootstrap.project
- Rename cabal.meta.project
- Rename cabal.validate-libonly.project
- Rename cabal.validate.project
- Rename cabal.release.project

(cherry picked from commit d8147f6)

# Conflicts:
#	.github/workflows/quick-jobs.yml
#	Makefile
#	cabal.bootstrap.project

* Fix conflict with #9990

---------

Co-authored-by: Phil de Joux <philderbeast@gmail.com>
Co-authored-by: brandon s allbery kf8nh <allbery.b@gmail.com>
Co-authored-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>
  • Loading branch information
4 people committed May 23, 2024
1 parent f2999b3 commit b935691
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/quick-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
env:
cabal_build: >-
cabal build --builddir=dist-newstyle-meta --project-file=cabal.project.meta
cabal build --builddir=dist-newstyle-meta --project-file=cabal.meta.project
gen-cabal-macros
gen-paths-module
gen-spdx
Expand Down Expand Up @@ -179,6 +179,6 @@ jobs:
run: cabal v2-update
- uses: actions/checkout@v4
- name: Check Release with Pinned Hackage
run: cabal build all --dry-run --project-file=cabal.project.release
run: cabal build all --dry-run --project-file=cabal.release.project
- name: Check Release with Latest Hackage
run: cabal build all --dry-run --project-file=cabal.project.release --index-state="hackage.haskell.org HEAD"
run: cabal build all --dry-run --project-file=cabal.release.project --index-state="hackage.haskell.org HEAD"
14 changes: 7 additions & 7 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ jobs:
- name: Manually supplied constraints/allow-newer
if: github.event_name == 'workflow_dispatch'
run: |
echo "allow-newer: ${ALLOWNEWER}" >> cabal.project.validate
echo "constraints: ${CONSTRAINTS}" >> cabal.project.validate
echo "allow-newer: ${ALLOWNEWER}" >> cabal.validate.project
echo "constraints: ${CONSTRAINTS}" >> cabal.validate.project
- uses: haskell-actions/setup@v2
id: setup-haskell
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
- name: Tar cabal head executable
if: matrix.ghc == env.GHC_FOR_RELEASE
run: |
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} --project-file=cabal.project.validate cabal-install:exe:cabal)
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} --project-file=cabal.validate.project cabal-install:exe:cabal)
# We have to tar the executable to preserve executable permissions
# see https://github.com/actions/upload-artifact/issues/38
if [[ "${{ runner.os }}" == "Windows" ]]; then
Expand Down Expand Up @@ -288,8 +288,8 @@ jobs:
- name: Manually supplied constraints/allow-newer
if: github.event_name == 'workflow_dispatch'
run: |
echo "allow-newer: ${ALLOWNEWER}" >> cabal.project.validate
echo "constraints: ${CONSTRAINTS}" >> cabal.project.validate
echo "allow-newer: ${ALLOWNEWER}" >> cabal.validate.project
echo "constraints: ${CONSTRAINTS}" >> cabal.validate.project
- uses: haskell-actions/setup@v2
id: setup-haskell
Expand All @@ -310,14 +310,14 @@ jobs:

- name: Enable statically linked executables
run: |
echo 'executable-static: true' >> cabal.project.validate
echo 'executable-static: true' >> cabal.validate.project
- name: Build
run: sh validate.sh $FLAGS -s build

- name: Tar cabal head executable
run: |
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ env.GHC_FOR_RELEASE }} --project-file=cabal.project.validate cabal-install:exe:cabal)
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ env.GHC_FOR_RELEASE }} --project-file=cabal.validate.project cabal-install:exe:cabal)
# We have to tar the executable to preserve executable permissions
# see https://github.com/actions/upload-artifact/issues/38
DIR=$(dirname "$CABAL_EXEC")
Expand Down
8 changes: 4 additions & 4 deletions .gitlab/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@ mkdir -p "$CABAL_DIR"
#
# $PLATFORM comes from CI.
if [ "$(getconf LONG_BIT)" = "32" -o "${PLATFORM:=xxx}" = "x86_64-linux-centos7" ] ; then
echo 'constraints: lukko -ofd-locking' >> cabal.project.release.local
echo 'constraints: lukko -ofd-locking' >> cabal.release.project.local
fi

# In February 2024, cabal started using zlib-0.7.0.0, which uses pkg-config by
# default. The GitLab CI environment doesn't (yet) supply pkg-config, and zlib
# does just fine without it on modern GHCs. That said, the CI environment
# probably *should* have pkg-config installed. See
# https://github.com/haskell/cabal/issues/9774.
echo 'constraints: zlib -pkg-config' >> cabal.project.release.local
echo 'constraints: zlib -pkg-config' >> cabal.release.project.local
# Furthermore, on Windows, zlib claims that libz is shipped with GHC, so it just
# uses @extra-libraries: z@ if pkg-config is False. If you are reading this
# comment, however, this didn't work. Thus we switch to using the bundled libz,
# as was done in zlib <0.7.0.0.
case "$(uname)" in
MSYS_*|MINGW*)
echo 'constraints: zlib +bundled-c-zlib' >> cabal.project.release.local
echo 'constraints: zlib +bundled-c-zlib' >> cabal.release.project.local
;;
esac

args=(
--disable-profiling
--enable-executable-stripping
--project-file=cabal.project.release
--project-file=cabal.release.project
${ADD_CABAL_ARGS}
)

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you have trouble building the testsuite for this initial build, try building
with the release project that excludes this testsuite:

```
$ cabal build cabal --project-file=cabal.release.project
cabal build --project-file=cabal.release.project cabal
```

> [!NOTE]
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ spdx : $(SPDX_LICENSE_HS) $(SPDX_EXCEPTION_HS)
SPDX_LICENSE_VERSIONS:=3.0 3.2 3.6 3.9 3.10 3.16 3.23

$(SPDX_LICENSE_HS) : templates/SPDX.LicenseId.template.hs cabal-dev-scripts/src/GenUtils.hs cabal-dev-scripts/src/GenSPDX.hs license-list-data/licenses-3.0.json license-list-data/licenses-3.2.json
cabal run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-spdx -- templates/SPDX.LicenseId.template.hs $(SPDX_LICENSE_VERSIONS:%=license-list-data/licenses-%.json) $(SPDX_LICENSE_HS)
cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project gen-spdx -- templates/SPDX.LicenseId.template.hs $(SPDX_LICENSE_VERSIONS:%=license-list-data/licenses-%.json) $(SPDX_LICENSE_HS)

$(SPDX_EXCEPTION_HS) : templates/SPDX.LicenseExceptionId.template.hs cabal-dev-scripts/src/GenUtils.hs cabal-dev-scripts/src/GenSPDXExc.hs license-list-data/exceptions-3.0.json license-list-data/exceptions-3.2.json
cabal run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-spdx-exc -- templates/SPDX.LicenseExceptionId.template.hs $(SPDX_LICENSE_VERSIONS:%=license-list-data/exceptions-%.json) $(SPDX_EXCEPTION_HS)
cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project gen-spdx-exc -- templates/SPDX.LicenseExceptionId.template.hs $(SPDX_LICENSE_VERSIONS:%=license-list-data/exceptions-%.json) $(SPDX_EXCEPTION_HS)

# source generation: templates

Expand All @@ -75,10 +75,10 @@ TEMPLATE_PATHS:=Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs
templates : $(TEMPLATE_MACROS) $(TEMPLATE_PATHS)

$(TEMPLATE_MACROS) : templates/cabal_macros.template.h cabal-dev-scripts/src/GenCabalMacros.hs
cabal run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-cabal-macros -- $< $@
cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project gen-cabal-macros -- $< $@

$(TEMPLATE_PATHS) : templates/Paths_pkg.template.hs cabal-dev-scripts/src/GenPathsModule.hs
cabal run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-paths-module -- $< $@
cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project gen-paths-module -- $< $@

# generated docs
# Use cabal build before cabal run to avoid output of the build on stdout when running
Expand All @@ -93,7 +93,7 @@ doc/buildinfo-fields-reference.rst : \

.PHONY: analyse-imports
analyse-imports :
find Cabal-syntax/src Cabal/src cabal-install/src -type f -name '*.hs' | xargs cabal run --builddir=dist-newstyle-meta --project-file=cabal.project.meta analyse-imports --
find Cabal-syntax/src Cabal/src cabal-install/src -type f -name '*.hs' | xargs cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project analyse-imports --

# ghcid

Expand Down Expand Up @@ -190,7 +190,7 @@ validate-dockerfiles : .docker/validate-8.4.4.dockerfile
validate-dockerfiles : .docker/validate-8.2.2.dockerfile

.docker/validate-%.dockerfile : .docker/validate.dockerfile.zinza cabal-dev-scripts/src/GenValidateDockerfile.hs
cabal run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-validate-dockerfile -- $* $< $@
cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project gen-validate-dockerfile -- $* $< $@

# This is good idea anyway
# and we have a test relying on this limit being sufficiently small
Expand Down Expand Up @@ -229,7 +229,7 @@ tags :
##############################################################################

bootstrap-json-%: phony
cabal build --project-file=cabal.project.release --with-compiler=ghc-$* --dry-run cabal-install:exe:cabal
cabal build --project-file=cabal.bootstrap.project --with-compiler=ghc-$* --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-$*.plan.json
@# -v0 to avoid build output on stdout
cd bootstrap && cabal run -v0 cabal-bootstrap-gen -- linux-$*.plan.json \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Ways to build `cabal-install` for everyday use
Git repository, move to its root, and run:

```
cabal install --project-file=cabal.project.release cabal-install
cabal install --project-file=cabal.release.project cabal-install
```

3. _Bootstrapping_:
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/generate_bootstrap_plans
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run() {
local drv="ghc-$ver"
echo "$ver"
nix build -f "$ghcs_nix" $drv
(cd ../; rm -r dist-bootstrap; cabal --distdir=dist-bootstrap build --project-file=cabal.project.release --dry-run cabal-install:exe:cabal -w bootstrap/result/bin/ghc)
(cd ../; rm -r dist-bootstrap; cabal --distdir=dist-bootstrap build --project-file=cabal.bootstrap.project --dry-run cabal-install:exe:cabal -w bootstrap/result/bin/ghc)
jq --sort-keys < ../dist-bootstrap/cache/plan.json > "plan-$ver.json"
cabal run --with-ghc-pkg $PWD/boot_ghc/bin/ghc-pkg -w $PWD/boot_ghc/bin/ghc -v0 cabal-bootstrap-gen -- "plan-$ver.json" | jq --sort-keys | tee "linux-$(echo $ver | tr "_" ".").json"
}
Expand Down
2 changes: 1 addition & 1 deletion cabal-testsuite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ cabal install doctest --overwrite-policy=always --ignore-project
After that you can run doctests for a component of your choice via the following command:

``` shellsession
cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options="-w" --project-file="cabal.project.validate" Cabal-syntax
cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options="-w" --project-file="cabal.validate.project" Cabal-syntax
```

In this example we have run doctests in `Cabal-syntax`. Notice, that some
Expand Down
12 changes: 12 additions & 0 deletions cabal.bootstrap.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
packages:
Cabal
, Cabal-syntax
, Cabal-hooks
, cabal-install
, cabal-install-solver

-- Don't include tests or benchmarks for bootstrapping
tests: False
benchmarks: False

index-state: hackage.haskell.org 2024-04-22T06:16:57Z
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions project-cabal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
We have these projects, all in the root:

```
$ tree -P 'cabal.project*' --prune -L 1
$ tree -P '*.project' --prune -L 1
.
├── cabal.bootstrap.project
├── cabal.meta.project
├── cabal.project
├── cabal.project.libonly
├── cabal.project.meta
├── cabal.project.release
├── cabal.project.validate
└── cabal.project.validate.libonly
├── cabal.release.project
├── cabal.validate-libonly.project
└── cabal.validate.project
```

Projects are expected to pass a `build --dry-run` standalone test,
Expand Down Expand Up @@ -85,7 +85,7 @@ package group.
The `meta` project is a one-liner:

```
$ cat cabal.project.meta
$ cat cabal.meta.project
packages: cabal-dev-scripts
```

Expand Down
2 changes: 1 addition & 1 deletion project-cabal/ghc-latest.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- The file is supposed to be included in the main project files used for
-- Cabal development:
-- - cabal.project (day-to-day development),
-- - cabal.project.validate (Cabal CI),
-- - cabal.validate.project (Cabal CI),
-- Commented out below are the usual suspects. Feel free to add more.

-- NOTE: don't forget to update the compiler version in the conditional
Expand Down
4 changes: 2 additions & 2 deletions validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ case "$(uname)" in
esac

if $LIBONLY; then
PROJECTFILE=cabal.project.validate.libonly
PROJECTFILE=cabal.validate-libonly.project
else
PROJECTFILE=cabal.project.validate
PROJECTFILE=cabal.validate.project
fi

BASEHC=ghc-$($HC --numeric-version)
Expand Down

0 comments on commit b935691

Please sign in to comment.