From 10a7715d2b79b4773685a4f77869ef716fd6e0a4 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Thu, 19 Dec 2019 11:29:11 +0100 Subject: [PATCH] Avoid globbing for stable packages (#3905) I managed to break our Windows CI twice already due to this so while it makes me sad, I think hardcoding those files is the more sensible option for now. --- .../src/Development/IDE/Core/Rules/Daml.hs | 11 +++++++++-- compiler/damlc/stable-packages/BUILD.bazel | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs b/compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs index ab632ebd6df..008556b168a 100644 --- a/compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs +++ b/compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs @@ -489,8 +489,15 @@ generatePackageMapRule opts = generateStablePackages :: LF.Version -> FilePath -> IO ([FileDiagnostic], Map.Map (UnitId, LF.ModuleName) LF.DalfPackage) generateStablePackages lfVersion fp = do (diags, pkgs) <- fmap partitionEithers $ do - allFiles <- listFilesRecursive fp - let dalfs = filter ((== ".dalf") . takeExtension) allFiles + -- It is very tempting to just use a listFilesRecursive here. + -- However, that has broken CI several times on Windows due to the lack of + -- sandboxing which resulted in newly added files being picked up from other PRs. + -- Given that this list doesn’t change too often and you will get a compile error + -- if you forget to update it, we hardcode it here. + let dalfs = + map (fp ) $ + map ("daml-prim" ) ["DA-Types.dalf", "GHC-Prim.dalf", "GHC-Tuple.dalf", "GHC-Types.dalf"] <> + map ("daml-stdlib" ) ["DA-Internal-Any.dalf", "DA-Internal-Template.dalf"] forM dalfs $ \dalf -> do let packagePath = takeFileName $ takeDirectory dalf let unitId = stringToUnitId $ if packagePath == "daml-stdlib" diff --git a/compiler/damlc/stable-packages/BUILD.bazel b/compiler/damlc/stable-packages/BUILD.bazel index 03f65737e43..00a859f3c32 100644 --- a/compiler/damlc/stable-packages/BUILD.bazel +++ b/compiler/damlc/stable-packages/BUILD.bazel @@ -46,6 +46,7 @@ genrule( visibility = ["//visibility:public"], ) +# If you change this you also need to update generateStablePackages in Development.IDE.Core.Rules.Daml filegroup( name = "stable-packages", srcs = [