Skip to content

Commit c7745be

Browse files
authored
Merge pull request #798 from avh4/linux-aarch64-scripts
Scripts for packaging linux-aarch64
2 parents 6dcbfd3 + 2fc2e79 commit c7745be

File tree

17 files changed

+547
-198
lines changed

17 files changed

+547
-198
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
/dist/
2121
/publish/
2222
/downloads/
23+
/result

Shakefile/build-elm-format.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ executable build-elm-format
99
other-modules:
1010
Paths_build_elm_format
1111
Shakefiles.Dependencies
12+
Shakefiles.ElmFormat.IntegrationTests
1213
Shakefiles.Extra
1314
Shakefiles.Haskell
15+
Shakefiles.NestedCheckout
16+
Shakefiles.NixBuild
1417
Shakefiles.Platform
1518
Shakefiles.Shellcheck
1619
Shakefiles.Signature

Shakefile/src/Main.hs

Lines changed: 9 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ import Control.Monad (forM_)
66
import qualified System.Directory
77
import qualified System.Info
88

9+
import qualified Shakefiles.ElmFormat.IntegrationTests
910
import qualified Shakefiles.Haskell
1011
import qualified Shakefiles.Shellcheck
1112
import qualified Shakefiles.Dependencies
1213
import qualified Shakefiles.Signature
1314
import Shakefiles.Extra
15+
import qualified Shakefiles.NixBuild
16+
import qualified Shakefiles.NestedCheckout
1417

1518

1619
main :: IO ()
@@ -44,6 +47,9 @@ rules = do
4447

4548
phony "build" $ need [ "elm-format" ]
4649
phony "elm-format" $ need [ elmFormat ]
50+
phony "generated" $ need
51+
[ "generated/Build_elm_format.hs"
52+
]
4753
phony "unit-tests" $ need
4854
[ "_build/cabal/elm-format-lib/test.ok"
4955
, "_build/cabal/elm-format-test-lib/test.ok"
@@ -129,191 +135,10 @@ rules = do
129135

130136
Shakefiles.Haskell.executable elmFormat "elm-format" gitDescribe
131137

138+
Shakefiles.NixBuild.rules
132139

133-
--
134-
-- integration tests
135-
--
136-
137-
phony "integration-tests" $
138-
need
139-
[ "_build/run-tests.ok"
140-
, "_build/tests/test-files/good-json.ok"
141-
, "_build/tests/test-files/good-json-roundtrip.ok"
142-
, "_build/tests/test-files/good/Elm-0.19.ok"
143-
, "_build/tests/test-files/good/Elm-0.18.ok"
144-
, "_build/tests/test-files/good/Elm-0.17.ok"
145-
, "_build/tests/test-files/transform/Elm-0.19.ok"
146-
, "_build/tests/test-files/transform/Elm-0.18.ok"
147-
, "_build/tests/test-files/transform/Elm-0.17.ok"
148-
, "_build/tests/test-files/bad/Elm-0.19.ok"
149-
, "_build/tests/test-files/bad/Elm-0.18.ok"
150-
, "_build/tests/test-files/bad/Elm-0.17.ok"
151-
, "_build/tests/test-files/from-json/Elm-0.19.ok"
152-
]
153-
154-
"_build/run-tests.ok" %> \out -> do
155-
let script = "tests/run-tests.sh"
156-
need [ script, elmFormat ]
157-
testFiles <- getDirectoryFiles ""
158-
[ "tests/test-files/good/json//*.elm"
159-
, "tests/test-files/bad//*.elm"
160-
, "tests/test-files/directory//*.elm"
161-
, "tests/test-files/recursive-directory//*.elm"
162-
, "tests/test-files/*.json"
163-
]
164-
need testFiles
165-
cmd_ ("bash" <.> exe) script elmFormat
166-
writeFile' out ""
167-
168-
"_build/tests/test-files/prof.ok" %> \out -> do
169-
let oks =
170-
[ "_build/tests/test-files/good/Elm-0.17/prof.ok"
171-
, "_build/tests/test-files/good/Elm-0.18/prof.ok"
172-
, "_build/tests/test-files/good/Elm-0.19/prof.ok"
173-
]
174-
need oks
175-
writeFile' out (unlines oks)
176-
177-
178-
-- Elm files
179-
180-
let elmVersions = [ "0.17", "0.18", "0.19" ]
181-
182-
forM_ elmVersions $ \elmVersion -> do
183-
("_build/tests/test-files/good/Elm-" ++ elmVersion ++ ".ok") %> \out -> do
184-
elmFiles <- getDirectoryFiles ""
185-
[ "tests/test-files/good/Elm-" ++ elmVersion ++ "//*.elm"
186-
]
187-
let oks = ["_build" </> f -<.> "elm_matches" | f <- elmFiles]
188-
need oks
189-
writeFile' out (unlines elmFiles)
190-
191-
("_build/tests/test-files/good/Elm-" ++ elmVersion ++ "/prof.ok") %> \out -> do
192-
alwaysRerun
193-
elmFiles <- getDirectoryFiles ""
194-
[ "tests/test-files/good/Elm-" ++ elmVersion ++ "//*.elm"
195-
]
196-
let oks = ["_profile" </> f -<.> (gitSha ++ ".prof") | f <- elmFiles]
197-
need oks
198-
writeFile' out (unlines oks)
199-
200-
("_profile/tests/test-files/good/Elm-" ++ elmVersion ++ "//*." ++ gitSha ++ ".prof") %> \out -> do
201-
let source = dropDirectory1 $ dropExtensions out <.> "elm"
202-
need [ "_build/bin/elm-format-prof", source ]
203-
cmd_ "_build/bin/elm-format-prof" source "--output" "/dev/null" ("--elm-version=" ++ elmVersion) "+RTS" "-p" ("-po" ++ (out -<.> ""))
204-
205-
("_build/tests/test-files/*/Elm-" ++ elmVersion ++ "//*.elm_formatted") %> \out -> do
206-
let source = dropDirectory1 $ out -<.> "elm"
207-
need [ elmFormat, source ]
208-
cmd_ elmFormat source "--output" out ("--elm-version=" ++ elmVersion)
209-
210-
("_build/tests/test-files/*/Elm-" ++ elmVersion ++ "//*.elm_stderr") %> \out -> do
211-
let source = dropDirectory1 $ out -<.> "elm"
212-
need [ elmFormat, source ]
213-
(Stderr stderr, Exit _) <- cmd (FileStdin source) BinaryPipes elmFormat "--stdin" ("--elm-version=" ++ elmVersion)
214-
cmd_ (FileStdout out) (Stdin stderr) BinaryPipes "tr" [ "-d", "\r" ]
215-
216-
("_build/tests/test-files/transform/Elm-" ++ elmVersion ++ ".ok") %> \out -> do
217-
elmFiles <- getDirectoryFiles ""
218-
[ "tests/test-files/transform/Elm-" ++ elmVersion ++ "//*.elm"
219-
]
220-
let oks = ["_build" </> f -<.> "elm_transform_matches" | f <- elmFiles, takeExtension (dropExtension f) /= ".formatted" ]
221-
need oks
222-
writeFile' out (unlines oks)
223-
224-
("_build/tests/test-files/bad/Elm-" ++ elmVersion ++ ".ok") %> \out -> do
225-
elmFiles <- getDirectoryFiles ""
226-
[ "tests/test-files/bad/Elm-" ++ elmVersion ++ "//*.elm"
227-
]
228-
let oks = ["_build" </> f -<.> "elm_bad_matches" | f <- elmFiles ]
229-
need oks
230-
writeFile' out (unlines elmFiles)
231-
232-
("_build/tests/test-files/from-json/Elm-" ++ elmVersion ++ ".ok") %> \out -> do
233-
jsonFiles <- getDirectoryFiles ""
234-
[ "tests/test-files/from-json/Elm-" ++ elmVersion ++ "//*.json"
235-
]
236-
let oks = ["_build" </> f -<.> "elm_from_json_matches" | f <- jsonFiles ]
237-
need oks
238-
writeFile' out (unlines oks)
239-
240-
"_build/tests//*.elm_from_json" %> \out -> do
241-
let source = dropDirectory1 $ out -<.> "json"
242-
need [ elmFormat, source ]
243-
cmd_ (FileStdout out) elmFormat "--from-json" source
244-
245-
"_build/tests//*.elm_matches" %> \out -> do
246-
let actual = out -<.> "elm_formatted"
247-
let expected = dropDirectory1 $ out -<.> "elm"
248-
need [ actual, expected ]
249-
cmd_ "diff" "-u" actual expected
250-
writeFile' out ""
251-
252-
"_build/tests//*.elm_transform_matches" %> \out -> do
253-
let actual = out -<.> "elm_formatted"
254-
let expected = dropDirectory1 $ out -<.> "formatted.elm"
255-
need [ actual, expected ]
256-
cmd_ "diff" "-u" actual expected
257-
writeFile' out ""
258-
259-
"_build/tests//*.elm_bad_matches" %> \out -> do
260-
let actual = out -<.> "elm_stderr"
261-
let expected = dropDirectory1 $ out -<.> "output.txt"
262-
need [ actual, expected ]
263-
cmd_ "diff" "--strip-trailing-cr" "-u" actual expected
264-
writeFile' out ""
265-
266-
"_build/tests//*.elm_from_json_matches" %> \out -> do
267-
let actual = out -<.> "elm_from_json"
268-
let expected = dropDirectory1 $ out -<.> "elm"
269-
need [ actual, expected ]
270-
cmd_ "diff" "--strip-trailing-cr" "-u" actual expected
271-
writeFile' out ""
272-
273-
274-
-- JSON files
275-
276-
"_build/tests/test-files/good-json.ok" %> \out -> do
277-
jsonFiles <- getDirectoryFiles ""
278-
[ "tests/test-files/good//*.json"
279-
]
280-
let oks = ["_build" </> f -<.> "json_matches" | f <- jsonFiles]
281-
need oks
282-
writeFile' out (unlines jsonFiles)
283-
284-
"_build/tests//*.json_formatted" %> \out -> do
285-
let source = dropDirectory1 $ out -<.> "elm"
286-
need [ elmFormat, source ]
287-
(Stdout rawJson) <- cmd (FileStdin source) elmFormat "--elm-version=0.19" "--stdin" "--json"
288-
(Stdout formattedJson) <- cmd (Stdin rawJson) "jq" "--indent" "4" "--sort-keys" "--ascii-output" "."
289-
writeFileChanged out formattedJson
290-
291-
"_build/tests//*.json_matches" %> \out -> do
292-
let actual = out -<.> "json_formatted"
293-
let expected = dropDirectory1 $ out -<.> "json"
294-
need [ actual, expected ]
295-
cmd_ "diff" "--strip-trailing-cr" "-u" actual expected
296-
writeFile' out ""
297-
298-
"_build/tests/test-files/good-json-roundtrip.ok" %> \out -> do
299-
jsonFiles <- getDirectoryFiles ""
300-
[ "tests/test-files/good//*.json"
301-
]
302-
let oks = ["_build" </> f -<.> "json_roundtrip_matches" | f <- jsonFiles]
303-
need oks
304-
writeFile' out (unlines jsonFiles)
305-
306-
"_build/tests//*.json_roundtrip_formatted" %> \out -> do
307-
let source = out -<.> "json_formatted"
308-
need [ elmFormat, source ]
309-
cmd_ (FileStdout out) elmFormat "--elm-version=0.19" "--from-json" source
310-
311-
"_build/tests//*.json_roundtrip_matches" %> \out -> do
312-
let actual = out -<.> "json_roundtrip_formatted"
313-
let expected = dropDirectory1 $ out -<.> "json-roundtrip"
314-
need [ actual, expected ]
315-
cmd_ "diff" "--strip-trailing-cr" "-u" actual expected
316-
writeFile' out ""
140+
Shakefiles.ElmFormat.IntegrationTests.rules gitSha elmFormat
317141

142+
Shakefiles.NestedCheckout.rules
318143

319144
Shakefiles.Shellcheck.rules shellcheck

0 commit comments

Comments
 (0)