Skip to content
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

Print Internal/Released APIs separately, print legend #16

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions cli/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ mainSingle args = do
(mapAttachment (DRight . parseDoc))
(mapAttachment (DRight . parseDoc))
(mapAttachment (DRight . parseDoc)))
step "Printing API"
let elems =
[ ELClasses
, ELDataTypes True
Expand All @@ -113,12 +112,17 @@ mainSingle args = do
isDeprecated anns
isDeprecatedInRight _ = False

let apiFiltered =
let apiReleased =
Map.filterWithKey
(\k v -> not (isInternal k) && not (isDeprecatedInRight v))
api1
let apiInternal =
Map.filterWithKey (\k _ -> isInternal k) api1

putStrLn $ prettyAPI elems apiFiltered
step "Released API"
putStrLn $ prettyAPI elems apiReleased
step "Internal API"
putStrLn $ prettyAPI elems apiInternal

mainDiff :: [String] -> IO ()
mainDiff args = do
Expand Down Expand Up @@ -147,7 +151,15 @@ mainDiff args = do
(mapAttachment (DRight . parseDoc))
(mapAttachment (DRight . parseDoc))
(mapAttachment (DRight . parseDoc)))
step "Printing diff"

step "API Annotations"
putStrLn "[A] : Added"
putStrLn "[R] : Removed"
putStrLn "[C] : Changed"
putStrLn "[O] : Old definition"
putStrLn "[N] : New definition"
putStrLn "[D] : Deprecated"

let elems =
[ ELClasses
, ELDataTypes True
Expand All @@ -167,12 +179,18 @@ mainDiff args = do
isDeprecatedInLeft (Tagged (Attach (DBoth anns _) _) _) =
isDeprecated anns
isDeprecatedInLeft _ = False
let diff =
let diffRel =
let filt k v =
not (isInternal k)
&& not (isDeprecatedInBoth v || isDeprecatedInLeft v)
in Map.filterWithKey filt (diffAPI api1 api2)
putStrLn $ prettyAPI elems diff
let diffInt =
let filt k _ = isInternal k
in Map.filterWithKey filt (diffAPI api1 api2)
step "API diff"
putStrLn $ prettyAPI elems diffRel
step "Internal API diff"
putStrLn $ prettyAPI elems diffInt

main :: IO ()
main = do
Expand Down
Loading