unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mohsin Kaleem <mohkale@kisara.moe>
To: Ergus <spacibba@aol.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Project out of sources compilation
Date: Tue, 23 Apr 2024 20:26:59 +0100	[thread overview]
Message-ID: <87mspjx4l8.fsf@kisara.moe> (raw)
In-Reply-To: <4e5bg4tmzu3pl334wiw5fei5s5uxbqnnoio3avqou5sde3dodk@3bewafrmdzus>

Ergus <spacibba@aol.com> writes:

> I'll give it a look. I am aware of cmake presets, but we don't even
> support cmake or out of sources compilation yet, so I tink that
> supporting the most basic cmake setup will be already a step forward.

We being the projects you work on? My suggestion was more for automating
how you set build configurations. Supporting that in Emacs is separate
but still useful. It's just which directory you configure to and build
in is yet another part of this instead of some custom thing only Emacs
understands.

> Yes, that's actually the current approach in my POC code. after some
> fight with rust projects. However, the difference on moving or not is so
> simple that it doesn't even represent a difficulty.

Just moving is easy, but a interface for that that isn't confusing would
probably be a lot harder. For example you can switch to a compilation
buffer and run cd and recompile and that should work. But it's much
easier to just see the command containing the non-common directory it
needs to run in.

> This implies removing many of the features project.el already has
> (project-compile, project-eshell, project-compile-buffer-name-function)
> + somehow create another level of abstraction over project.el...

I think we probably should. There's a lot of builtin Emacs functionality
which is just duplicating standard things in subtly different ways.
project-other-{window,tab}* for example. Embark at least supercedes this
IMO because it generalises the selection backend from the end user
action. In this case project-compile, project-eshell, etc. If this was
being done today I'd probably just define a 'project-run-from-root'
helper and let the end users alias it to a command if they think its
useful. Like so:

  (defalias 'project-compile! (project-run-from-root #'compile))

But I digress.

> The initial basic commands (config, build, test/run) seems to be common,
> even in python projects it usually needs to get dependencies, create
> virtualenvs and so on. However if a project does not support a build
> command a simple message can solve it easily.

I agree, but my point was this doesn't really align with anything else
project.el does atm. Listing files for a project is orthoganal to which
"configure command" makes sense for whatever kind of project this looks
like. And necessarily multiple configure commands may make sense at once.

> FWIK every directory may have a CMakeLists.txt, but they need to have a
> project() entry to be considered a project's CMake. The search is
> actually unavoidable and the regex check actually solves the race
> conditions.
>
> I know that the search is not efficient, but with a couple of
> optimizations if works very well even with tramp.

This aligns with what I know but also that a encompassing CMake with a
project can depend on a sub-directories CMake with a project. So if you
just configure and build the parent project it'll configure and build
all sub-projects. I'm not sure when you'd not want to do this, if the
projects have overlapping targets perhaps... but at that point you
should probably just move them to independent projects because their
already that.

> Nested projects is something very common these days and supporting them
> in project.el is part of another parallel discussion going on already
> (very slowly btw).

I have yet to encounter any so I'll assume you're right :-).

> More or less the same idea; I use with plist. I think they a bit
> simpler, but the same underground. I tend to avoid eioio because I have
> heard some performance complains (don't know if they are justified) but
> also because plists are somehow more flexible in some aspects.

I haven't noticed any performance issues at least in my limited usage of them.

> Actually I am not trying to do anything so fancy. We cannot go from 0 to
> 100 in a single pass. If we start 1. recognizing projects backends and
> giving a better compile-command for them in the right place and to the
> right build-dir is a good step forward compared to what we have. Then we
> talk about test and finally we can consider the generate one.

You should probably keep in mind sometimes there's a feed forward
mechanism in these things. CMake for example requires you to setup a
file prior to configuring if you want to introspect about the build
configuration and available targets. It might help to keep this in mind,
in my case I had to add a hook mechanism for all of these commands after
the fact to generate and keep this file in sync.

[1]: https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html

> At the moment project.el only handles one backend at the time. I made a
> simple workaround to extend it a bit, but that is a bit tricky and at
> this point simplicity matters. Otherwise we end up with an inefficient
> and complex interface easy to break and hard to make it work.

This is probably another reason this should be orthogonal to project.el.
The project backend is something well defined like a git repo. The
project type backend is whatever arbitrary marker communicates what the
project type is.

-- 
Mohsin Kaleem



  reply	other threads:[~2024-04-23 19:26 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4wwljrdnra3bsloehioa46y24ozxajajmvf2elvskxxq3mhtg2.ref@pyv2z5snot6h>
2024-03-16 13:12 ` Project out of sources compilation Ergus
2024-03-16 16:50   ` Konstantin Kharlamov
2024-03-16 19:00     ` Ergus
2024-03-16 20:56       ` Konstantin Kharlamov
2024-03-17  2:53   ` Dmitry Gutov
2024-03-17  7:22     ` Ergus
2024-03-17  8:45       ` Eli Zaretskii
2024-03-17 17:33         ` Ergus
2024-03-17 17:38           ` Eli Zaretskii
2024-03-17 17:58             ` Ergus
2024-03-17 11:36   ` Augusto Stoffel
2024-03-17 17:47     ` Ergus
2024-03-19 18:36       ` Ergus
2024-03-27 16:38         ` [PATCH] " Ergus
2024-03-31  2:41           ` Dmitry Gutov
2024-03-31 21:07             ` Ergus
2024-04-01  7:49               ` Dirk-Jan C. Binnema
2024-04-01 13:52                 ` Ergus
2024-04-01 15:09                   ` Dirk-Jan C. Binnema
2024-04-01 17:18                     ` Ergus
2024-04-02 23:23                   ` Dmitry Gutov
2024-04-03 19:47                     ` Ergus
2024-04-06  2:05                     ` Ergus
2024-04-14  1:44                       ` Dmitry Gutov
2024-04-16 14:56                         ` Ergus
2024-04-22 17:05                         ` Ergus
2024-04-22 18:48                           ` Ergus
2024-04-22 21:20                             ` Mohsin Kaleem
2024-04-23 15:17                               ` Ergus
2024-04-23 19:26                                 ` Mohsin Kaleem [this message]
2024-04-26  0:47                               ` Dmitry Gutov
2024-04-02 21:39               ` Richard Stallman
2024-04-02 22:43                 ` Dr. Arne Babenhauserheide
2024-04-05 21:40                   ` Richard Stallman
2024-04-03 10:40                 ` Konstantin Kharlamov
2024-04-03 11:45                   ` Eli Zaretskii
2024-04-03 13:31                     ` Konstantin Kharlamov
2024-04-03 14:11                       ` Eli Zaretskii
2024-04-03 15:00                         ` Konstantin Kharlamov
2024-04-03 15:47                           ` Eli Zaretskii
2024-04-03 17:27                             ` Konstantin Kharlamov
2024-04-03 18:22                               ` Eli Zaretskii
2024-04-03 19:08                                 ` Konstantin Kharlamov
2024-04-03 20:12                                   ` Ergus
2024-04-04  5:26                                     ` Eli Zaretskii
2024-04-04  9:59                                       ` Ergus
2024-04-04 11:59                                         ` Eli Zaretskii
2024-04-04 12:34                                           ` Ergus
2024-04-04 13:02                                             ` Eli Zaretskii
2024-04-04 14:27                                               ` Ergus
2024-04-04 14:41                                                 ` Eli Zaretskii
2024-04-04 18:15                                                   ` Ergus
2024-04-04 18:56                                                     ` Eli Zaretskii
2024-04-04 20:16                                                   ` Konstantin Kharlamov
2024-04-05  5:11                                                     ` Eli Zaretskii
2024-04-04  5:07                                   ` Eli Zaretskii
     [not found]                               ` <87jzlefgi9.fsf@dick>
2024-04-03 18:44                                 ` Konstantin Kharlamov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mspjx4l8.fsf@kisara.moe \
    --to=mohkale@kisara.moe \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).