-
Notifications
You must be signed in to change notification settings - Fork 710
Fix --offline flag #8676
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
Merged
Merged
Fix --offline flag #8676
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
46ff2f7
WIP
erinclemmer 60daa3d
WIP
erinclemmer aedb4bc
WIP
erinclemmer a4db7e2
WIP
erinclemmer 2bacd71
WIP
erinclemmer 82f3629
add offline logic branch
erinclemmer 8617b5f
Clean up
erinclemmer e088365
Formatting
erinclemmer 9ac83e9
Optimize
erinclemmer c2bbca9
Rename test folder
erinclemmer 71c987b
Add changelog file
erinclemmer 96ce1e9
Fix whitespace
erinclemmer 79776b5
Update from master
erinclemmer eb6043f
Add <CABAL_ERROR> normalizer tag
erinclemmer 2bfc4a2
Merge branch 'master' into cc/5346
erinclemmer 3fe360c
code review changes
erinclemmer 9f5f902
Delet vs code file
erinclemmer d20174a
Fix import
erinclemmer 644044a
fix wrong output file
erinclemmer 7ffaf46
Merge branch 'master' into cc/5346
mergify[bot] 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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: [email protected] | ||
-- 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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: [email protected] | ||
build-type: Simple | ||
extra-doc-files: CHANGELOG.md | ||
|
||
library | ||
build-depends: base | ||
exposed-modules: P | ||
default-language: Haskell2010 |
This file contains hidden or 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.
I think you could use
notNull
instead ofnot
andnull
separately.