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

Asked

Viewed 4,192 times

4

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

  • 1

    Dude I think the two are the same thing. ?

  • 1

    Some Ides use the term Compile to describe the recompilation only of what was changed and the term build to describe the recompilation of the entire project and eventually the reconstruction of the distribution package. There are languages where you first have to compile and then generate the executable, and the two terms can describe these two steps. You have to specify what environment you’re talking about.

  • I added the "Delphi" tag to your question because it was inconsistent, and may attract answers that explain conceptual differences between "build" and "Compile" but which may not answer your specific question, which is not only conceptual but involves a specific IDE. Despite the evidence that it is Delphi, if not, edit your question.

2 answers

6

Difference between Compile and Build

In Delphi, Ides treat the Compile as a partial compilation, and build as a full reconstruction of your application or package or dll. Example:

You have changed some source files and:

to) Invoked a Compile - only the changed files will be recompiled.

b) Invoked a build - all files will be recompiled and 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 the newly modified code - it’s faster than build. Always use build before the final tests and before distributing your library or executable in order to reflect in your code the athletics that have been made in the dependencies, as Packages (.bpl) or Units (.dcu).

  • +1, this is the most correct answer according to Delphi IDE documentation

-1

I’m going to steal an answer to a similar question asked in the O.R. The question was specific about Java but I think this applies to other platforms and languages.

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

  • Generation of sources (sometimes).
  • Compilation of sources.
  • Compilation of test sources.
  • Testing (unit tests, integration tests, etc).
  • Packaging (in jar, war, ejb-jar, ear).
  • "Health"/performance checks (Checkstyle, Findbugs, PMD, Coverage test, etc).
  • Reporting.

I changed the answer a little bit - I’m doing a version that’s my interpretation here. But the key point is that compile is the process of transforming source code text into some other form that the computer can process (machine language, bytecoce etc.). The compilation itself is only part of the building, which involves not only the translation of the code but also the linking of the parties and all other processes necessary for the compiled code to be used.

Source: Building vs. Compiling (Java)

Take a look at the link at the end of Pascal’s reply, about continuous integration ;) When using IC, it is common to talk about unstable builds and stable build. For those who work with this, 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 something else.

See also this other answer: What is the Difference between Compile code and Executable code?

Compile is the act of transforming source code into object code (my note: I’ve never seen this expression before, "object code").
Linking is the act of combining the computed code and the libraries used in a "raw executable".
Building is the sequence composed by the compilation and the linking, and other possible tasks such as creating an installer.

  • 2

    "Object code" in Clipper is (or was) a very common expression. Even compiled files received the extension .obj. Was equivalent to .dcu Delphi. Since AP says that both "compilation" and "build" generate an "executable file", it is unlikely that it is talking about Java. I think it’s more likely he’s talking about Delphi. In this case, the difference is to compile only what has changed (Compile) or recompile everything validating including dependencies (build). It is difficult to give a good answer before the manifestation of the PA about what is the environment in question.

  • -1 Compilation and Build in Delphi are different from java, it does not apply in this case, as Compile and build perform all the steps of constructing an executable (compilation, linkage and construction), the only difference is as stated by @Caffe, Compile recompiles only modified files and build recompiles all files.

  • 2

    @Eprogrammernotfound This reply was posted before me edit the question by adding the Delphi tag.

  • @Caffé Ok, it should then be removed, because it no longer meets the requirements of the question. From the user’s question history it is clear that this is only Delphi IDE

  • Just to contribute to the answer. "Object Code" in copiers is a representation of a code written in a high-level language that has gone through all the compilation steps (lexical analysis, syntactic analysis, semantic analysis, intermediate code generation, code optimization and code generation). The object code can be represented by a symbolic language (Assembly), machine language or any other representation. Object code is the result of the build process.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.