Play

Check-in [03c71127f3]
Login
Overview
Comment:Strip .play suffix from files before trying to convert to a ModuleName.
Timelines: family | ancestors | descendants | both | modules
Files: files | file ages | folders
SHA3-256: 03c71127f30221826c0b0d40ac0bb9f28a66abf72ce8550d11535093ed5d5c22
User & Date: robin.hansen on 2021-02-27 15:58:27
Other Links: branch diff | manifest | tags
Context
2021-02-28
11:39
Add tests to check that only relevant packages are resolved. Currently fails. check-in: a49b84525d user: robin.hansen tags: modules
2021-02-27
15:58
Strip .play suffix from files before trying to convert to a ModuleName. check-in: 03c71127f3 user: robin.hansen tags: modules
15:35
PackageLoader now resolves the modules of each package. check-in: 6092e67f02 user: robin.hansen tags: modules
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified src/Play/PackageLoader.elm from [f6bdf34c6b] to [28d754c631].

193
194
195
196
197
198
199

200
201
202
203
204
205
206
207
    case msg of
        ResolvedPackageModules packageName modules ->
            let
                rootPackage =
                    state.rootPackage

                moduleNameResults =

                    List.map ModuleName.fromString modules
                        |> Result.combine

                updatedRemainingPackages =
                    List.filter (\p -> PackageName.toString p.metadata.name /= packageName) remainingPackages

                nextStep newState =
                    case updatedRemainingPackages of







>
|







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
    case msg of
        ResolvedPackageModules packageName modules ->
            let
                rootPackage =
                    state.rootPackage

                moduleNameResults =
                    List.map (String.replace ".play" "") modules
                        |> List.map ModuleName.fromString
                        |> Result.combine

                updatedRemainingPackages =
                    List.filter (\p -> PackageName.toString p.metadata.name /= packageName) remainingPackages

                nextStep newState =
                    case updatedRemainingPackages of

Modified tests/Test/PackageLoader.elm from [23b0e67b68] to [7f4459b9a4].

28
29
30
31
32
33
34


35



36
37
38
39
40
41
42
...
127
128
129
130
131
132
133






134
135
136
137
138
139
140
...
143
144
145
146
147
148
149
150






151
        ]


expectSideEffects : Dict String String -> List PackageLoader.SideEffect -> PackageLoader.Model -> Expectation
expectSideEffects fileSystem expectedSFs model =
    case getSideEffect model of
        Nothing ->


            Expect.equalLists [] expectedSFs




        Just sideEffect ->
            case sideEffect of
                PackageLoader.ReadFile path filename ->
                    case Dict.get (path ++ "/" ++ filename) fileSystem of
                        Just fileContent ->
                            expectSideEffects
................................................................................
                    "jarvis/template_strings": "1.2.0"
                },
                "package-paths": [
                    "lib/*"
                ]
            }
            """






          )
        , ( "/project/lib/template_strings/play.json"
          , """
            {
                "name": "jarvis/template_strings",
                "version": "1.2.0",
                "language-version": "0.2.0",
................................................................................
                ],
                "dependencies": {
                },
                "package-paths": [
                ]
            }
          """
          )






        ]







>
>
|
>
>
>







 







>
>
>
>
>
>







 








>
>
>
>
>
>

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
        ]


expectSideEffects : Dict String String -> List PackageLoader.SideEffect -> PackageLoader.Model -> Expectation
expectSideEffects fileSystem expectedSFs model =
    case getSideEffect model of
        Nothing ->
            case model of
                PackageLoader.Done _ ->
                    Expect.equalLists [] expectedSFs

                _ ->
                    Expect.fail <| "Expected model be Done, was: " ++ Debug.toString model

        Just sideEffect ->
            case sideEffect of
                PackageLoader.ReadFile path filename ->
                    case Dict.get (path ++ "/" ++ filename) fileSystem of
                        Just fileContent ->
                            expectSideEffects
................................................................................
                    "jarvis/template_strings": "1.2.0"
                },
                "package-paths": [
                    "lib/*"
                ]
            }
            """
          )
        , ( "/project/src/mod1.play"
          , """
            def: inc
            : 1 +
            """
          )
        , ( "/project/lib/template_strings/play.json"
          , """
            {
                "name": "jarvis/template_strings",
                "version": "1.2.0",
                "language-version": "0.2.0",
................................................................................
                ],
                "dependencies": {
                },
                "package-paths": [
                ]
            }
          """
          )
        , ( "/project/lib/template_strings/src/template_strings/mod.play"
          , """
            def: dec
            : 1 =
            """
          )
        ]