Build and build. What are the differences and when to use?

In some IDE's there are 2 options to generate an executable file: compile and perform a build. Both generate a new executable File from the source code, ready to run.
What is the difference between the 2 processes?
When to build and when to build a project?

Author: Caffé, 2014-11-03

2 answers

Difference between compile and build

In Delphi, IDEs treat compile as a partial build, and build as a full rebuild of your application or package or dll. Example:

You changed some source code files and:

A) invoked a compile - only changed files will be recompiled.

B) invoked a build - all files will be the dependencies will be validated and readjusted in the generated assembly (executable or package or dll or ocx or...).

When to use one and when to use another?

In Delphi, use compile to immediately debug or test newly changed code - it's faster than build. Always use build before final testing and before distributing your library or executable in order to reflect in your code the atlerations that have been made on dependencies, such as packages (.bpl) or units (.dcu).

 6
Author: Caffé, 2020-06-11 14:45:34

I will steal an answer to a similar question asked in the OS. The question was specific about Java but I think that goes for other platforms and languages.

The build process involves several steps required to generate a "deliverable" version of your software. In the Java world, this usually includes:

  • source generation (sometimes).
  • compilation of sources.
  • compilation of test sources.
  • execution of tests (unit tests, integration tests, etc.).
  • packaging (in jar, war, ejb-jar, ear).
  • "health"/performance checks (Checkstyle, Findbugs, PMD, test coverage, etc).
  • report generation.

I changed the answer a bit - I'm making a version that's my interpretation here. But the key point is that compiling is the process of turning source code text into some other form than the computer can process (machine language, bytecoce etc.). The compilation itself is only one part of the construction process , which involves not only translating the code but also linking the parts and all the other processes necessary for the compiled code to be used.

Source: Building vs. Compiling (Java)

Takes advantage and gives a read in the link at the end of the Pascal answer, about continuous integration;) when using IC, it is common if we talk about unstable builds and stable builds. For those who work with it, the distinction between compiling and having a build becomes clearer. Compile, the code will always compile which is a beauty (if there are no syntax errors). Already having a stable build is another thing.

See also this other answer: What is the difference between compile code and executable code?

Compiling is the act of transforming code source in Object Code (my note: I've never seen this expression before, "Object Code").
Linking it is the act of combining the computed code and the libraries used in a "raw"executable.
Building it is the sequence consisting of the compilation and the linking, and other possible tasks such as creating an installer.

 -1
Author: Garoto de Programa, 2017-05-23 12:37:23