Skip to content

Commit

Permalink
Merge pull request #1135 from finos/scalagen-fix
Browse files Browse the repository at this point in the history
Fix missing default deps when running scala-gen
  • Loading branch information
AttilaMihaly authored Jan 26, 2024
2 parents d7c0396 + dcb275a commit a72c8a3
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions cli2/src/Morphir/Elm/CLI.elm
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ update msg model =

process : Msg -> Cmd Msg
process msg =
let
withDefaultDeps packageDist =
case packageDist of
Library packageName dependencies packageDef ->
Library packageName (Dict.union Frontend.defaultDependencies dependencies) packageDef
in
case msg of
BuildFromScratch jsonInput ->
let
Expand Down Expand Up @@ -274,22 +280,18 @@ process msg =
|> Result.andThen
(\packageDist ->
Decode.decodeValue
(TestCodec.decodeTestSuite packageDist)
(TestCodec.decodeTestSuite (packageDist |> withDefaultDeps))
testSuiteJson
)
in
case
Result.map3
(\options packageDist maybeTestSuite ->
let
enrichedDistro =
case packageDist of
Library packageName dependencies packageDef ->
Library packageName (Dict.union Frontend.defaultDependencies dependencies) packageDef

fileMap : Result Encode.Value FileMap
fileMap =
mapDistribution options maybeTestSuite enrichedDistro
mapDistribution options maybeTestSuite (packageDist |> withDefaultDeps)
in
fileMap
)
Expand All @@ -313,14 +315,10 @@ process msg =
case packageDistroResult of
Ok packageDist ->
let
enrichedDistro =
case packageDist of
Library packageName dependencies packageDef ->
Library packageName (Dict.union Frontend.defaultDependencies dependencies) packageDef

fileMap : FileMap
fileMap =
Stats.collectFeaturesFromDistribution enrichedDistro
Stats.collectFeaturesFromDistribution (packageDist |> withDefaultDeps)
in
fileMap |> Ok |> encodeResult Encode.string encodeFileMap |> statsResult

Expand Down Expand Up @@ -354,11 +352,11 @@ process msg =
case testSuiteResult of
Ok testSuite ->
accesscontrolledModDef.value
|> getBranchCoverage ( packageName, modName ) packageDistro testSuite
|> getBranchCoverage ( packageName, modName ) (packageDistro |> withDefaultDeps) testSuite

Err err ->
accesscontrolledModDef.value
|> getBranchCoverage ( packageName, modName ) packageDistro Dict.empty
|> getBranchCoverage ( packageName, modName ) (packageDistro |> withDefaultDeps) Dict.empty
)
|> List.map encodeTestCoverageResult
|> (\lstValues ->
Expand Down

0 comments on commit a72c8a3

Please sign in to comment.