If I understand you correctly, Sublime Text won’t do what you need out of the box. There is no default way of excluding files in build systems. But perhaps you can setup your build system so that your compiler doesn’t rebuild certain files, but that’s a job extraneous to Sublime Text. Sublime Text, in the build-system file will merely turn on switches and options in your compiler. You compiler does the job, not Sublime Text.
Alternatively, you can wrap the build system (to reiterate, a build system is just configuration data for your compiler or any other similar thing that has options) and do the filtering of files yourself. For that, you need to create a plugin, use “target” in the build system, examine the options passed to you from the build system, preprocess files, and forward the desired options to the compiler.
Key concepts:
- exec (Python command in Packages/Default) - this one does the heavy lifting for build-systems; essentially it’s a subprocess call
- build-system dict (what you write in a build-system file is passed as args to exec)
- target element in build-system files (lets you replace “exec” as final command to execute with the build-system dict) - here you can do pre- and post-processing as needed. This option’s value would be a plugin in Sublime.
Sublime Text is all about customization, so there’s yet another way you can do this: you just create a shell script (or Python, Perl, C++… program) that does exactly what you want and specify its name in the build-system file (no target here). exec will then forward the options specified in the build-system file to your own build program.
Example:
{
"cmd": "my_script_that_locks_the_main_file.sh", "-foo", "-bar", "-K", "$file"]
}
You can read up on build systems here:
sublimetext.info/docs/en/core/build_systems.html
Hope that helps!