Qt Gradle Plugin 1.1 Released

Qt Gradle Plugin 1.1 (QtGP) is here! If you missed 1.0 release, I recommend reading the QtGP 1.0 release post to catch up. Here we will show what’s new in 1.1 and show use cases of the Optional properties that we have had since the 1.0 release.

Quality of life improvements

Incremental builds

In QtGP 1.0 release I teased that work on incremental build support has been going on and here it is. That feature is on by default, no extra configuration needed. Incremental build works by checking the inputs and outputs of the QtBuildTask, if nothing has changed Gradle will not invoke that build step thus saving us valuable time. Modifying the QtBuild values or Qt project will trigger a rebuild, but after that build the corresponding build will be faster. For more information I recommend reading Gradle’s Incremental build documentation.

Logging

After adding incremental build, we saw that the logging was not quite up to the par, so I decided to make it better. Now instead of printing all the logs at bulk after the process is done it will log while the process is running. No more waiting and thinking: “Hmm... soon I will see my logs.”.

Optional properties

Last time I showed the mandatory properties qtPath and projectPath, that you need to specify inside the QtBuild block. Adding the plugin is done exactly as before. Version ‘1.+’ is used since it takes the latest version of the plugin available in maven central:

plugins {
    id('org.qtproject.qt.gradleplugin') version('1.+')
}

Optional properties qtKitDir, extraCMakeArguments and ninjaPath:

QtBuild {
    qtPath = file('~/Qt/6.8.0')
    projectPath = file('../qmlapp')

    // Optional
    qtKitDir = file('/home/username/qt/build/your-qt-kit')
    extraCMakeArguments = ['-DCMAKE_BUILD_TYPE=Release']
    ninjaPath = '/your/path/to/ninja'
}
 

qtKitDir: By default, QtGP will be building the project using Multi-ABIs flag. When qtKitDir is defined, then a build will be done for that kit ABI only. Let’s say you want to build only for x86_64 you can get that kit from Qt maintenance tool and define the path to be: ‘C:\Qt\6.8.1\android_x86_64’ this will speed up your build even more. If you would like to use a kit you build yourself for example: ‘C:\Repos\Qt\qt6-build-android-install-arm64-v8a ’ you can do that too.

extraCMakeArguments: Just like the name says you can define extra CMake arguments here for example: We don’t yet take in count the build type of your android project. You can specify here the build type to be Release (default is Debug). You can use this to specify any other CMake flag you like.

ninjaPath: You can specify your Ninja path here, but don’t worry, you don’t have to QtGP will search the environment PATH and '~/Qt/Tools/Ninja'  for the Ninja. For example, if you want to test out a new version of Ninja or your own build of Ninja you could try it out from here before adding it to your environment.

For more detailed information on using Qt Gradle plugin, refer to our official documentation.

What is coming next?

Better QtBuild documentation, since there is no Java documentation for it, yet it will be easy to improve. Do you have any features you would like to see added to the plugin? Comment below! You can track work progress and provide feedback at bugreports.qt.io.

 


Blog Topics:

Comments