Skip to content

Commit 814ce98

Browse files
authored
Merge branch 'master' into github-actions
2 parents a883a40 + 3309afd commit 814ce98

File tree

5 files changed

+68
-13
lines changed

5 files changed

+68
-13
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.17.0] - 2020-10-29
11+
1012
Breaking changes (😱!!!):
1113
- **Specify the package set version via `--tag` (#680)**
1214

13-
Example usage: `spago init --tag psc-0.13.2-20190725` and `spago upgrade-set --tag psc-0.13.2-20190725`. This is a breaking change because we are removing support for the old spacchetti/spacchetti-style location (i.e. in the src/packages.dhall) for the upgrade-set command.
15+
Example usage: `spago init --tag psc-0.13.2-20190725` and `spago upgrade-set --tag psc-0.13.2-20190725`.
16+
This is a breaking change because we are removing support for the old spacchetti/spacchetti-style location (i.e. in the src/packages.dhall) for the upgrade-set command.
17+
18+
Bugfixes:
19+
- Remove dependency on `libtinfo`, removing the biggest cause of friction for using the precompiled binary on various Linux distros (#684)
20+
- Correctly parse flags to be passed to the compiler (#688)
1421

1522
## [0.16.0] - 2020-08-14
1623

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: spago
2-
version: 0.16.0
2+
version: 0.17.0
33
github: "purescript/spago"
44
license: BSD3
55
author: "Justin Woo, Fabrizio Ferrai"

src/Spago/Command/Path.hs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Spago.Command.Path (showPaths, getOutputPath) where
1+
module Spago.Command.Path (showPaths, getOutputPath, findFlag) where
22

33
import Spago.Prelude
44
import Spago.Env
@@ -43,7 +43,7 @@ getOutputPath buildOpts = do
4343
Just path -> Text.unpack path
4444

4545

46-
-- TODO tests:
46+
-- See tests in: test/Spago/Command/PathSpec.hs
4747
-- ["-o", "something"]
4848
-- ["--output", "something"]
4949
-- ["--output something"]
@@ -53,18 +53,34 @@ getOutputPath buildOpts = do
5353
-- | Try to find the content of a certain flag in a list of PursArgs
5454
findFlag :: Char -> Text -> [PursArg] -> Maybe Text
5555
findFlag char string = \case
56-
[] -> Nothing
57-
[_] -> Nothing
58-
(x:y:xs) -> if isFlag x
59-
then Just (unPursArg y)
60-
else findFlag char string (y : xs)
61-
where
56+
(x:xs) -> if isFlag x
57+
then case xs of
58+
(y:_) -> Just (unPursArg y)
59+
_ -> Nothing
60+
else if hasFlag x
61+
then case Text.words (unPursArg x) of
62+
[word] -> case Text.split (=='=') word of
63+
[_,value] -> Just value
64+
_ -> Nothing
65+
(_:value:_) -> Just value
66+
_ -> Nothing
67+
else findFlag char string xs
68+
_ -> Nothing
69+
where
6270
isFlag :: PursArg -> Bool
63-
isFlag (PursArg a)
71+
isFlag (PursArg word)
72+
= word == (Text.pack ['-', char])
73+
|| word == ("--" <> string)
74+
hasFlag :: PursArg -> Bool
75+
hasFlag (PursArg a)
6476
= firstWord == (Text.pack ['-', char])
6577
|| firstWord == ("--" <> string)
6678
where
6779
firstWord
6880
= fromMaybe "" $ case Text.words a of
6981
[] -> Nothing
70-
(word:_) -> Just word
82+
[word] -> case Text.split (=='=') word of
83+
[one] -> Just one
84+
[key,_] -> Just key
85+
_ -> Nothing
86+
(word:_) -> Just word

templates/packages.dhall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ in upstream
105105
-------------------------------
106106
-}
107107
let upstream =
108-
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201007/packages.dhall sha256:35633f6f591b94d216392c9e0500207bb1fec42dd355f4fecdfd186956567b6b
108+
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201021/packages.dhall sha256:55ebdbda1bd6ede4d5307fbc1ef19988c80271b4225d833c8d6fb9b6fb1aa6d8
109109

110110
in upstream

test/Spago/Command/PathSpec.hs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module Spago.Command.PathSpec (spec) where
2+
3+
import Prelude
4+
import Test.Hspec
5+
6+
import Spago.Prelude hiding (link)
7+
import Spago.Env
8+
import qualified Spago.Command.Path as Path
9+
10+
spec :: Spec
11+
spec = do
12+
describe "Path findFlag" $ do
13+
it "[\"-o\", \"something\"]" $ do
14+
let a = fromMaybe "" $ Path.findFlag 'o' "output" [PursArg "-o" , PursArg "something"]
15+
let b = "something"
16+
a `shouldBe` b
17+
it "[\"--output\", \"something\"]" $ do
18+
let a = fromMaybe "" $ Path.findFlag 'o' "output" [PursArg "--output" , PursArg "something"]
19+
let b = "something"
20+
a `shouldBe` b
21+
it "[\"-o something\"]" $ do
22+
let a = fromMaybe "" $ Path.findFlag 'o' "output" [PursArg "-o something"]
23+
let b = "something"
24+
a `shouldBe` b
25+
it "[\"--output something\"]" $ do
26+
let a = fromMaybe "" $ Path.findFlag 'o' "output" [PursArg "--output something"]
27+
let b = "something"
28+
a `shouldBe` b
29+
it "[\"--output=something\"]" $ do
30+
let a = fromMaybe "" $ Path.findFlag 'o' "output" [PursArg "--output=something"]
31+
let b = "something"
32+
a `shouldBe` b

0 commit comments

Comments
 (0)