Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure repo is buildable on Windows #4701

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Ensure repo is buildable on Windows #4701

merged 2 commits into from
Oct 17, 2024

Conversation

jasagredo
Copy link
Contributor

@jasagredo jasagredo commented Oct 17, 2024

Description

Trying to build any package in the repository on Windows will fail with the following message:

➜ cabal build cardano-ledger-binary
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: cardano-ledger-alonzo-1.11.0.0 (user goal)
[__1] trying: plutus-ledger-api-1.34.1.0 (dependency of cardano-ledger-alonzo)
[__2] trying: plutus-core-1.34.1.0 (dependency of plutus-ledger-api)
[__3] trying: plutus-preprocessor-9.9.9.9 (user goal)
[__4] next goal: plutus-tx-plugin (dependency of plutus-preprocessor)
[__4] rejecting: plutus-tx-plugin; 1.34.1.0, 1.34.0.0, 1.33.1.0 (library is not buildable in the current environment, but it is required by plutus-preprocessor)
[__4] rejecting: plutus-tx-plugin-1.32.1.0 (conflict: plutus-core==1.34.1.0, plutus-tx-plugin => plutus-core^>=1.32)
[__4] skipping: plutus-tx-plugin; 1.32.0.0, 1.31.0.0, 1.30.0.0, 1.29.0.0, 1.28.0.0, 1.27.0.0, 1.26.0.0, 1.25.0.0, 1.24.0.0, 1.23.0.0, 1.22.1.0, 1.21.0.0, 1.20.0.0, 1.19.0.0, 1.18.0.0, 1.17.0.0, 1.16.0.0, 1.15.0.1, 1.15.0.0, 1.14.0.0, 1.13.0.0, 1.12.0.0, 1.11.0.0, 1.10.0.0, 1.9.1.0, 1.9.0.0, 1.8.0.0, 1.7.0.0, 1.6.0.0, 1.5.0.2, 1.5.0.0, 1.4.0.0, 1.3.0.0, 1.2.0.0, 1.1.1.0 (has the same characteristics that caused the previous version to fail: excludes 'plutus-core' version 1.34.1.0)
[__4] rejecting: plutus-tx-plugin-1.1.0.0 (library is not buildable in the current environment, but it is required by plutus-preprocessor)
[__4] rejecting: plutus-tx-plugin-1.0.0.0 (conflict: plutus-core==1.34.1.0, plutus-tx-plugin => plutus-core^>=1.0)
[__4] skipping: plutus-tx-plugin-1.22.0.0 (has the same characteristics that caused the previous version to fail: excludes 'plutus-core' version 1.34.1.0)
[__4] fail (backjumping, conflict set: plutus-core, plutus-preprocessor, plutus-tx-plugin)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: plutus-ledger-api, cardano-ledger-alonzo, plutus-core, plutus-tx-plugin, plutus-preprocessor
Try running with --minimize-conflict-set to improve the error message.

Because cabal will include plutus-preprocessor on the build plan and plutus-tx-plugin is not buildable on Windows, so it will fail to synthesize a build plan.

This PR marks plutus-preprocessor as unbuildable on Windows, which removes it from the build targets considered by cabal.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages.
    New section is never added with the code changes. (See RELEASING.md)
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated.
    If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@jasagredo jasagredo requested a review from a team as a code owner October 17, 2024 11:10
Copy link
Contributor

@teodanciu teodanciu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, barring the complaints from cabal format, which can be solved with the suggestions I added.

libs/plutus-preprocessor/plutus-preprocessor.cabal Outdated Show resolved Hide resolved
libs/plutus-preprocessor/plutus-preprocessor.cabal Outdated Show resolved Hide resolved
@jasagredo
Copy link
Contributor Author

jasagredo commented Oct 17, 2024

I can implement that, but just FYI you are using cabal format which is deprecated in cabal. It is even not present in cabal --help.

➜ cabal --help | grep "\bformat\b"
  hscolour               Generate HsColour colourised code, in HTML format.

It formats the cabal file by parsing a GenericPackageDescription and write the Show representation of it. This means that comments for example are gone, and also import fields are expanded with the common stanzas, so the resulting file has no common stanzas.

I would suggest you to move to cabal-fmt or cabal-gild. I asked in the cabal matrix channel and got confirmation that cabal format should be marked as hard-deprecated eventually.

@jasagredo
Copy link
Contributor Author

FYI the command started already as hidden 10 years ago, because it was already considered "not quite ready for general consumption yet" haskell/cabal#1712

@lehins
Copy link
Collaborator

lehins commented Oct 17, 2024

I can implement that, but just FYI you are using cabal format which is deprecated in cabal.

I'd rather have formatting tool be switched in a separate PR. Which means this PR needs to make the current cabal format happy.

import fields are expanded with the common stanzas,

I am not a big fan of common stanzas, so this is not really relevant for ledger. However, deprecation of cabal format certainly is relevant. I've created: #4704

not quite ready for general consumption yet

One would hope that after 10 years that command would be brought to a point that is ready for general consumption 😁

See #4704 for a better solution that will be implemented in the future

Co-authored-by: teodanciu <[email protected]>
@lehins lehins enabled auto-merge October 17, 2024 16:54
@jasagredo
Copy link
Contributor Author

Sure, will update the PR with the changes cabal format requests.

@jasagredo
Copy link
Contributor Author

Ah you already did. Thanks @lehins !

@lehins
Copy link
Collaborator

lehins commented Oct 17, 2024

Ah you already did.

Yeah, It was easy. All I had to do was just apply the suggestions in the UI 🙂

@lehins lehins merged commit 0110426 into master Oct 17, 2024
154 checks passed
@lehins lehins deleted the js/windows-buildable branch October 17, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants