With the introduction of the project mode, it’s pretty easy to manipulate the components of your projects.
In the last few feature releases, we have added several functionalities that allow you to create your own build chain adapted to your team, your working methods, and your needs.
For example:
- Launch a compilation by programming,
- Zip/unzip files and folders with these commands,
- Easily Manage your Application’s Information,
- Headless 4D applications to integrate it into a build tool.
To help you create your own build chain or integrate 4D into a continuous integration tool, we have developed a component named Build4D, available on GitHub with the sources.
For this first step, Build4D allows you to create a compiled structure and a component. We will continue to enrich it to enable you to manage a single-user application, client application, or server application.
What’s Continuous Integration (CI)
Continuous integration is a practice that automates a development team’s integration of code changes. The code sources are on a source control server. Each time a developer pushes his code on the repository, a syntax check, a compilation, and unit tests are automatically launched.
New component: Build4D
You can get this new component from GitHub. It is composed of three classes:
- CompiledProject
- Component
- _core
The _core class is the base class. It contains all the necessary elementary operations, like compiling, creating the project structure, and creating a 4dz, …
Then the two classes CompiledProject and Component, are based on the _core class. They allow respectively to create of a compiled project and a component.
Compiled structure class
Here is an example of creating a compiled structure with integrated resources and documentation folders:
var $build : cs.Build4D.CompiledProject
var $settings : Object
var $success : Boolean
$settings:=New object()
$settings.destinationFolder:="Test/"
$settings.buildName:="myProject"
$settings.includePaths:=New collection
$settings.includePaths.push(New object("source"; "Resources/"))
$build:=cs.Build4D.CompiledProject.new($settings)
$success:=$build.build()
And the result:
Component class
Here is an example of creating a component with the integration of the documentation and the suppression of a folder “Resources/Dev” only for the development:
var $build : cs.Build4D.Component
var $settings : Object
var $success : Boolean
$settings:=New object()
$settings.destinationFolder:="Test/"
$settings.buildName:="myComponent"
$settings.includePaths:=New collection
$settings.includePaths.push(New object("source"; "Documentation/"))
$settings.deletePaths:=New collection
$settings.deletePaths.push("Resources/Dev/")
$build:=cs.Build4D.Component.new($settings)
$success:=$build.build()
Voilà!
Next…
On Github, don’t forget to bookmark this component by clicking on the “star” or to follow the evolutions of this component by clicking on “watch.” You can find in this blog an overview of the exciting features of Github to see and follow the repository of 4D.