-
Notifications
You must be signed in to change notification settings - Fork 132
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
Always output all packages in build info #1126
Conversation
Ah brilliant, this is a good fix I would say this doesn't need a test, but as you noted in the issue thread this thing has already regressed twice, which is strongly hinting at needing a test 😄 |
Yeah.... I guess it does need a test. Besides adding such tests, I also added an inline directive for |
Yes - I don't recall if we have TODOs about this anywhere, but it has that shape so that we can include things like build time, git commit and other non-package-specific info |
Just to clarify, you are saying there is a reason for the current code below: module Spago.Generated.BuildInfo where
buildInfo :: { packages :: <recordType>, pursVersion :: String, spagoVersion :: String }
buildInfo =
{ packages: { "foo": "1.2.3", "bar": "1.2.3" }
, pursVersion: "1.2.3"
, spagoVersion: "1.2.3"
} rather than this alternative implementation: module Spago.Generated.BuildInfo where
packages :: <recordType>
packages =
{ "foo": "1.2.3"
, "bar": "1.2.3"
}
pursVersion :: String
pursVersion = "1.2.3"
spagoVersion :: String
spagoVersion = "1.2.3" Could you clarify what that reason is? |
Oh, I didn't get what you meant then - no specific reason for that, they are pretty much equivalent. If we want to change this we should do it asap, because I won't want to change it liberally once we are out of alpha. |
test/Prelude.purs
Outdated
pursVersion = do | ||
let pursBinary = if Process.platform == Just Win32 then "purs.cmd" else "purs" | ||
Cmd.exec pursBinary [ "--version" ] | ||
$ Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false, pipeStdin = StdinNewPipe } | ||
|
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.
We include in this setup phase only things that are dependent on the paths, because we run the tests in temp directories so we need to fix the paths at this point.
The version of purs is not path-dependent, so we can call it inside the test itself.
Moreover, we have a helper for this already that we can just call from every test, so you don't have to parse the output, etc:
Line 27 in 478e379
getPurs = Cmd.getExecutable "purs" >>= parseVersionOutput |
pursVersion = do | |
let pursBinary = if Process.platform == Just Win32 then "purs.cmd" else "purs" | |
Cmd.exec pursBinary [ "--version" ] | |
$ Cmd.defaultExecOptions { pipeStdout = false, pipeStderr = false, pipeStdin = StdinNewPipe } |
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.
Done.
test/Spago/Build.purs
Outdated
@@ -10,6 +10,7 @@ import Spago.Core.Config as Config | |||
import Spago.FS as FS | |||
import Test.Spago.Build.Pedantic as Pedantic | |||
import Test.Spago.Build.Polyrepo as BuildPolyrepo | |||
import Test.Spago.Build.BuildInfo as BuildBuildInfo |
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.
Why not just
import Test.Spago.Build.BuildInfo as BuildBuildInfo | |
import Test.Spago.Build.BuildInfo as BuildInfo |
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 was following the convention used in BuildPolyRepo
😄
I've opened an issue for this in #1128 along with a few other questions. |
Description of the change
Fixes #1124. I don't think there's any reason not to write out all packages... Does this need a test?
Checklist:
README
P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊