4D Blog

Home Product Launch a compilation by programming

Launch a compilation by programming

May 4, 2021

Product

In continuous integration systems, every time code is submitted, or on an hourly basis, a compilation of the source code is automatically launched. This approach allows you to check merges on the code management server.

Starting from 4D v19, a new command allows you to launch code compilation, so you can set up this type of system.

Launch a compilation by programming

What is continuous integration?

Continuous integration consists in checking, each time source code is modified, that the result of the modifications does not produce regressions in the developed application. The main goal is to detect integration problems as early as possible during development.

New command

The new command Compile Project allows to compile:

  • the current project
  • a project other than the current project

 

If the compilation is successful, the command returns a status object with a success property. Otherwise, it returns a status object with a list of errors.

Compile THE current project

Compiling the current project with the default settings is very simple:

var $status : Object
$status:=Compile project() 

 

You can also override the compilation options by passing an object with the new values. Here are the options you can override:

  • compilation target
  • type inference
  • default type for numerics or buttons
  • generate symbols
  • generate typing methods
  • components to use in the compilation

 

For example, every time code is submitted on the source control server, you can launch a simple syntax check to verify the merged code.

var $options; $status : Object
$options:=New object()
$options.targets:=New collection()
$status:=Compile project($options)

 

If your application uses components, you’ll need to pass the list of compiled components in the options object.

var $options; $status : Object
var $component : 4D.File
$options:=New object()
$options.components:=Folder("/PACKAGE/Components").files(fk recursive).query("extension = .4dz")
$status:=Compile project($options) 

Compile another project

It’s possible to compile an application from another project. Just pass the project file to the command:

var $file : 4D.File
$file:=Folder(fk documents folder).file("Databases/myApp/Project/myApp.4DProject")
$status:=Compile project($file)

Compilation error management

The command returns a status object that tells you whether the compilation is successful or not. If the compilation fails, 4D returns the collection of error messages, the implicated methods, and the line number of the error.

Then, thanks to the new parameter of the METHOD OPEN PATH command, you can open the method in the code editor and place the cursor on the error line.

For example, it’s possible to display the error collection in a list box and then add a button that opens the method of the error selected in the list:

METHOD OPEN PATH(Form.selected.code.path;Form.selected.line)

Stay tuned! We have more blog posts on continuous integration coming up!

Discuss

Tags CI/CD, Compiler, v19

Latest related posts

  • November 14, 2025

    Event Report in 4D Qodly Pro: See Every Interactions at a Glance

  • November 14, 2025

    4D Qodly Pro: Page Zoom Controls

  • November 13, 2025

    macOS Tahoe, Windows 11, which operating systems for 4D 20 and 21?

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy