From e52cca99cbb9e57c9b9103f126d878afc1d4d512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Dimino?= Date: Sun, 26 Feb 2017 21:39:03 +0000 Subject: [PATCH] Do not copy over .install files --- src/build_system.ml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/build_system.ml b/src/build_system.ml index 229ca746..cf497e09 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -260,16 +260,22 @@ let setup_copy_rules t ~all_non_target_source_files ~all_targets_by_dir = String_map.iter (Context.all ()) ~f:(fun ~key:_ ~data:(ctx : Context.t) -> let ctx_dir = ctx.build_dir in Pset.iter all_non_target_source_files ~f:(fun path -> - let build = Build.copy ~src:path ~dst:(Path.append ctx_dir path) in - (* We temporarily allow overrides while setting up copy rules - from the source directory so that artifact that are already - present in the source directory are not re-computed. + let ctx_path = Path.append ctx_dir path in + if is_target t ctx_path && + String.is_suffix (Path.basename ctx_path) ~suffix:".install" then + (* Do not copy over .install files that are generated by a rule. *) + () + else + let build = Build.copy ~src:path ~dst:ctx_path in + (* We temporarily allow overrides while setting up copy rules + from the source directory so that artifact that are already + present in the source directory are not re-computed. - This allows to keep generated files in tarballs. Maybe we - should allow it on a case-by-case basis though. *) - compile_rule t (Pre_rule.make build) - ~all_targets_by_dir - ~allow_override:true)) + This allows to keep generated files in tarballs. Maybe we + should allow it on a case-by-case basis though. *) + compile_rule t (Pre_rule.make build) + ~all_targets_by_dir + ~allow_override:true)) let create ~file_tree ~rules = let all_source_files =