Sublime Forum

Is it possible to make a build system that will only work if the file is changed?

#1

How to do this if it is possible?

0 Likes

#2

Technically a build system can do anything you want; there is a target key you can provide to point it at a custom Python plugin command that drives the build, and that can do more or less anything you want. Doing so may be non-trivial for something like this though, since it would need some way to know whether a file has been changed or not.

As a flip on that request, what situation are you running into where you don’t want the build to do anything if the file hasn’t been modified?

0 Likes

#3

I was thinking that if we can do everything in Sublime Text that IDEs can. And in IDEs, I noticed that when I want to build a file that is not changed, the output says that nothing to change. That’s why I asked this question.

0 Likes

#4

That’s generally the purview of build management tools, many of which are either built into an IDE or which the IDE uses automatically for you.

For example, if working with C, gcc is the tool you use to compile your program; this always compiles whatever you tell it to. However, if you use a tool like make to manage your build, then make does the appropriate checks to see what it needs to do, which could be nothing.

Something similar would also be possible in Sublime with a custom build target, but it would be specialized to some degree in that it would need to know what input files produce what results so that it could tell if something needs to happen or not. On the other hand, telling Sublime to execute such a tool directly is probably much easier.

1 Like