KISS πŸ‡ΊπŸ‡¦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

Jenkins and Qt

| comments

While working on a Qt project for Symbian OS, I decided to try the Jenkins continuous integration server to automate local builds and just get acquainted with the system. At that point I wanted to set up a build process to get a .sis file ready to be installed on a device.

Looking around the internets about hooking up qmake (Qt’s build system) and Jenkins, I found one plugin — qmakebuilder on the Jenkins website, but it wasn’t available for installation from within the server itself. Apparently, it’s not maintainable anymore. So, I chose the second way, which is to use shell/batch files. In order to build a .sis package symbian toolchain is used, which is only supported on windows, so there is no choice there.

Let’s kick it off.

In Qt Creator I create a new project (Mobile Qt Application) named TestProject, and obviously use git for it.

Build, run, check it runs in the simulator. OK, install Jenkins. Before adding a project, Jenkins needs to know where git is in the system. I use portablegit on Windows. Go to Manage Jenkins / Configure System / Git installations / Path to Git executable: c:/portablegit/bin/git

Now, create a new project in Jenkins. Project option: Build a free-style software project. Name: TestProject.

In Git section set Repository URL to path where your project is: file:///c:/qt_test/TestProject/. Branches to build: master.

Next, Build Triggers section. Poll SCM option will check your project repository once in a while, and build when changes have been found. For the beginning, set Schedule to poll the repo at 20th minute of every hour: 20 * * * *.

Here, on my computer, I needed to change the directory where builds occur, because the QtSDK had been installed in C: drive, whereas the Jenkins had been set up in D:. Symbian toolchain doesn’t support building projects located on drives different from the one where itself is installed. Therefore, I asked Jenkins to build the project in the same C: drive by going to Advanced Project Options / Use custom workspace: c:\qt_test\TestProject_jenkins.

Running Build now at this point should give a clone of your project repository in the specified jenkins workspace directory:

1
2
3
4
5
6
7
8
9
10
11
12
Started by user anonymous
Building in workspace c:\qt_test\TestProject_jenkins
Checkout:TestProject_jenkins / c:\qt_test\TestProject_jenkins - hudson.remoting.LocalChannel@262730
Using strategy: Default
Last Built Revision: Revision 37e68ecd7901646645f95853a09b8ec4690a70bc (origin/HEAD, origin/master)
Checkout:TestProject_jenkins / c:\qt_test\TestProject_jenkins - hudson.remoting.LocalChannel@262730
Cloning the remote Git repository
Cloning repository origin
Fetching upstream changes from file:///c:/qt_test/TestProject/
Commencing build of Revision 37e68ecd7901646645f95853a09b8ec4690a70bc (origin/master)
Checking out Revision 37e68ecd7901646645f95853a09b8ec4690a70bc (origin/master)
Finished: SUCCESS

Now the main thing, configuring the commands to run a build. In the toolchain there is a batch file that prepares the environment before you could build a Qt symbian project from the terminal. The path is \QtSDK\Symbian\SDKs\Symbian1Qt473\bin\qtenvS1.bat. Unfortunately, the last command in the file runs another shell, and that’s what we don’t want here. (If you’re wondering, running qtenvS1.bat directly outputs this:

1
2
3
4
c:\qt_test\TestProject_jenkins>c:\QtSDK\Symbian\SDKs\Symbian1Qt473\bin\qtenvS1.bat
Setting up environment for QT Symbian 1 usage...
c:\QtSDK\Symbian>Archiving artifacts
Finished: SUCCESS

Great success, really?).

So, my solution is the following: copy the file qtenvS1.bat into qtenvS1_.bat, in which remove the last line (with cmd command). Then go to project settings / Build section / Add build step / Execute Windows batch command. The magic command is the following:

1
2
3
4
5
6
7
pushd
call \QtSDK\Symbian\SDKs\Symbian1Qt473\bin\qtenvS1_.bat
popd

qmake TestProject.pro -r -spec symbian-abld "CONFIG+=release" -after "OBJECTS_DIR=obj" "MOC_DIR=moc" "UI_DIR=ui" "RCC_DIR=rcc"
make release-gcce -w
make installer_sis

The first part saves the current directory (the one where the project is being built), sets up the environment, and jumps back to the saved directory.

The second part is taken from the project’s Build Settings in Qt Creator. It builds the project in release mode and then creates a sis package with the app.

Build now, wait for a while (some more information about that: link),

1
Finished: SUCCESS

, and you’ll find a sis package on completion. You can also archive the file so that it may be downloaded from the Jenkins webpage later. Go to Post-build Actions / Archive the artifacts / Files to Archive: TestProject.sis.

Once I’ve set up the system, I realized how convenient it is indeed. Every hour I can have a release build for testing or client. Of course, this step in only introduction to CI systems.

I believe this description may seem cumbersome and/or vague, so if you have any questions, don’t hesitate to leave a comment.

Comments