-
Notifications
You must be signed in to change notification settings - Fork 412
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
a wizard / quickstart a la oasis would be cool #159
a wizard / quickstart a la oasis would be cool #159
Comments
There is some work going on Ohai, a small tool to bootstrap ocaml/reason projects: https://github.com/jaredly/ohai It might complete/supersede a wizard in jbuilder. I guess it doesn't help with the switching use case for now, but it's only the beginning. |
https://github.com/dbuenzli/carcass is another general purpose alternative that can be used to solve this problem as well. I'd hesitate to introduce this bloat for this reason... |
maybe outputting the right carcass command or pointing users to it is the right way to do |
I hesitate to recommend carcass just yet as it's unreleased. If I really wanted templates for this stuff, I'd create something using http://yeoman.io/ There's a good starting template for applications/libraries https://github.com/mjambon/jbuilder-starter/ so perhaps someone can create a yeoman generator out of it? 😉 |
While this issue is important, it's outside the scope of a build system like jbuilder so I will close this. If someone does indeed create some templates using a project generator. I will include them in the manual. cc @hcarty as well who also maintains some jbuilder templates. |
Just wanted to check in on this, and confirm that it's still outside the scope of this build system. It is worth noting that many other venerable build systems include this functionality (including Haskell's stack, Rust's cargo. If this is still outside of the scope of jbuilder, is it because jbuilder is intended to be an under-the-hood tool, that should perhaps be wrapped with more user-friendly cli? Or for some other reason? |
I don't know if it's because of that, but I've heard rumors of such a thing yes. |
Jbuilder isn't completely analogus to cargo and rust. Those are package
managers in addition to build system.
…On Tue, Nov 21, 2017, 12:27 PM Shon Feder ***@***.***> wrote:
Just wanted to check in on this, and confirm that it's still outside the
scope of this build system. It is worth noting that many other venerable
build systems include this functionality (including Haskell's stack
<https://docs.haskellstack.org/en/stable/GUIDE/#stack-new>, Rust's cargo
<http://doc.crates.io/guide.html#creating-a-new-project>.
If this is still outside of the scope of jbuilder, is it because jbuilder
is intended to be an under-the-hood tool, that should perhaps be wrapped
with more user-friendly cli? Or for some other reason?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#159 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIe-3kiI-UuTqdciGH0ZDzn6kPZpJR7ks5s4lFIgaJpZM4ODPGG>
.
|
I'm wondering if we can reopen this in light of @rgrinberg comment on the discuss forum. I'd be happy to help with this effort, and even drive it, if I seems suitable for that purpose. (As I noted on the forum, I've made a tiny, dead-simple, but fully functioning tool that I've been using for personal projects here https://github.com/shonfeder/nomad .) |
You're right, I've indeed reconsidered my position regarding this topic. @shonfeder, I don't think the solution is going to be complicated, but I think we should do some upfront design first. Also, a pre-req for this working is going to be implementing Some other concerns that we need to discuss:
|
Regarding the pre-req: not sure you really need this if you go with an "append only" approach (see below) which I believe would be the nicest experience.
My justification for being append only is: it seems easier for user to then go and update the stanza if they need to than to remember which cmd line flag to pass for the stanza to be updated. It's also a lot less work for the person implementing the tool if they don't have to support updates. |
The append only restriction sounds fine to me.
Sure. Let's just make sure we don't do something that will make it more difficult than necessary to implement this feature. |
I do like the idea of having From a human laziness/machine correctness standpoint it could be nice to have commands like |
I think I see at least 3 distinct levels of feature-sets under discussion: Level 1:Simple project initialization with fixed, minimal default scaffoldingThis is equivalent to Rust's It is inflexible, but probably sufficient to drastically drop the learning curve for new users and significantly accelerate initialization even for experienced uses. With such a tool, beginners can get up and going with one command and a paragraph explaining where to add the name of libraries they want to use in their projects. An approximate example of what this might look like can be seen here: https://github.com/shonfeder/nomad/tree/master/templates (Of course, the implementation should use the dune templating engine rather than that adhoc approach.) Level 2:Project initialization parameterized around custom templates and user configsAt this level we can include features like specifying default library dependencies, pre-processors, and Level 3:Project management and updatingAt this level, we'll need to edit existing dune files. This seems to have at least two levels of complexity as well.
At this level we might also consider handling things like automated build system migration. iiuc, only level 3 has a I am happy to tackle this any way you all advise, but my natural inclination is to begin with implementing level 1, and add the additional levels incrementally. This will allows us to learn from the needs that arise from usage of the first level, and facilitate quicker turnaround of the initial feature addition. (I suspect that the 80/20 rule will favor level 1, and max out midway through level 2.) If we do start with realizing level 1, I believe the only immediate questions to answer are:
Speaking to (1), (again, following
I don't have any very solid ideas for (2), but keeping things loosely coupled and parameterized around the key data should help. If my suggestion to focus on level 1 sounds OK, I can start putting together a sketch. If not, I'm happy to take direction for a different approach (including working on |
I'm happy with level 1. But which I'd assume cover the following use cases:
As for |
That's a very helpful further analysis of the functionality, and it makes perfect sense given the way dune works. I'll dig in this week, and hope to have a draft up by next weekend. |
I agree that For dune devs, the plan for
module Augmented_sexp : sig
type t =
| Atom of string
| Quoted_string of string
| Template of Template.t
| List of t list
| Fields of (string * t list) list
| Constructor of string * t list
end
module Of_sexp : sig
val augmented_sexp : 'a t -> Sexp.t -> Augmented_sexp.t
end The type |
I've been thinking on this for sometime now and getting familiar with the code base. I have sketched out an approach, and would like to be sure it fits with the vision of the membership before I commit the time to an initial implementation. The main design dilemma I've been facing is whether the templates should be
So far, I've been leaning towards (2) and this sketch proposes an implementation along those lines. Please don't feel obligated to study the sketch in detail if it doesn't seem to tend in the right direction. My aim here is just to be sure I have the right orientation before I put together a pull request. Thanks in advance for the additional guidance! The CLI
Defining TemplatesPrinciples
Approach
ExampleThe template directory for a library project would look like this:
The first line of each of the
The latter "parts" would set out the templates used when adding the ConfigurationIt should be possible to specify default library, ppx, and testing |
Just checking in and giving an update: I've been a bit overwhelmed for the last couple weeks, but intend to redouble my efforts and push through the initial draft of this in the next week+. I have it in mind constantly, but recent discussion on discuss reminded me I should check in. Any feedback on my sketch above would be welcome, but I think I've worked out a relatively clear way forward in the absence of feedback any how. :) |
Doing what you think is easier seems preferable. It's just an implementation detail that we can later change. IMO, we should hold off on user definable templates for version 1 of this feature. It's not immediately obvious to me that there's demand for this, and it complicates the implementation a bunch. Your proposed CLI looks quite good, so I say you should go ahead with implementing this feature. |
I just want to issue a word of encouragement --- something like this would help me so much. I find it completely impenetrable to figure out how to set up a new project with dune and opam, and really need some tool to automate that. |
I'm bumping this way up my list of priorities. Will have updates in a few days. Thanks for the advice and encouragement, @rgrinberg and @jonsterling. |
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Towards completion of ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Now that The I propose I propose the following:
IMO, this is a really important feature, as it greatly lowers the bar to entry. It is arguably more important from the perspective of |
I do not see a need for a |
I feel quite strongly that that is not a nice way to move forward.
|
Perhaps we should solicit input from a wider audience, and in particular from quite new users to |
|
This helps clarify the basis for our disagreement, which seems mostly to lie in some different understandings.
Please also note that I am only trying to follow through with the CLI design which I proposed explicitly and in detail back in August at #159 (comment), and which you approved of in #159 (comment). I do not understand why two commands were acceptable at that time but suddenly seems too costly. |
CHANGES: - Warn when generated `.merlin` does not reflect the preprocessing specification. This occurs when multiple stanzas in the same directory use different preprocessing specifications. This warning can now be disabled with `allow_approx_merlin` (ocaml/dune#1947, fix ocaml/dune#1946, @rgrinberg) - Watch mode: display "Success" in green and "Had errors" in red (ocaml/dune#1956, @emillon) - Fix glob dependencies on installed directories (ocaml/dune#1965, @rgrinberg) - Add support for library variants and default implementations. (ocaml/dune#1900, @TheLortex) - Add experimental `$ dune init` command. This command is used to create or update project boilerplate. (ocaml/dune#1448, fixes ocaml/dune#159, @shonfeder) - Experimental Coq support (fix ocaml/dune#1466, @ejgallego) - Install .cmi files of private modules in a `.private` directory (ocaml/dune#1983, fix ocaml/dune#1973 @rgrinberg) - Fix `dune subst` attempting to substitute on directories. (ocaml/dune#2000, fix ocaml/dune#1997, @rgrinberg) - Do not list private modules in the generated index. (ocaml/dune#2009, fix ocaml/dune#2008, @rgrinberg) - Warn instead of failing if an opam file fails to parse. This opam file can still be used to define scope. (ocaml/dune#2023, @rgrinberg) - Do not crash if unable to read a directory when traversing to find root (ocaml/dune#2024, @rgrinberg) - Do not exit dune if some source directories are unreadable. Instead, warn the user that such directories need to be ignored (ocaml/dune#2004, fix ocaml/dune#310, @rgrinberg) - Fix nested `(binaries ..)` fields in the `env` stanza. Previously, parent `binaries` fields would be ignored, but instead they should be combined. (ocaml/dune#2029, @rgrinberg) - Allow "." in `c_names` and `cxx_names` (ocaml/dune#2036, fix ocaml/dune#2033, @rgrinberg)
Instead of thinking of dune components (stanzas?) and fields, how about we change the terminology to templates and parameters. It follows that
It's just a parameter to the project template, I don't see what relation it has to the other templates. |
Seems like we should reopen this issue, as the feature it requests isn't implemented. I'm afraid I don't see why we would want to generalize the CLI in a way that makes it indifferent to essential differences in the sole application domain of the utility, and I feel that many of my concerns haven't be addressed. However, I think the importance of having this tooling available for growing the ecosystem far outweighs my concerns over the elegance of the UI. So I'm willing to disagree and move forward here. I will implement the project creation following
With the exception of the CLI design, I'll proceed as described in #159 (comment), unless I hear otherwise. |
Satisfies ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
Satisfies ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
CHANGES: - Don't select all local implementations in `dune utop`. Instead, let the default implementation selection do its job. (ocaml/dune#2327, fixes ocaml/dune#2323, @TheLortex, review by @rgrinberg) - Check that selected implementations (either by variants or default implementations) are indeed implementations. (ocaml/dune#2328, @TheLortex, review by @rgrinberg) - Don't reserve the `Ppx` toplevel module name for ppx rewriters (ocaml/dune#2242, @diml) - Redesign of the library variant feature according to the ocaml/dune#2134 proposal. The set of variants is now computed when the virtual library is installed. Introducing a new `external_variant` stanza. (ocaml/dune#2169, fixes ocaml/dune#2134, @TheLortex, review by @diml) - Add proper line directives when copying `.cc` and `.cxx` sources (ocaml/dune#2275, @rgrinberg) - Fix error message for missing C++ sources. The `.cc` extension was always ignored before. (ocaml/dune#2275, @rgrinberg) - Add `$ dune init project` subcommand to create project boilerplate according to a common template. (ocaml/dune#2185, fixes ocaml/dune#159, @shonfeder) - Allow to run inline tests in javascript with nodejs (ocaml/dune#2266, @hhugo) - Build `ppx.exe` as compiling host binary. (ocaml/dune#2286, fixes ocaml/dune#2252, @toots, review by @rgrinberg and @diml) - Add a `cinaps` extension and stanza for better integration with the [cinaps tool](https://github.com/janestreet/cinaps) tool (ocaml/dune#2269, @diml) - Allow to embed build info in executables such as version and list and version of statically linked libraries (ocaml/dune#2224, @diml) - Set version in `META` and `dune-package` files to the one read from the vcs when no other version is available (ocaml/dune#2224, @diml) - Add a variable `%{target}` to be used in situations where the context requires at most one word, so `%{targets}` can be confusing; stdout redirections and "-o" arguments of various tools are the main use case; also, introduce a separate field `target` that must be used instead of `targets` in those situations. (ocaml/dune#2341, @aalekseyev) - Fix dependency graph of wrapped_compat modules. Previously, the dependency on the user written entry module was omitted. (ocaml/dune#2305, @rgrinberg) - Allow to promote executables built with an `executable` stanza (ocaml/dune#2379, @diml) - When instantiating an implementation with a variant, make sure it matches virtual library's list of known implementations. (ocaml/dune#2361, fixes ocaml/dune#2322, @TheLortex, review by @rgrinberg) - Add a variable `%{ignoring_promoted_rules}` that is `true` when `--ingore-promoted-rules` is passed on the command line and false otherwise (ocaml/dune#2382, @diml) - Fix a bug in `future_syntax` where the characters `@` and `&` were not distinguished in the names of binding operators (`let@` was the same as `let&`) (ocaml/dune#2376, @aalekseyev, @diml) - Workspaces with non unique project names are now supported. (ocaml/dune#2377, fix ocaml/dune#2325, @rgrinberg) - Improve opam generation to include the `dune` dependncies with the minimum constraint set based on the dune language version specified in the `dune-project` file. (2383, @avsm) - The order of fields in the generated opam file now follows order preferred in opam-lib. (@avsm, ocaml/dune#2380) - Fix coloring of error messages from the compiler (@diml, ocaml/dune#2384) - Add warning `66` to default set of warnings starting for dune projects with language verison >= `1.11` (@rgrinberg, @diml, fixes ocaml/dune#2299) - Add (dialect ...) stanza (@nojb, ocaml/dune#2404) - Add a `--context` argument to `dune install/uninstall` (@diml, ocaml/dune#2412) - Do not warn about merlin files pre 1.9. This warning can only be disabled in 1.9 (ocaml/dune#2421, fixes ocaml/dune#2399, @emillon)
Satisfies ocaml#159 Signed-off-by: Shon Feder <shon.feder@gmail.com>
CHANGES: - Don't select all local implementations in `dune utop`. Instead, let the default implementation selection do its job. (ocaml/dune#2327, fixes ocaml/dune#2323, @TheLortex, review by @rgrinberg) - Check that selected implementations (either by variants or default implementations) are indeed implementations. (ocaml/dune#2328, @TheLortex, review by @rgrinberg) - Don't reserve the `Ppx` toplevel module name for ppx rewriters (ocaml/dune#2242, @diml) - Redesign of the library variant feature according to the ocaml/dune#2134 proposal. The set of variants is now computed when the virtual library is installed. Introducing a new `external_variant` stanza. (ocaml/dune#2169, fixes ocaml/dune#2134, @TheLortex, review by @diml) - Add proper line directives when copying `.cc` and `.cxx` sources (ocaml/dune#2275, @rgrinberg) - Fix error message for missing C++ sources. The `.cc` extension was always ignored before. (ocaml/dune#2275, @rgrinberg) - Add `$ dune init project` subcommand to create project boilerplate according to a common template. (ocaml/dune#2185, fixes ocaml/dune#159, @shonfeder) - Allow to run inline tests in javascript with nodejs (ocaml/dune#2266, @hhugo) - Build `ppx.exe` as compiling host binary. (ocaml/dune#2286, fixes ocaml/dune#2252, @toots, review by @rgrinberg and @diml) - Add a `cinaps` extension and stanza for better integration with the [cinaps tool](https://github.com/janestreet/cinaps) tool (ocaml/dune#2269, @diml) - Allow to embed build info in executables such as version and list and version of statically linked libraries (ocaml/dune#2224, @diml) - Set version in `META` and `dune-package` files to the one read from the vcs when no other version is available (ocaml/dune#2224, @diml) - Add a variable `%{target}` to be used in situations where the context requires at most one word, so `%{targets}` can be confusing; stdout redirections and "-o" arguments of various tools are the main use case; also, introduce a separate field `target` that must be used instead of `targets` in those situations. (ocaml/dune#2341, @aalekseyev) - Fix dependency graph of wrapped_compat modules. Previously, the dependency on the user written entry module was omitted. (ocaml/dune#2305, @rgrinberg) - Allow to promote executables built with an `executable` stanza (ocaml/dune#2379, @diml) - When instantiating an implementation with a variant, make sure it matches virtual library's list of known implementations. (ocaml/dune#2361, fixes ocaml/dune#2322, @TheLortex, review by @rgrinberg) - Add a variable `%{ignoring_promoted_rules}` that is `true` when `--ingore-promoted-rules` is passed on the command line and false otherwise (ocaml/dune#2382, @diml) - Fix a bug in `future_syntax` where the characters `@` and `&` were not distinguished in the names of binding operators (`let@` was the same as `let&`) (ocaml/dune#2376, @aalekseyev, @diml) - Workspaces with non unique project names are now supported. (ocaml/dune#2377, fix ocaml/dune#2325, @rgrinberg) - Improve opam generation to include the `dune` dependncies with the minimum constraint set based on the dune language version specified in the `dune-project` file. (2383, @avsm) - The order of fields in the generated opam file now follows order preferred in opam-lib. (@avsm, ocaml/dune#2380) - Fix coloring of error messages from the compiler (@diml, ocaml/dune#2384) - Add warning `66` to default set of warnings starting for dune projects with language verison >= `1.11` (@rgrinberg, @diml, fixes ocaml/dune#2299) - Add (dialect ...) stanza (@nojb, ocaml/dune#2404) - Add a `--context` argument to `dune install/uninstall` (@diml, ocaml/dune#2412) - Do not warn about merlin files pre 1.9. This warning can only be disabled in 1.9 (ocaml/dune#2421, fixes ocaml/dune#2399, @emillon) - Add a new `inline_tests` field in the env stanza to control inline_tests framework with a variable (ocaml/dune#2313, @mlasson, original idea by @diml, review by @rgrinberg). - New binary kind `js` for executables in order to explicitly enable Javascript targets, and a switch `(explicit_js_mode)` to require this mode in order to declare JS targets corresponding to executables. (ocaml/dune#1941, @nojb)
yes, I'm lazy. ;)
But seriously, it helps newcomers to get started. It lowers the entry barrier to switching to jbuilder
existing projects.
The text was updated successfully, but these errors were encountered: