-
Notifications
You must be signed in to change notification settings - Fork 691
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
Fix --offline flag (backport #8676) #8838
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,7 @@ instance Exception BuildFailure | |
-- | Detail on the reason that a package failed to build. | ||
-- | ||
data BuildFailureReason = DependentFailed PackageId | ||
| GracefulFailure String | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, BuildFailureReason is exported. https://hackage.haskell.org/package/cabal-install-3.8.1.0/docs/Distribution-Client-ProjectBuilding-Types.html#t:BuildFailureReason |
||
| DownloadFailed SomeException | ||
| UnpackFailed SomeException | ||
| ConfigureFailed SomeException | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import P (p) | ||
|
||
main :: IO () | ||
main = print p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
packages: ./main.cabal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cabal-version: 3.0 | ||
name: current | ||
version: 0.1.0.0 | ||
license: MIT | ||
author: Colton Clemmer | ||
maintainer: coltonclemmerdev@gmail.com | ||
-- copyright: | ||
build-type: Simple | ||
extra-doc-files: CHANGELOG.md | ||
-- extra-source-files: | ||
|
||
common warnings | ||
ghc-options: -Wall | ||
|
||
executable current | ||
import: warnings | ||
main-is: Main.hs | ||
build-depends: base, remote | ||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# cabal v2-update | ||
Downloading the latest package list from test-local-repo | ||
# cabal v2-build | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- remote-0.1.0.0 (lib) (requires build) | ||
- current-0.1.0.0 (exe:current) (first run) | ||
Error: cabal: --offline was specified, hence refusing to download the package: remote version 0.1.0.0. | ||
# cabal v2-build | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- remote-0.1.0.0 (lib) (requires build) | ||
- current-0.1.0.0 (exe:current) (first run) | ||
Configuring library for remote-0.1.0.0.. | ||
Preprocessing library for remote-0.1.0.0.. | ||
Building library for remote-0.1.0.0.. | ||
Installing library in <PATH> | ||
Configuring executable 'current' for current-0.1.0.0.. | ||
Preprocessing executable 'current' for current-0.1.0.0.. | ||
Building executable 'current' for current-0.1.0.0.. | ||
# cabal v2-build | ||
Up to date |
11 changes: 11 additions & 0 deletions
11
cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = withShorterPathForNewBuildStore $ \storeDir -> | ||
cabalTest $ do | ||
skipUnlessGhcVersion ">= 8.1" | ||
skipIfWindows | ||
withProjectFile "cabal.repo.project" $ do | ||
withRepo "repo" $ do | ||
fails $ cabalG ["--store-dir=" ++ storeDir] "v2-build" ["current", "--offline"] | ||
cabalG ["--store-dir=" ++ storeDir] "v2-build" ["current"] | ||
cabalG ["--store-dir=" ++ storeDir] "v2-build" ["current", "--offline"] |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/OfflineFlag/repo/remote-0.1.0.0/P.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module P (p) where | ||
|
||
p = "Foo" |
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/OfflineFlag/repo/remote-0.1.0.0/remote.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cabal-version: 3.0 | ||
name: remote | ||
version: 0.1.0.0 | ||
license: MIT | ||
author: Colton Clemmer | ||
maintainer: coltonclemmerdev@gmail.com | ||
build-type: Simple | ||
extra-doc-files: CHANGELOG.md | ||
|
||
library | ||
build-depends: base | ||
exposed-modules: P | ||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
synopsis: Adds functionality for the --offline flag with the "build" command. | ||
packages: cabal-install | ||
prs: #8676 | ||
|
||
description: { | ||
The --offline flag previously created in #2578 but was only implemented for the install command even thought the flag didn't throw an error whenever the build command was run. This PR adds functionality for the --offline flag with the build command. | ||
Additionally there is a new PackageTest for the flag using the build command. | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change since
rebuildTargets
is exported https://hackage.haskell.org/package/cabal-install-3.8.1.0/docs/Distribution-Client-ProjectBuilding.html#v:rebuildTargets