Add base tag
This commit is contained in:
parent
e637f90fae
commit
6c12eb16eb
@ -1026,7 +1026,7 @@ ghcupDownloads = M.fromList
|
||||
, M.fromList
|
||||
[ ( [vver|7.10.3|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.8.2.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/7.10.3/docs/html/users_guide/release-7-10-1.html|]
|
||||
)
|
||||
@ -1072,7 +1072,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.0.2|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.9.1.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.0.2/docs/html/users_guide/8.0.1-notes.html|]
|
||||
)
|
||||
@ -1118,7 +1118,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.2.2|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.10.1.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.2.2/docs/html/users_guide/8.2.2-notes.html|]
|
||||
)
|
||||
@ -1170,7 +1170,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.4.1|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.11.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.4.1/docs/html/users_guide/8.4.1-notes.html|]
|
||||
)
|
||||
@ -1209,7 +1209,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.4.2|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.11.1.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.4.2/docs/html/users_guide/8.4.2-notes.html|]
|
||||
)
|
||||
@ -1259,7 +1259,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.4.3|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.11.1.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.4.3/docs/html/users_guide/8.4.3-notes.html|]
|
||||
)
|
||||
@ -1308,7 +1308,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.4.4|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.11.1.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.4.4/docs/html/users_guide/8.4.4-notes.html|]
|
||||
)
|
||||
@ -1362,7 +1362,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.6.1|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.12.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.6.1/docs/html/users_guide/8.6.1-notes.html|]
|
||||
)
|
||||
@ -1412,7 +1412,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.6.2|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.12.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.6.2/docs/html/users_guide/8.6.2-notes.html|]
|
||||
)
|
||||
@ -1456,7 +1456,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.6.3|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.12.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.6.3/docs/html/users_guide/8.6.3-notes.html|]
|
||||
)
|
||||
@ -1510,7 +1510,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.6.4|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.12.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.6.4/docs/html/users_guide/8.6.4-notes.html|]
|
||||
)
|
||||
@ -1559,7 +1559,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.6.5|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.12.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.6.5/docs/html/users_guide/8.6.5-notes.html|]
|
||||
)
|
||||
@ -1612,7 +1612,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.8.1|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.13.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.8.1/docs/html/users_guide/8.8.1-notes.html|]
|
||||
)
|
||||
@ -1665,7 +1665,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.8.2|]
|
||||
, VersionInfo
|
||||
[]
|
||||
[Base [pver|4.13.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.8.2/docs/html/users_guide/8.8.2-notes.html|]
|
||||
)
|
||||
@ -1718,7 +1718,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.8.3|]
|
||||
, VersionInfo
|
||||
[Recommended]
|
||||
[Recommended, Base [pver|4.13.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.8.3/docs/html/users_guide/8.8.3-notes.html|]
|
||||
)
|
||||
@ -1771,7 +1771,7 @@ ghcupDownloads = M.fromList
|
||||
)
|
||||
, ( [vver|8.10.1|]
|
||||
, VersionInfo
|
||||
[Latest]
|
||||
[Latest, Base [pver|4.14.0.0|]]
|
||||
(Just
|
||||
[uri|https://downloads.haskell.org/ghc/8.10.1/docs/html/users_guide/8.10.1-notes.html|]
|
||||
)
|
||||
|
@ -107,6 +107,7 @@ validate dls = do
|
||||
where
|
||||
isUniqueTag Latest = True
|
||||
isUniqueTag Recommended = True
|
||||
isUniqueTag (Base _) = False
|
||||
|
||||
checkGHCisSemver = do
|
||||
let ghcVers = toListOf (ix GHC % to M.keys % folded) dls
|
||||
|
@ -467,6 +467,9 @@ tagEither :: String -> Either String Tag
|
||||
tagEither s' = case fmap toLower s' of
|
||||
"recommended" -> Right Recommended
|
||||
"latest" -> Right Latest
|
||||
('b':'a':'s':'e':'-':ver') -> case pvp (T.pack ver') of
|
||||
Right x -> Right (Base x)
|
||||
Left _ -> Left [i|Invalid PVP version for base #{ver'}|]
|
||||
other -> Left ([i|Unknown tag #{other}|])
|
||||
|
||||
versionEither :: String -> Either String Version
|
||||
@ -997,6 +1000,10 @@ fromVersion av (Just (ToolTag Latest)) tool =
|
||||
getLatest av tool ?? TagNotFound Latest tool
|
||||
fromVersion av (Just (ToolTag Recommended)) tool =
|
||||
getRecommended av tool ?? TagNotFound Recommended tool
|
||||
fromVersion av (Just (ToolTag (Base pvp''))) GHC =
|
||||
getLatestBaseVersion av pvp'' ?? TagNotFound (Base pvp'') GHC
|
||||
fromVersion _ (Just (ToolTag t')) tool =
|
||||
throwE $ TagNotFound t' tool
|
||||
|
||||
|
||||
printListResult :: [ListResult] -> IO ()
|
||||
@ -1021,7 +1028,7 @@ printListResult lr = do
|
||||
| otherwise -> (color Red "✗")
|
||||
, fmap toLower . show $ lTool
|
||||
, T.unpack . prettyVer $ lVer
|
||||
, intercalate "," $ ((fmap . fmap) toLower . fmap show $ lTag)
|
||||
, intercalate "," $ (fmap printTag $ lTag)
|
||||
, intercalate "," $
|
||||
(if fromSrc then [color Blue "compiled"] else mempty)
|
||||
++ (if lStray then [color Blue "stray"] else mempty)
|
||||
@ -1029,6 +1036,11 @@ printListResult lr = do
|
||||
)
|
||||
lr
|
||||
putStrLn $ formatted
|
||||
where
|
||||
printTag Recommended = color Green "recommended"
|
||||
printTag Latest = color Yellow "latest"
|
||||
printTag (Base pvp'') = color Blue ("base-" ++ T.unpack (prettyPVP pvp''))
|
||||
printTag (UnknownTag t) = t
|
||||
|
||||
|
||||
checkForUpdates :: (MonadThrow m, MonadIO m, MonadFail m, MonadLogger m)
|
||||
|
2267
ghcup-0.0.2.json
Normal file
2267
ghcup-0.0.2.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -81,7 +81,9 @@ data VersionInfo = VersionInfo
|
||||
-- | A tag. These are currently attached to a version of a tool.
|
||||
data Tag = Latest
|
||||
| Recommended
|
||||
deriving (Ord, Eq, Show)
|
||||
| Base PVP
|
||||
| UnknownTag String -- ^ used for upwardscompat
|
||||
deriving (Ord, Eq, Show) -- FIXME: manual JSON instance
|
||||
|
||||
|
||||
data Architecture = A_64
|
||||
|
@ -37,11 +37,24 @@ deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''Tool
|
||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''VSep
|
||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''VUnit
|
||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''VersionInfo
|
||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''Tag
|
||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''DownloadInfo
|
||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''GHCupInfo
|
||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''Requirements
|
||||
|
||||
instance ToJSON Tag where
|
||||
toJSON Latest = String "Latest"
|
||||
toJSON Recommended = String "Recommended"
|
||||
toJSON (Base pvp'') = String ("base-" <> prettyPVP pvp'')
|
||||
toJSON (UnknownTag x) = String (T.pack x)
|
||||
|
||||
instance FromJSON Tag where
|
||||
parseJSON = withText "Tag" $ \t -> case T.unpack t of
|
||||
"Latest" -> pure Latest
|
||||
"Recommended" -> pure Recommended
|
||||
('b':'a':'s':'e':'-':ver') -> case pvp (T.pack ver') of
|
||||
Right x -> pure $ Base x
|
||||
Left e -> fail . show $ e
|
||||
x -> pure (UnknownTag x)
|
||||
|
||||
instance ToJSON URI where
|
||||
toJSON = toJSON . decUTF8Safe . serializeURIRef'
|
||||
@ -143,6 +156,14 @@ instance FromJSONKey Version where
|
||||
Right x -> pure x
|
||||
Left e -> fail $ "Failure in Version (FromJSONKey)" <> show e
|
||||
|
||||
instance ToJSON PVP where
|
||||
toJSON = toJSON . prettyPVP
|
||||
|
||||
instance FromJSON PVP where
|
||||
parseJSON = withText "PVP" $ \t -> case pvp t of
|
||||
Right x -> pure x
|
||||
Left e -> fail $ "Failure in PVP (FromJSON)" <> show e
|
||||
|
||||
instance ToJSONKey Tool where
|
||||
toJSONKey = genericToJSONKey defaultJSONKeyOptions
|
||||
|
||||
|
@ -279,6 +279,11 @@ getRecommended :: GHCupDownloads -> Tool -> Maybe Version
|
||||
getRecommended av tool = headOf (ix tool % getTagged Recommended % to fst) $ av
|
||||
|
||||
|
||||
-- | Gets the latest GHC with a given base version.
|
||||
getLatestBaseVersion :: GHCupDownloads -> PVP -> Maybe Version
|
||||
getLatestBaseVersion av pvpVer = headOf (ix GHC % getTagged (Base pvpVer) % to fst) av
|
||||
|
||||
|
||||
|
||||
-----------------------
|
||||
--[ Settings Getter ]--
|
||||
|
@ -13,7 +13,7 @@ import qualified Data.Text as T
|
||||
|
||||
-- | This reflects the API version of the JSON.
|
||||
ghcupURL :: URI
|
||||
ghcupURL = [uri|https://www.haskell.org/ghcup/data/ghcup-0.0.1.json|]
|
||||
ghcupURL = [uri|https://www.haskell.org/ghcup/data/ghcup-0.0.2.json|]
|
||||
|
||||
ghcUpVer :: PVP
|
||||
ghcUpVer = [pver|0.1.4|]
|
||||
|
Loading…
Reference in New Issue
Block a user