Build an Application with 4D Commands

Since several versions of 4D, different features have been added to create your own build chain. For example,

  • the creation of a “.zip” folder,
  • the addition of information such as the copyright on an executable or a “dll”,
  • the creation of an “info.plist” file,
  • and the new build4D component.

 

With 4D v20, two new features allow finalizing the creation of a standalone or client/server application in 4D code:

  • the addition of an icon to an executable
  • the generation of the deployment license file for a server (OEM license only) or a standalone application.

Add icons to an exe

On Windows, the setAppInfo function of the File class allows adding some information, like the company and the copyright, to an executable. We have added a new attribute, “WinIcon,” to pass the “.ico” file to use.

Here is an example of code:

var $exeFile : 4D.File
var $iconFile : 4D.File

$exeFile:=Folder(fk desktop folder).file("myApp/myApp.exe")
$iconFile:=File("/RESOURCES/myApp.ico")

$exeFile.setAppInfo(New object("WinIcon"; $iconFile.path))

If you wonder, what about macOS? This is already possible since the creation of the setAppInfo function.

To add an icon to a “.app” file. You have to put the “.icns” file in the “Resources” folder of the application. Then add a key “CFBundleIconFile” in the “info.plist” file with the path of the icon relative to the “Resources” folder.

var $plistFile : 4D.File  
$pListFile:= Folder(fk desktop folder).file("myApp.app/Contents/Info.plist")
$pListFile.setAppInfo(New object("CFBundleIconFile";"myApp.icns"))

Generate deployment license

The new command Create deployment license allows the creation of the license for a server or a single-user application. To do this, you must pass the generated application folder and the license file as parameters to generate the deployment license.

Single-user application:

var $status : Object
var $application : 4D.File
var $license : 4D.File
$license:=Folder(fk licenses folder).file("4UUD200-xxx.license4D")
$application:=Folder(fk desktop folder).folder("myApp.app")
$status:=Create deployment license($application; $license)

Server with OEM license:

var $status : Object
var $application : 4D.File
var $serverLicense; $oemLicense : 4D.File
$serverLicense:=Folder(fk licenses folder).file("4UOS200-xxx.license4D")
$oemLicense:=Folder(fk licenses folder).file("4DOM200-xxx.license4D")
$application:=Folder(fk desktop folder).folder("myApp.app")
$status:=Create deployment license($application; $serverLicense; $oemLicense)

Next…

On Github, you have the Build4D component that allows you to create your own build chain. For now, you can customize and automate the creation of a compiled base or a component. Stay tuned for new developments coming soon.

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.