1# QT-CI
2This project collects a set of script for building Qt application for Android/iOS in command line environment.
3
4[![Build Status](https://travis-ci.org/benlau/qtci.svg?branch=master)](https://travis-ci.org/benlau/qtci)
5
6Check [.travis.yml](https://github.com/benlau/qtci/blob/master/.travis.yml) to see how it works.
7It will demonstrate how to build an apk file using QT-CI scripts.
8
9Installation
10============
11
12Since this project is a collection of scripts, and the script in the bin folder does not have any dependence on each other.
13It is not necessary to clone/download the whole repository into your build environment.
14You may simply copy the script you need from this repository.
15
16**recipes/install-qt**
17
18To automatically install Qt, you can just download 2 scripts and grant them permission for execution.
19
20"recipes/install-qt"
21"bin/extract-qt-installer"
22
23Then just run script "recipes/install-qt" with the desired version of Qt
24Example:
25
26    bash install-qt 5.9.4
27
28Enviroument variables
29=====================
30
31QT_CI_PACKAGES - packages to install. You can check available packages if set VERBOSE to 1.
32
33Example:
34
35    export VERBOSE=1
36    export QT_CI_PACKAGES=qt,qt.594,qt.594.gcc_64,qt.594.doc.qtvirtualkeyboard
37
38Setup
39=====
40
41    git clone https://github.com/benlau/qtci.git
42
43    source qtci/path.env #Add qtci/bin and qtci/recipes to $PATH
44
45
46Script
47======
48
49**(1) bin/extract-qt-installer**
50--------------------------------
51
52Usage
53
54```
55    extract-qt-installer [--disable-progress-report] qt-installer output_path
56    extract-qt-installer --list-packages qt-installer
57```
58
59Extract Qt from the installer to the target path (for Qt 5.5 or above). If --list-packages is given, it will show the available packages from the installer and terminate immediately.
60
61Example:
62
63    extract-qt-installer qt-opensource-linux-x64-android-5.5.1.run ~/Qt
64
65**Remarks: The installation path must be absolute path**
66
67Environment Variables
68
69    VERBOSE [Optional] Set to "true" will enable VERBOSE output
70    QT_CI_PACKAGES [Optional] Select the components to be installed instead of using default (eg. QT_CI_PACKAGES="qt.59.gcc_64")
71    QT_CI_LOGIN [Optional] The login name
72    QT_CI_PASSWORD [Optional] The password of login
73
74The arguments and environment required could be different due to the installer changes. Check the recipes folder or the wiki of known issues to find out the correct setting.
75
76**(2) bin/extract-ifw**
77--------------------------------
78
79Extract installer of "Qt installer framework" to the target path
80
81Example:
82
83    extract-ifw qt-installer-framework-opensource-1.5.0-x64.run ~/QtIfw
84
85**(3) bin/install-android-sdk**
86--------------------------------
87
88Download and install Android SDK
89
90Example:
91
92    install-android-sdk platform-tool,build-tools-20.0.0,android-19
93
94**(4) bin/build-android-gradle-project**
95--------------------------------
96
97Build a Qt Android project and sign the APK
98
99Usage:
100
101    build-android-gradle-project project.pro
102
103Required Environment Variables
104
105    QT_HOME [Required] The home directory of installed Qt. (e.g., ~/Qt/5.7)
106    KEYSTORE [Optional] The location of keystore. If it is set, it will be used to sign the created apk
107    KEYALIAS [Optional] The alias of the keystore
108    KEYPASS  [Optional] The password of keystore.
109        ANDROID_TARGET_SDK_VERSION [Optional] Target Android SDK version. The default value is "19"
110
111(5) bin/increase-android-version-code
112--------------------------------
113
114Usage
115
116    increase-android-version-code AndroidManifest.xml
117
118Given an AndroidManifest.xml file, it will increase the value of the versionCode field by one.
119
120(6) bin/run-unittests
121----------------------
122
123Usage
124
125    run-unittests project.pro
126
127Build and run a unit test project in the current folder. If qpm.json were found, it would call `qpm install` first.
128
129Recipes
130=======
131
132
133In the folder "recipes", it contains a set of script that could download and install specific Qt toolchains for a different environment. (Include Android)
134
135Please feel free to modify and submit a new recipe.
136
137Example
138
139    apt-get install openjdk-8-jdk p7zip
140
141    source path.env #Add $PWD/bin and $PWD/recipes to $PATH
142
143    #Change to the installation path
144
145    qt-5.5.1-android-19 # Install Qt 5.5.1 and Android SDK
146
147    source qt-5.5.1-android-19.env # Add installed Qt path to $PATH
148
149
150Reference
151=========
152
153 1. [Continuous distribution for Qt applications on desktop and mobile](http://www.slidedeck.io/lasconic/qtci-qtcon2016)
154 1. [Andrew's Articles - Continuous deployment for Qt applications](http://andrewdolby.com/articles/2016/continuous-deployment-for-qt-applications/)
155
156Related Projects
157=================
158
159 1. [benlau/quickpromise](https://github.com/benlau/quickpromise) - Promise library for QML
160 2. [benlau/quickcross](https://github.com/benlau/quickcross) - QML Cross Platform Utility Library
161 3. [benlau/qsyncable](https://github.com/benlau/qsyncable) - Synchronize data between models
162 4. [benlau/testable](https://github.com/benlau/testable) - QML Unit Test Utilities
163 5. [benlau/quickflux](https://github.com/benlau/quickflux) - Message Dispatcher / Queue for Qt/QML
164 6. [benlau/biginteger](https://github.com/benlau/biginteger) - QML BigInteger library
165