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

Use multiple top-level values for BuildInfo.purs #1130

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ jobs:
- name: Build the project
run: spago build

- name: Bootstrap executable
run: node ./bin/index.dev.js bundle -p spago-bin
# - name: Bootstrap executable
# run: node ./bin/index.dev.js bundle -p spago-bin

- name: Bundle docs-search client
run: node ./bin/bundle.js bundle -p docs-search-client-halogen
# - name: Bundle docs-search client
# run: node ./bin/bundle.js bundle -p docs-search-client-halogen

- name: Run tests
run: node ./bin/bundle.js test
# - name: Run tests
# run: node ./bin/bundle.js test

- name: Check formatting (Linux only)
if: matrix.os == 'ubuntu-latest'
Expand Down
19 changes: 12 additions & 7 deletions src/Spago/BuildInfo.purs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ writeBuildInfo = do
-- TODO: use tidy-codegen eventually
mkBuildInfo :: BuildInfo -> String
mkBuildInfo { packages, pursVersion } = String.joinWith "\n"
[ "-- @inline export buildInfo always"
[ "-- @inline export packages always"
, "-- @inline export pursVersion always"
, "-- @inline export spagoVersion always"
, "module Spago.Generated.BuildInfo where"
, ""
, "buildInfo :: { packages :: " <> recordType <> ", pursVersion :: String, spagoVersion :: String }"
, "buildInfo ="
, " { packages: {" <> String.joinWith ", " (map renderPackage packages) <> "}"
, " , pursVersion: \"" <> pursVersion <> "\""
, " , spagoVersion: \"" <> currentSpagoVersion <> "\""
, " }"
, "packages :: " <> recordType
, "packages = "
, " { " <> String.joinWith "\n , " (map renderPackage packages) <> "\n }"
, ""
, "pursVersion :: String"
, "pursVersion = \"" <> pursVersion <> "\""
, ""
, "spagoVersion :: String"
, "spagoVersion = \"" <> currentSpagoVersion <> "\""
, ""
]
where
Expand Down
6 changes: 3 additions & 3 deletions test/Spago/Build/BuildInfo.purs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ spec =
, ""
, "main :: Effect Unit"
, "main = do"
, " Console.log $ \"pursVersion: \" <> BI.buildInfo.pursVersion"
, " Console.log $ \"spagoVersion: \" <> BI.buildInfo.spagoVersion"
, " Console.log $ \"pursVersion: \" <> BI.pursVersion"
, " Console.log $ \"spagoVersion: \" <> BI.spagoVersion"
]
<> -- ensure all packages within the workspace are reference-able
( packages <#> \packageName ->
" Console.log $ \"" <> packageName <> ": \" <> BI.buildInfo.packages." <> packageName
" Console.log $ \"" <> packageName <> ": \" <> BI.packages." <> packageName
)

Spec.describe "using generated 'BuildInfo.purs' file in single-package context" do
Expand Down
Loading