This is a short introduction into building applications like Visual Studio solutions, Gradle/Ant/Maven- or Makefile projects.
What does building mean in general?
Transfering your project from one state to another. This means for example one takes the source files and derives binaries from them or creating a pdf documentation from the contained markdown files. Thus build steps for a project can have a lot of functionality. Not only compiling the source code but also executing tests, packaging the software and so on.
How do I do it?
You run one or many applications. The following list gives a short overview over a few types and where to download them.
- javac – compiles Java source files into Java classes.
- dotnet – does the same for C# source files and much more. This can also build whole solutions.
- msbuild – the older sibling of the
dotnet
command. Builds solution files usually generated by Visual Studio. Can be downloaded separately with the “Build Tools” package. - csc – The C# compiler. msbuild and dotnet include project building functionality whereas “csc” is only the command to compile C# source code files into executables.
- gcc – Compiles C source files.
- gradle – builds a project based on a
build.gradle
definition. - ant – builds a project based on a
build.xml
file. - maven – builds a project based on a
pom.xml
file. - make – Reads the
Makefile
in a directory and carries out the commands specified in it. - npm – handles NodeJS applications.
- Composer – used for PHP frameworks like Symfony and Laravel.
- …
As you can see, there are many tools for compiling, building, packaging and executing tasks in the field of software development. What I want to say with this is:
Each action available in an IDE (like Visual Studio, Eclipse, VSCode, Netbeans, IntelliJ, …) is normally also available on the command line and can thus be scripted and executed on a remote system by checking out the repository and executing the necessary commands in the directory.
Why should I script it? I can just run it on my computer in the IDE.
And you are going to ship your computer to the customer or what?
DevOps is basically a summary of processes that handles the different stages of a project like compiling, testing, packaging, generating the documentation, deploying, archiving, etc. These process steps are defined in the project configuration files mentioned above and the tools do that for you. Based on the current setup more or less successful. If msbuild, java or gcc is not available on the system, how should project be compiled then? That’s called prerequisites and they have to be fulfilled.
One good practice is to define a environment for the build script where the tools are defined in the variable PATH to make them generally available. Another would be to define them in the global PATH environment but then there is a chance that they might interfere with other tools on the machine. For example the ESP32 environment also uses a version of gcc
but this one is not compatible with the the version that can generate 64bit Windows executables. Thus it makes sense to define the required tools only in the environment they are used in and not globally.