Introducing the latest iteration of the Build4D component, now accessible on GitHub. In previous blog posts, we discussed the possibilities with a compiled project, a component, and a standalone application.
Now you can create a script for your Client/Server application from A to Z. And easily integrate it with continuous integration tools.
Let’s see how.
What are the possibilities?
Build4D offers two classes for generating your client/server application: the client and server classes. So, with the different parameters, every conceivable combination is possible.
You can generate:
- a macOS and/or Windows clients,
- a macOS and/or Windows client archives for automatic updates,
- a macOS and/or Windows servers.
Example
Here’s a simple example of how to create a Windows server with integrated clients:
Step 1: Create a client and a client archive
Here’s a simple example of how to create a client application and a client archive.
var $build : cs.Build4D.Client
var $settings; $archive : Object
var $success : Boolean
$settings:={}
// Define the external project file
$settings.projectFile:=Folder(fk documents folder).file("Contact/Project/Contact.4DProject")
// Define the 4D Volume Desktop path
$settings.sourceAppFolder:=Folder(fk documents folder).folder("4D v20.1/4D Volume Desktop.app")
// OR
$settings.sourceAppFolder:=Folder(fk documents folder).folder("4D v20.1/4D Volume Desktop")
// Configure the application
$settings.buildName:="myApp"
$settings.destinationFolder:="Test/Client/"
// Add the application icon
$settings.iconPath:="/RESOURCES/myIcon.icns"
// OR
$settings.iconPath:="/RESOURCES/myIcon.ico"
// Add the application information
$settings.versioning:={}
$settings.versioning.version:="version"
$settings.versioning.copyright:="copyright"
$settings.versioning.companyName:="companyName"
// Sign if macOS appplication
$settings.signApplication:={}
$settings.signApplication.macSignature:=True
$settings.signApplication.macCertificate:="xxxxxx" //Certificate number found in your keyChain
// Create the client application
$build:=cs.Build4D.Client.new($settings)
$success:=$build.build()
// Create the client application archive
$archive:=$build.buildArchive()
Step2: Create a server with the integrated clients
After creating the client archive (as in the example above), you can create the server application and use the macOSClientArchive and winClientArchive attributes to pass the path to the previously created client archives.
Here’s an example of how to create a server application with client archives.
var $build : cs.Build4D.Server
var $settings : Object
var $success : Boolean
$settings:={}
// Define the external project file
$settings.projectFile:=Folder(fk documents folder).file("Contact/Project/Contact.4DProject")
// Configure the application
$settings.buildName:="myApp"
$settings.destinationFolder:="Test/Server/"
// Define the 4D Server path
$settings.sourceAppFolder:=Folder(fk documents folder).folder("4D v20.0/4D Server.app")
// OR
$settings.sourceAppFolder:=Folder(fk documents folder).folder("4D v20.0/4D Server")
// Add the application icon
$settings.iconPath:="/RESOURCES/myIcon.icns"
// OR
$settings.iconPath:="/RESOURCES/myIcon.ico"
// Add the application information
$settings.versioning:={}
$settings.versioning.version:="version"
$settings.versioning.copyright:="copyright"
$settings.versioning.companyName:="companyName"
// Add the client archives
$settings.macOSClientArchive:="...path macOS Archive..."
$settings.windowsClientArchive:="...path win Archive..."
// Create the deployment license file for OEM partner
$settings.license:=Folder(fk licenses folder).file("XXXXX.license4D")
$settings.xmlKeyLicense:=Folder(fk licenses folder).file("XXXXX.license4D")
// Sign if macOS appplication
$settings.signApplication:={}
$settings.signApplication.macSignature:=True
$settings.signApplication.macCertificate:="xxxxxx"
//Certificate number found in your keyChain
// Launch the build
$build:=cs.Build4D.Server.new($settings)
$success:=$build.build()
Next…
Explore the documentation for further insights into this new possibility!