|
1 | 1 | open Stdune |
2 | | -open Dune_config |
3 | 2 | open Dune_config_file |
4 | 3 | module Console = Dune_console |
5 | 4 | module Graph = Dune_graph.Graph |
@@ -412,12 +411,12 @@ let shared_with_config_file = |
412 | 411 | let doc = |
413 | 412 | Printf.sprintf |
414 | 413 | "Enable or disable Dune cache (%s). Default is `%s'." |
415 | | - (Arg.doc_alts_enum Config.Toggle.all) |
416 | | - (Config.Toggle.to_string Dune_config.default.cache_enabled) |
| 414 | + (Arg.doc_alts_enum Dune_config.Cache.Toggle.all) |
| 415 | + (Dune_config.Cache.Toggle.to_string Dune_config.default.cache_enabled) |
417 | 416 | in |
418 | 417 | Arg.( |
419 | 418 | value |
420 | | - & opt (some (enum Config.Toggle.all)) None |
| 419 | + & opt (some (enum Dune_config.Cache.Toggle.all)) None |
421 | 420 | & info [ "cache" ] ~docs ~env:(Cmd.Env.info ~doc "DUNE_CACHE") ~doc) |
422 | 421 | and+ cache_storage_mode = |
423 | 422 | let doc = |
@@ -584,7 +583,6 @@ module Builder = struct |
584 | 583 | ; file_watcher : Dune_engine.Scheduler.Run.file_watcher |
585 | 584 | ; workspace_config : Dune_rules.Workspace.Clflags.t |
586 | 585 | ; cache_debug_flags : Dune_engine.Cache_debug_flags.t |
587 | | - ; cache_rules_default : bool |
588 | 586 | ; report_errors_config : Dune_engine.Report_errors_config.t |
589 | 587 | ; separate_error_messages : bool |
590 | 588 | ; stop_on_first_error : bool |
@@ -936,20 +934,6 @@ module Builder = struct |
936 | 934 | useful for Dune developers to make Dune tests of the digest cache more \ |
937 | 935 | reproducible.") |
938 | 936 | and+ cache_debug_flags = cache_debug_flags_term |
939 | | - and+ cache_rules_default = |
940 | | - let default = |
941 | | - Dune_lang.Toggle.of_bool !Dune_engine.Clflags.can_go_in_shared_cache_default |
942 | | - in |
943 | | - let doc = |
944 | | - Printf.sprintf |
945 | | - "Enable or disable caching rules (%s). Default is `%s'." |
946 | | - (Arg.doc_alts_enum Config.Toggle.all) |
947 | | - (Config.Toggle.to_string default) |
948 | | - in |
949 | | - Arg.( |
950 | | - value |
951 | | - & opt (enum Config.Toggle.all) default |
952 | | - & info [ "cache-rules" ] ~docs ~env:(Cmd.Env.info ~doc "DUNE_CACHE_RULES") ~doc) |
953 | 937 | and+ report_errors_config = |
954 | 938 | Arg.( |
955 | 939 | value |
@@ -1026,7 +1010,6 @@ module Builder = struct |
1026 | 1010 | ; config_from_config_file |
1027 | 1011 | } |
1028 | 1012 | ; cache_debug_flags |
1029 | | - ; cache_rules_default = Dune_lang.Toggle.enabled cache_rules_default |
1030 | 1013 | ; report_errors_config |
1031 | 1014 | ; separate_error_messages |
1032 | 1015 | ; stop_on_first_error |
@@ -1236,14 +1219,18 @@ let init (builder : Builder.t) = |
1236 | 1219 | Dune_rules.Global.init ~capture_outputs:c.builder.capture_outputs; |
1237 | 1220 | let cache_config = |
1238 | 1221 | match config.cache_enabled with |
1239 | | - | `Disabled -> Dune_cache.Config.Disabled |
1240 | | - | `Enabled -> |
| 1222 | + | Disabled -> Dune_cache.Config.Disabled |
| 1223 | + | Enabled_except_user_rules | Enabled -> |
1241 | 1224 | Enabled |
1242 | 1225 | { storage_mode = Option.value config.cache_storage_mode ~default:Hardlink |
1243 | 1226 | ; reproducibility_check = config.cache_reproducibility_check |
1244 | 1227 | } |
1245 | 1228 | in |
1246 | | - Log.info [ Pp.textf "Shared cache: %s" (Config.Toggle.to_string config.cache_enabled) ]; |
| 1229 | + Log.info |
| 1230 | + [ Pp.textf |
| 1231 | + "Shared cache: %s" |
| 1232 | + (Dune_config.Cache.Toggle.to_string config.cache_enabled) |
| 1233 | + ]; |
1247 | 1234 | Log.info |
1248 | 1235 | [ Pp.textf |
1249 | 1236 | "Shared cache location: %s" |
@@ -1277,7 +1264,10 @@ let init (builder : Builder.t) = |
1277 | 1264 | Dune_rules.Clflags.ignore_lock_dir := c.builder.ignore_lock_dir; |
1278 | 1265 | Dune_rules.Clflags.on_missing_dune_project_file |
1279 | 1266 | := if c.builder.require_dune_project_file then Error else Warn; |
1280 | | - Dune_engine.Clflags.can_go_in_shared_cache_default := c.builder.cache_rules_default; |
| 1267 | + (Dune_engine.Clflags.can_go_in_shared_cache_default |
| 1268 | + := match config.cache_enabled with |
| 1269 | + | Disabled | Enabled_except_user_rules -> false |
| 1270 | + | Enabled -> true); |
1281 | 1271 | Log.info |
1282 | 1272 | [ Pp.textf |
1283 | 1273 | "Workspace root: %s" |
|
0 commit comments