-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * WIP * WIP * WIP * WIP * add offline logic branch * Clean up * Formatting * Optimize * Rename test folder * Add changelog file * Fix whitespace * Add <CABAL_ERROR> normalizer tag * code review changes * Delet vs code file * Fix import * fix wrong output file --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 0ed1218)
- Loading branch information
1 parent
6c95f3f
commit 8debe07
Showing
15 changed files
with
128 additions
and
3 deletions.
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
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: [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 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: [email protected] | ||
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. | ||
} |