Skip to content

Commit

Permalink
rename only_sources to sources
Browse files Browse the repository at this point in the history
Signed-off-by: Javier Chávarri <[email protected]>
  • Loading branch information
jchavarri committed Jan 26, 2024
1 parent 6166c80 commit dd2bd16
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc/changes/9827.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- add `only_sources` field to `copy_files` stanza (#9827, fixes #9709,
- add `sources` field to `copy_files` stanza (#9827, fixes #9709,
@jchavarri)
2 changes: 1 addition & 1 deletion doc/stanzas/copy_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ details.
- ``(enabled_if <blang expression>)`` conditionally disables this stanza. The
condition is specified using the :doc:`reference/boolean-language`.

- ``(only_sources)`` specifies that the glob in ``files`` gets applied over the
- ``(sources)`` specifies that the glob in ``files`` gets applied over the
source tree, and not the build tree.

The short form:
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/simple_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ let copy_files sctx ~dir ~expander ~src_dir (def : Copy_files.t) =
];
(* add rules *)
let* files =
let dir = if def.only_sources then src_in_src else src_in_build in
let dir = if def.sources then src_in_src else src_in_build in
Build_system.eval_pred (File_selector.of_glob ~dir glob)
in
(* CR-someday amokhov: We currently traverse the set [files] twice: first, to
Expand Down
10 changes: 5 additions & 5 deletions src/dune_rules/stanzas/copy_files.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type t =
; mode : Rule.Mode.t
; enabled_if : Blang.t
; files : String_with_vars.t
; only_sources : bool
; sources : bool
; syntax_version : Dune_lang.Syntax.Version.t
}

Expand All @@ -23,15 +23,15 @@ let long_form =
and+ mode = field "mode" ~default:Rule.Mode.Standard (check >>> Rule_mode_decoder.decode)
and+ enabled_if = Enabled_if.decode ~allowed_vars:Any ~since:(Some (2, 8)) ()
and+ files = field "files" (check >>> String_with_vars.decode)
and+ only_sources =
field_b "only_sources" ~check:(Dune_lang.Syntax.since Stanza.syntax (3, 14))
and+ sources =
field_b "sources" ~check:(Dune_lang.Syntax.since Stanza.syntax (3, 14))
and+ syntax_version = Dune_lang.Syntax.get_exn Stanza.syntax in
{ add_line_directive = false
; alias
; mode
; enabled_if
; files
; only_sources
; sources
; syntax_version
}
;;
Expand All @@ -48,7 +48,7 @@ let decode =
; mode = Standard
; enabled_if = Blang.true_
; files
; only_sources = false
; sources = false
; syntax_version
}
;;
2 changes: 1 addition & 1 deletion src/dune_rules/stanzas/copy_files.mli
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type t =
; mode : Rule.Mode.t
; enabled_if : Blang.t
; files : String_with_vars.t
; only_sources : bool
; sources : bool
; syntax_version : Dune_lang.Syntax.Version.t
}

Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/copy_files/test6.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Show that copy_files operates on the build folder
$ dune build target/in-source.txt
$ dune build target/in-build.txt

Show the difference when `only_sources` is used
Show the difference when `sources` is used

$ cat >target/dune <<EOF
> (copy_files
> (only_sources true)
> (sources true)
> (files ../foo/*.txt))
> EOF

Expand Down

0 comments on commit dd2bd16

Please sign in to comment.