-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #985 #1188
Fix #985 #1188
Conversation
I'm not sure that it's a good idea to use dates here. Some library authors might want to use a version number, or just a generic "some day". What do you think about making this a generic deprecation message, like |
The idea of the date was to remind the developer of the library using the transition mode to get rid of it after the given date. Though maybe that's not really the job of dune to do that. Taking the deprecation message as argument seems good. |
Ah, that's annoying. Misplaced attributes are silently ignored by the compiler so I don't know if it's supported at all in this position. Need to look in the compiler code to see what we can do. |
The |
src/dune_file.ml
Outdated
| Yes_with_transition of string | ||
|
||
let dparse = | ||
if_list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use sum
directly here:
sum ["true", return (Simple true)
...
src/lib_rules.ml
Outdated
); | ||
let dep_graphs = | ||
Ocamldep.Dep_graphs.deprecated ~modules ~deprecated in | ||
let cctx = Compilation_context.set_modules cctx deprecated in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use a dedicated compilation context here, i.e. with preprocessing, special flags, libraries, etc... Since these modules are under our control, we know exactly how they should be compiled. It should be similar to the one for the alias module
src/module.ml
Outdated
intf = None | ||
; impl = | ||
Some ( | ||
let impl = Option.value_exn t.impl in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if we use (wrapped (transition ""))
with (modules_without_implementation x)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I fixed this and added a test case.
src/dir_contents.ml
Outdated
@@ -176,25 +177,32 @@ end = struct | |||
{ modules : Module.t Module.Name.Map.t | |||
; alias_module : Module.t option | |||
; main_module_name : Module.Name.t | |||
; deprecated : Module.t Module.Name.Map.t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure deprecated
is the right name. What about unwrapped_compat
?
0417a69
to
74fe613
Compare
I've tried this PR with https://github.com/ocsigen/js_of_ocaml/tree/transition and got the following error message:
note that |
@hhugo could you try the latest commit? |
This doesn't work. I think it fail trying to build cmis for deprecated module. |
src/module.mli
Outdated
|
||
val to_sexp : t Sexp.To_sexp.t | ||
|
||
val deprecate : t -> t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be renamed to wrapped_compat
as well
@hhugo I tried your branch and it works now |
5942ea3
to
f8b2fbb
Compare
@diml addressed your comment and added docs/change log entry. |
f8b2fbb
to
96ef07a
Compare
Fixed the tests. I think this is ready. |
src/lib_rules.ml
Outdated
@@ -377,12 +413,16 @@ module Gen (P : Install_rules.Params) = struct | |||
else | |||
acc) | |||
in | |||
let deprecated_modules = Module.Name.Map.values wrapped_compat in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be consistent, let's use the wrapped_compat
terminology here as well. This will make it easier to understand this code in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was just an omission. I fixed this.
src/lib_rules.ml
Outdated
@@ -377,12 +413,16 @@ module Gen (P : Install_rules.Params) = struct | |||
else | |||
acc) | |||
in | |||
let deprecated_modules = Module.Name.Map.values wrapped_compat in | |||
(* deprecated modules have implementations so we can just append them *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comments is not clear to me. The reason is: nothing depends on compatibility modules and compatibility modules depends only on real modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, my comment referred to the earlier line where we filter only the modules which have implementations. You're right that I should comment about the order as well.
c82cbaf
to
74264e7
Compare
src/module.ml
Outdated
let (base, _) = Path.split_extension path in | ||
{ syntax = OCaml | ||
; path = Path.extend_basename base ~suffix:".ml-gen" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code does the same thing:
{ syntax = OCaml
; path = Path.L.relative (dir t) [ ".wrapped_compat"; Name.to_string t.name ^ ".ml-gen" ]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it is. Fixed.
BTW, I'm not sure |
Yeah, |
Btw, I added 1.2 as the minimum version of the dune language for this feature |
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Somehow this removes the deprecation Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
deprecated modules don't really have interfaces Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
08b0afb
to
3c89b6c
Compare
Thanks |
When do you expect the next release of dune ? |
I expect to make a release once polling mode is merged. |
CHANGES: - Ignore stderr output when trying to find out the number of jobs available (ocaml/dune#1118, fix ocaml/dune#1116, @diml) - Fix error message when the source directory of `copy_files` does not exist. (ocaml/dune#1120, fix ocaml/dune#1099, @emillon) - Highlight error locations in error messages (ocaml/dune#1121, @emillon) - Display actual stanza when package is ambiguous (ocaml/dune#1126, fix ocaml/dune#1123, @emillon) - Add `dune unstable-fmt` to format `dune` files. The interface and syntax are still subject to change, so use with caution. (ocaml/dune#1130, fix ocaml/dune#940, @emillon) - Improve error message for `dune utop` without a library name (ocaml/dune#1154, fix ocaml/dune#1149, @emillon) - Fix parsing `ocamllex` stanza in jbuild files (ocaml/dune#1150, @rgrinberg) - Highlight multi-line errors (ocaml/dune#1131, @anuragsoni) - Do no try to generate shared libraries when this is not supported by the OS (ocaml/dune#1165, fix ocaml/dune#1051, @diml) - Fix `Flags.write_{sexp,lines}` in configurator by avoiding the use of `Stdune.Path` (ocaml/dune#1175, fix ocaml/dune#1161, @rgrinberg) - Add support for `findlib.dynload`: when linking an executable using `findlib.dynload`, automatically record linked in libraries and findlib predicates (ocaml/dune#1172, @bobot) - Add support for promoting a selected list of files (ocaml/dune#1192, @diml) - Add an emacs mode providing helpers to promote correction files (ocaml/dune#1192, @diml) - Improve message suggesting to remove parentheses (ocaml/dune#1196, fix ocaml/dune#1173, @emillon) - Add `(wrapped (transition "..message.."))` as an option that will generate wrapped modules but keep unwrapped modules with a deprecation message to preserve compatibility. (ocaml/dune#1188, fix ocaml/dune#985, @rgrinberg) - Fix the flags passed to the ppx rewriter when using `staged_pps` (ocaml/dune#1218, @diml) - Add `(env var)` to add a dependency to an environment variable. (ocaml/dune#1186, @emillon) - Add a simple version of a polling mode: `dune build -w` keeps running and restarts the build when something change on the filesystem (ocaml/dune#1140, @kodek16) - Cleanup the way we detect the library search path. We no longer call `opam config var lib` in the default build context (ocaml/dune#1226, @diml) - Make test stanzas honor the -p flag. (ocaml/dune#1236, fix ocaml/dune#1231, @emillon) - Test stanzas take an optional (action) field to customize how they run (ocaml/dune#1248, ocaml/dune#1195, @emillon) - Add support for private modules via the `private_modules` field (ocaml/dune#1241, fix ocaml/dune#427, @rgrinberg) - Add support for passing arguments to the OCaml compiler via a response file when the list of arguments is too long (ocaml/dune#1256, @diml) - Do not print diffs by default when running inside dune (ocaml/dune#1260, @diml) - Interpret `$ dune build dir` as building the default alias in `dir`. (ocaml/dune#1259, @rgrinberg) - Make the `dynlink` library available without findlib installed (ocaml/dune#1270, fix ocaml/dune#1264, @rgrinberg)
Add a transition mode to wrapped modules. This will add aliases to the unprefixed names with a deprecation message as in #985.
For some reason, I can't see the deprecation message in the test. @diml any idea why?