janklab / MatlabProjectTemplate

A template for creating repos for Matlab library and application projects
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

Add support for new Matlab Build Tool #31

Open acampbel opened 1 year ago

acampbel commented 1 year ago

22b included a basic build tool/task runner. 23a expanded on that to leverage incremental build. much more development ongoing.

I think it would strengthen this project to leverage the matlab build tool:

https://www.mathworks.com/help/matlab/matlab_prog/overview-of-matlab-build-tool.html

acampbel commented 1 year ago

also may benefit from using matlab projects if this has not already been considered

apjanke commented 1 year ago

Oh heck yeah. This is definitely the sort of thing I would like to support and interact with here.

I'm not sure if, or how, I can adopt it yet here: MatlabProjectTemplate intends to support older versions of Matlab, like back to R2019b or even R2016b as of right now (2023-05-01). Because lots of Matlab users (including myself) are stuck on or still targeting older versions of Matlab. Both MathWorks and a lot of their users are conservative in this manner. Adopting this Matlab Build Tool would make things easier and maybe more powerful, but to retain support for older versions, I'd need to split the control flow and conditionalize stuff, so that in older versions it used the old stuff, and in newer versions it used Matlab Build Tool.

But that said, I'm very likely to want to do that, both because it would be useful, and I want to get some experience playing around with Build Tool.

I've taken an extensive look at Matlab Projects, and while its name sounds like what we'd want for this, my opinion is that Matlab Projects are not suitable for use here. MatlabProjectTemplate's goal is to be a structure for the definition of redistributable Matlab-based software projects, particularly code libraries, which are reusable by taking dependencies or "vendoring" in to other projects, and have multiple developers in possibly different organizations working on them. Their main goal is producing and publishing software code and artifacts. From what I can tell, Matlab Projects are for something else: they're aimed at collaboration amongst people in a single organization, working more on data analysis projects than software development projects, and are as much about managing data collections and analysis tasks as they are about source code. This could be a whole blog post or hour-long discussion, but I think Matlab Projects are fundamentally unsuited for what MatlabProjectTemplate is trying to do here. Not that Matlab Projects are bad! Just that they have different use cases and contexts and goals; and it's unfortunate that the term "project" is ambiguous or "overloaded" here.

apjanke commented 1 year ago

(Oh, and yes: the incremental-build thing you specifically mention is a major appeal of this new build tool. In some of my own projects, including paying-day-job work, the compile-time improvement from incremental builds would totally justify the work to add support for Build Tool here, even if it meant maintaining two different code paths indefinitely. The build for my work code base is pushing an hour now, and some of my hobby and side code bases could use a build speedup too.)

acampbel commented 1 year ago

sounds great! even if you have your build scripts “separately organized” so that it works reasonably well pre-buildtool and then leveraged the buildtool to kick out to the other build scripts you’d still get the benefits of a standard interface, incr build and other coming enhancements. also, we would definitely appreciate feedback. feel free to provide feedback and/or pose questions. There are some benefits to early adopters :-)