[
  {
    "path": ".gitignore",
    "content": "node_modules/\ndocker/download/*.run\n*.retry\nnpm-debug.log\nyarn.lock\n*.run\n*.dmg\n"
  },
  {
    "path": ".travis.yml",
    "content": "language : cpp\ncompiler: gcc\nos: linux\ndist: trusty\n\nmatrix:\n  include:\n  - before_install:\n        - cat /etc/apt/sources.list\n        - sudo apt-get update\n        - sudo apt-get install --force-yes -qq p7zip openjdk-7-jdk ant lib32z1-dev lib32stdc++6  #lib32* are needed by Android SDK\n        - sudo update-alternatives --display java\n        - sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java\n        - sh -e /etc/init.d/xvfb start\n    script:\n        - ENV_FILE=qt-5.9.5-android-19.env\n        - export WORKDIR=$PWD\n        - echo $PWD\n        - source path.env\n        - wget -c https://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run\n        - extract-qt-installer --list-packages qt-unified-linux-x64-online.run\n        - install-qt-5.9.5-android-19\n        - cat $ENV_FILE\n        - source $ENV_FILE\n        - which qmake\n        - git clone https://github.com/benlau/quickandroid.git\n        - cd quickandroid/examples/quickandroidexample\n        - qmake\n        - make install INSTALL_ROOT=$WORKDIR/build\n        - androiddeployqt --output $WORKDIR/build\n  - os: osx\n    script: \n      - QT_CI_PACKAGES=qt.qt5.598.clang_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.8 && source qt-5.9.8.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.8\"\n  - os: osx\n    script: \n      - QT_CI_PACKAGES=qt.qt5.5124.clang_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.12.4 && source qt-5.12.4.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.12.4\"\n  - script:\n    - QT_CI_PACKAGES=qt.56.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.6.0 && source qt-5.6.0.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.6.0\"\n  - script:\n    - QT_CI_PACKAGES=qt.56.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.6.1 && source qt-5.6.1.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.6.1\"\n  - script:\n    - QT_CI_PACKAGES=qt.56.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.6.1-1 && source qt-5.6.1-1.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.6.1\"\n  - script:\n    - QT_CI_PACKAGES=qt.56.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.6.2 && source qt-5.6.2.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.6.2\"\n  - script:\n    - QT_CI_PACKAGES=qt.563.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.6.3 && source qt-5.6.3.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.6.3\"\n  - script:\n    - QT_CI_PACKAGES=qt.59.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.0 && source qt-5.9.0.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.0\"\n  - script:\n    - QT_CI_PACKAGES=qt.591.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.1 && source qt-5.9.1.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.1\"\n  - script:\n    - QT_CI_PACKAGES=qt.592.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.2 && source qt-5.9.2.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.2\"\n  - script:\n    - QT_CI_PACKAGES=qt.593.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.3 && source qt-5.9.3.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.3\"\n  - script:\n    - QT_CI_PACKAGES=qt.594.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.4 && source qt-5.9.4.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.4\"\n  - script:\n    - QT_CI_PACKAGES=qt.595.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.5 && source qt-5.9.5.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.5\"\n  - script:\n    - QT_CI_PACKAGES=qt.596.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.6 && source qt-5.9.6.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.6\"\n  - script:\n    - QT_CI_PACKAGES=qt.qt5.597.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.7 && source qt-5.9.7.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.7\"\n  - script:\n    - QT_CI_PACKAGES=qt.qt5.598.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.9.8 && source qt-5.9.8.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.9.8\"\n  - script:\n    - QT_CI_PACKAGES=qt.qt5.5120.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.12.0 && source qt-5.12.0.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.12.0\"\n  - script:\n    - QT_CI_PACKAGES=qt.qt5.5121.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.12.1 && source qt-5.12.1.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.12.1\"\n  - script:\n    - QT_CI_PACKAGES=qt.qt5.5122.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.12.2 && source qt-5.12.2.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.12.2\"\n  - script:\n    - QT_CI_PACKAGES=qt.qt5.5123.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.12.3 && source qt-5.12.3.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.12.3\"\n  - script:\n    - QT_CI_PACKAGES=qt.qt5.5124.gcc_64 PATH=${TRAVIS_BUILD_DIR}/recipes:${TRAVIS_BUILD_DIR}/bin:${PATH} install-qt 5.12.4 && source qt-5.12.4.env && qmake -version && test \"$(qmake -query QT_VERSION)\" = \"5.12.4\"\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# QT-CI\nThis project collects a set of script for building Qt application for Android/iOS in command line environment.\n\n[![Build Status](https://travis-ci.org/benlau/qtci.svg?branch=master)](https://travis-ci.org/benlau/qtci)\n\nCheck [.travis.yml](https://github.com/benlau/qtci/blob/master/.travis.yml) to see how it works.\nIt will demonstrate how to build an apk file using QT-CI scripts.\n\nInstallation\n============\n\nSince this project is a collection of scripts, and the script in the bin folder does not have any dependence on each other.\nIt is not necessary to clone/download the whole repository into your build environment.\nYou may simply copy the script you need from this repository.\n\n**recipes/install-qt**\n\nTo automatically install Qt, you can just download 2 scripts and grant them permission for execution.\n\n\"recipes/install-qt\"\n\"bin/extract-qt-installer\"\n\nThen just run script \"recipes/install-qt\" with the desired version of Qt\nExample:\n\n    bash install-qt 5.9.4\n\nEnvironment variables\n=====================\n\nQT_CI_PACKAGES - packages to install. You can check available packages if set VERBOSE to 1.\n\nExample:\n\n    export VERBOSE=1\n    export QT_CI_PACKAGES=qt,qt.594,qt.594.gcc_64,qt.594.doc.qtvirtualkeyboard\n\nSetup\n=====\n\n    git clone https://github.com/benlau/qtci.git\n\n    source qtci/path.env #Add qtci/bin and qtci/recipes to $PATH\n\n\nScript\n======\n\n**(1) bin/extract-qt-installer**\n--------------------------------\n\nUsage\n\n```\n    extract-qt-installer [--disable-progress-report] qt-installer output_path\n    extract-qt-installer --list-packages qt-installer\n```\n\nExtract 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. \n\nExample:\n\n    extract-qt-installer qt-opensource-linux-x64-android-5.5.1.run ~/Qt\n\n**Remarks: The installation path must be absolute path**\n\nEnvironment Variables\n\n    VERBOSE [Optional] Set to \"true\" will enable VERBOSE output\n    QT_CI_PACKAGES [Optional] Select the components to be installed instead of using default (eg. QT_CI_PACKAGES=\"qt.59.gcc_64\")\n    QT_CI_LOGIN [Optional] The login name \n    QT_CI_PASSWORD [Optional] The password of login\n\nThe 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.\n\n**(2) bin/extract-ifw**\n--------------------------------\n\nExtract installer of \"Qt installer framework\" to the target path\n\nExample:\n\n    extract-ifw qt-installer-framework-opensource-1.5.0-x64.run ~/QtIfw\n\n**(3) bin/install-android-sdk**\n--------------------------------\n\nDownload and install Android SDK\n\nExample:\n\n    install-android-sdk platform-tool,build-tools-20.0.0,android-19\n\n**(4) bin/build-android-gradle-project**\n--------------------------------\n\nBuild a Qt Android project and sign the APK\n\nUsage:\n\n    build-android-gradle-project project.pro\n\nRequired Environment Variables\n\n    QT_HOME [Required] The home directory of installed Qt. (e.g., ~/Qt/5.7)\n    KEYSTORE [Optional] The location of keystore. If it is set, it will be used to sign the created apk\n    KEYALIAS [Optional] The alias of the keystore\n    KEYPASS  [Optional] The password of keystore.\n        ANDROID_TARGET_SDK_VERSION [Optional] Target Android SDK version. The default value is \"19\"\n\n(5) bin/increase-android-version-code\n--------------------------------\n\nUsage\n\n    increase-android-version-code AndroidManifest.xml\n\nGiven an AndroidManifest.xml file, it will increase the value of the versionCode field by one.\n\n(6) bin/run-unittests\n----------------------\n\nUsage\n\n    run-unittests project.pro\n\nBuild and run a unit test project in the current folder. If qpm.json were found, it would call `qpm install` first.\n\nRecipes\n=======\n\n\nIn the folder \"recipes\", it contains a set of script that could download and install specific Qt toolchains for a different environment. (Include Android)\n\nPlease feel free to modify and submit a new recipe.\n\nExample\n\n    apt-get install openjdk-8-jdk p7zip\n\n    source path.env #Add $PWD/bin and $PWD/recipes to $PATH\n\n    #Change to the installation path\n\n    qt-5.5.1-android-19 # Install Qt 5.5.1 and Android SDK\n    \n    source qt-5.5.1-android-19.env # Add installed Qt path to $PATH\n\n\nReference\n=========\n\n 1. [Continuous distribution for Qt applications on desktop and mobile](http://www.slidedeck.io/lasconic/qtci-qtcon2016)\n 1. [Andrew's Articles - Continuous deployment for Qt applications](http://andrewdolby.com/articles/2016/continuous-deployment-for-qt-applications/)\n\nRelated Projects\n=================\n\n 1. [benlau/quickpromise](https://github.com/benlau/quickpromise) - Promise library for QML\n 2. [benlau/quickcross](https://github.com/benlau/quickcross) - QML Cross Platform Utility Library\n 3. [benlau/qsyncable](https://github.com/benlau/qsyncable) - Synchronize data between models\n 4. [benlau/testable](https://github.com/benlau/testable) - QML Unit Test Utilities\n 5. [benlau/quickflux](https://github.com/benlau/quickflux) - Message Dispatcher / Queue for Qt/QML\n 6. [benlau/biginteger](https://github.com/benlau/biginteger) - QML BigInteger library\n"
  },
  {
    "path": "bin/build-android-gradle-project",
    "content": "#!/bin/bash\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n\nset -e\n\nif [ $# -lt 1 ]\nthen\n    echo build-android-gradle-project pro\n    exit -1\nfi\n\nJARSIGNER=`which jarsigner`\n\nPRO=$1\n\nSPEC=\"${SPEC:-android-g++}\"\n\nif [ -z \"$QMAKE\"]\nthen\n\n  if [ -n \"$QT_HOME\" ]\n  then\n     QMAKE=$QT_HOME/android_armv7/bin/qmake\n     PATH=$QT_HOME/android_armv7/bin:$PATH\n  else\n     QMAKE=qmake\n  fi\n\nfi\n\nif [ -z \"$ANDROID_TARGET_SDK_VERSION\" ]\nthen\n  ANDROID_TARGET_SDK_VERSION=\"19\"\nfi\n\necho $QMAKE\n\nif [ -n \"$KEYSTORE\" ] \nthen\n    echo \"Key store file: $KEYSTORE\"  \n    if [ ! -f \"$KEYSTORE\" ]\n    then\n        echo \"Key store file not found!\";\n        exit -1\n    fi\n\n    if [ -z \"$KEYPASS\" ]\n    then\n       echo \"KEYPASS is absent\"\n       exit -1\n    fi\n    DEPLOY_ARGS=\"--sign $KEYSTORE $KEYALIAS --storepass $KEYPASS \"\nfi\n\nset -v\n$QMAKE $PRO -r -spec $SPEC\n\nANDROID_BUILD_PATH=`pwd`/android-build\n\nJSON=`ls *deployment-settings.json`\nmake\nmake install INSTALL_ROOT=${ANDROID_BUILD_PATH}\n\nandroiddeployqt --verbose --input $JSON --output `pwd`/android-build --deployment bundled --android-platform android-${ANDROID_TARGET_SDK_VERSION} --gradle --no-gdbserver $DEPLOY_ARGS\n\nAPK=${ANDROID_BUILD_PATH}/build/outputs/apk/android-build-release-signed.apk\n\nif [ ! -f $APK ]\nthen\nAPK=${ANDROID_BUILD_PATH}/build/outputs/apk/android-build-debug.apk\nfi\n\necho \"Output APK: $APK\"\n\nif [ ! -z \"$JARSIGNER\" ]\nthen \n     $JARSIGNER -verify -verbose -certs $APK\nfi\n"
  },
  {
    "path": "bin/extract-ifw",
    "content": "#!/bin/bash\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n\nset -e #quit on error\n\nif [ $# -lt 2 ];\nthen\n    echo extract-ifw qtifw output_path\n    exit -1\nfi\n\nexport PATH=$PATH:$PWD\nexport WORKDIR=$PWD\nINSTALLER=$1\nOUTPUT=$2\nSCRIPT=\"$(mktemp)\"\n\ncat <<EOF > $SCRIPT\nfunction Controller() {}\n\nController.prototype.IntroductionPageCallback = function() {\n    gui.clickButton(buttons.NextButton);\n}\n\n\nController.prototype.TargetDirectoryPageCallback = function() {\n    var widget = gui.currentPageWidget();\n\n    if (widget != null) {\n        widget.TargetDirectoryLineEdit.setText(\"$OUTPUT\");\n    }\n\n    gui.clickButton(buttons.NextButton);\n\n}\n\nController.prototype.LicenseAgreementPageCallback = function() {\n    var widget = gui.currentPageWidget();\n\n    if (widget != null) {\n        widget.AcceptLicenseRadioButton.setChecked(true);\n    }\n\n    gui.clickButton(buttons.NextButton);\n\n}\n\nController.prototype.ReadyForInstallationPageCallback = function() {\n\n    gui.clickButton(buttons.CommitButton);\n}\n\nController.prototype.FinishedPageCallback = function() {\n\n    gui.clickButton(buttons.FinishButton);\n}\nEOF\n\nchmod u+x $1\n$1 --script $SCRIPT\n\n\n"
  },
  {
    "path": "bin/extract-qt-installer",
    "content": "#!/bin/bash\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n\nfunction usage() {\n    echo \"Usage:\"\n    echo \"extract-qt-installer qt-installer output_path\"\n    echo \"extract-qt-installer --list-packages qt-installer\"\n    exit -1\n}\n\nLIST_PACKAGES=0\n\ngetopt --test > /dev/null 2>&1\nGETOPT_RET_CODE=$?\n\nset -e #quit on error\n\nif [ \"$GETOPT_RET_CODE\" != \"4\" ]\nthen\n    echo \"Warning: gnu-getopt is not installed. Long parameter like '--list-package' will not be working. Please install gnu-getopt by 'brew install gnu-getopt'\"   \nelse\n\n\tOPTS=`getopt -o l --long list-packages --long disable-progress-report -n \"extract-qt-installer\" -- \"$@\"`\n\n    eval set -- \"$OPTS\"\n\n    while true\n    do\n      case \"$1\" in\n        --list-packages)\n          LIST_PACKAGES=1\n          shift;;\n\t    --disable-progress-report)\n\t      DISABLE_PROGRESS_REPORT=1\n\t      shift;;\n        --) shift;break;;\n        *) shift;;\n      esac\n    done\nfi\n\n\nexport PATH=$PATH:$PWD\nexport WORKDIR=$PWD\nINSTALLER=$1\nOUTPUT=$2\nSCRIPT=\"$(mktemp /tmp/tmp.XXXXXXXXX)\"\nPACKAGES=$QT_CI_PACKAGES\n\nif [ $LIST_PACKAGES -gt 0 ]\nthen \n\n\tif [ $# -lt 1 ]\n\tthen\n\t\tusage\n\tfi\n\t\n\tOUTPUT=\"/tmp/Qt\"\n\nelse\n\n\tif [ $# -lt 2 ]\n\tthen\n\t\tusage\n\tfi\n\n\tif [[ ! \"${OUTPUT:0:1}\" = \"/\" ]] \n\tthen \n\t\techo output path must be an absolute path\n\t\texit -1\n\tfi\n    \nfi\n\ncat <<EOF > $SCRIPT\n\nfunction abortInstaller()\n{\n    installer.setDefaultPageVisible(QInstaller.Introduction, false);\n    installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);\n    installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);\n    installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);\n    installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);\n    installer.setDefaultPageVisible(QInstaller.PerformInstallation, false);\n    installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);\n\n    var abortText = \"<font color='red' size=3>\" + qsTr(\"Installation failed:\") + \"</font>\";\n\n    var error_list = installer.value(\"component_errors\").split(\";;;\");\n    abortText += \"<ul>\";\n    // ignore the first empty one\n    for (var i = 0; i < error_list.length; ++i) {\n        if (error_list[i] !== \"\") {\n            log(error_list[i]);\n            abortText += \"<li>\" + error_list[i] + \"</li>\"\n        }\n    }\n    abortText += \"</ul>\";\n    installer.setValue(\"FinishedText\", abortText);\n}\n\nfunction log() {\n    var msg = [\"QTCI: \"].concat([].slice.call(arguments));\n    console.log(msg.join(\" \"));\n}\n\nfunction printObject(object) {\n\tvar lines = [];\n\tfor (var i in object) {\n\t\tlines.push([i, object[i]].join(\" \"));\n\t}\n\tlog(lines.join(\",\"));\n}\n\nvar status = {\n\twidget: null,\n\tfinishedPageVisible: false,\n\tinstallationFinished: false\n}\n\nfunction tryFinish() {\n\tif (status.finishedPageVisible && status.installationFinished) {\n        if (status.widget.LaunchQtCreatorCheckBoxForm) {\n            // Disable this checkbox for minimal platform\n            status.widget.LaunchQtCreatorCheckBoxForm.launchQtCreatorCheckBox.setChecked(false);\n        }\n        if (status.widget.RunItCheckBox) {\n            // LaunchQtCreatorCheckBoxForm may not work for newer versions.\n            status.widget.RunItCheckBox.setChecked(false);\n        }\n        log(\"Press Finish Button\");\n\t    gui.clickButton(buttons.FinishButton);\n\t}\n}\n\nfunction Controller() {\n    installer.installationFinished.connect(function() {\n\t\tstatus.installationFinished = true;\n        gui.clickButton(buttons.NextButton);\n        tryFinish();\n    });\n    installer.setMessageBoxAutomaticAnswer(\"OverwriteTargetDirectory\", QMessageBox.Yes);\n    installer.setMessageBoxAutomaticAnswer(\"installationErrorWithRetry\", QMessageBox.Ignore);\n    installer.setMessageBoxAutomaticAnswer(\"XcodeError\", QMessageBox.Ok);\n    \n    // Allow to cancel installation for arguments --list-packages\n    installer.setMessageBoxAutomaticAnswer(\"cancelInstallation\", QMessageBox.Yes);\n}\n\nController.prototype.WelcomePageCallback = function() {\n    log(\"Welcome Page\");\n\n    gui.clickButton(buttons.NextButton);\n\n    var widget = gui.currentPageWidget();\n\n\t/* \n\t   Online installer 3.0.6 \n\t   - It must disconnect the completeChanged callback after used, otherwise it will click the 'next' button on another pages\n\t */\n    var callback = function() {\n        gui.clickButton(buttons.NextButton);\n        widget.completeChanged.disconnect(callback);\n\t}\n\n    widget.completeChanged.connect(callback);\n}\n\nController.prototype.CredentialsPageCallback = function() {\n\t\n\tvar login = installer.environmentVariable(\"QT_CI_LOGIN\");\n\tvar password = installer.environmentVariable(\"QT_CI_PASSWORD\");\n\n\tif (login === \"\" || password === \"\") {\n\t\tgui.clickButton(buttons.CommitButton);\n\t}\n\t\n    var widget = gui.currentPageWidget();\n\n\twidget.loginWidget.EmailLineEdit.setText(login);\n\n\twidget.loginWidget.PasswordLineEdit.setText(password);\n\n    gui.clickButton(buttons.CommitButton);\n}\n\nController.prototype.ComponentSelectionPageCallback = function() {\n    log(\"ComponentSelectionPageCallback\");\n\n    function list_packages() {\n      var components = installer.components();\n      log(\"Available components: \" + components.length);\n      var packages = [\"Packages: \"];\n\n      for (var i = 0 ; i < components.length ;i++) {\n          packages.push(components[i].name);\n      }\n      log(packages.join(\" \"));\n    }\n      \n    if ($LIST_PACKAGES) {\n        list_packages();\n        gui.clickButton(buttons.CancelButton);\n        return;\n    }\n\n    log(\"Select components\");\n\n    function trim(str) {\n        return str.replace(/^ +/,\"\").replace(/ *$/,\"\");\n    }\n\n    var widget = gui.currentPageWidget();\n\n    var packages = trim(\"$PACKAGES\").split(\",\");\n    if (packages.length > 0 && packages[0] !== \"\") {\n        widget.deselectAll();\n        var components = installer.components();\n        var allfound = true;\n        for (var i in packages) {\n            var pkg = trim(packages[i]);\n            var found = false;\n            for (var j in components) {\n                if (components[j].name === pkg) {\n                    found = true;\n                    break;\n                }\n            }\n            if (!found) {\n                allfound = false;\n                log(\"ERROR: Package \" + pkg + \" not found.\");\n            } else {\n                log(\"Select \" + pkg);\n                widget.selectComponent(pkg);\n            }\n        }\n        if (!allfound) {\n            list_packages();\n            // TODO: figure out how to set non-zero exit status.\n            gui.clickButton(buttons.CancelButton);\n            return;\n        }\n    } else {\n       log(\"Use default component list\");\n    }\n\n    gui.clickButton(buttons.NextButton);\n}\n\nController.prototype.IntroductionPageCallback = function() {\n    log(\"Introduction Page\");\n    log(\"Retrieving meta information from remote repository\");\n    \n   \t/* \n\t   Online installer 3.0.6 \n\t   - Don't click buttons.NextButton directly. It will skip the componenet selection.\n    */\n    \n\tif (installer.isOfflineOnly()) {\n\t\tgui.clickButton(buttons.NextButton);\n\t}  \n}\n\nController.prototype.TargetDirectoryPageCallback = function() {\n    log(\"Set target installation page: $OUTPUT\");\n    var widget = gui.currentPageWidget();\n\n    if (widget != null) {\n        widget.TargetDirectoryLineEdit.setText(\"$OUTPUT\");\n    }\n    \n    gui.clickButton(buttons.NextButton);\n}\n\nController.prototype.LicenseAgreementPageCallback = function() {\n    log(\"Accept license agreement\");\n    var widget = gui.currentPageWidget();\n\n    if (widget != null) {\n        widget.AcceptLicenseRadioButton.setChecked(true);\n    }\n\n    gui.clickButton(buttons.NextButton);\n}\n\nController.prototype.ReadyForInstallationPageCallback = function() {\n    log(\"Ready to install\");\n\n    // Bug? If commit button pressed too quickly finished callback might not show the checkbox to disable running qt creator\n    // Behaviour started around 5.10. You don't actually have to press this button at all with those versions, even though gui.isButtonEnabled() returns true.\n    \n    gui.clickButton(buttons.CommitButton, 200);\n}\n\nController.prototype.PerformInstallationPageCallback = function() {\n    log(\"PerformInstallationPageCallback\");\n    gui.clickButton(buttons.CommitButton);\n}\n\nController.prototype.FinishedPageCallback = function() {\n    log(\"FinishedPageCallback\");\n\n    var widget = gui.currentPageWidget();\n\n\t// Bug? Qt 5.9.5 and Qt 5.9.6 installer show finished page before the installation completed\n\t// Don't press \"finishButton\" immediately\n    \n\tstatus.finishedPageVisible = true;\n\tstatus.widget = widget;\n\ttryFinish();   \n}\n\nEOF\n\nchmod u+x $1\nif [ -n \"$QT_CI_DEBUG\" ] \nthen\n\t$INSTALLER -v --script $SCRIPT | grep \"\\(QTCI\\|operation\\)\"\n\texit 0\nfi\n\nunset DISPLAY\n\nif [ -n \"$DISABLE_PROGRESS_REPORT\" ]\nthen\n\tQT_QPA_PLATFORM=minimal $INSTALLER --script $SCRIPT \nelse\n\tARGS=\"-v\"\n\n\tif [ -n \"$VERBOSE\" ]\n\tthen\n\t\tQT_QPA_PLATFORM=minimal $INSTALLER $ARGS --script $SCRIPT\n\telse\n\t\tQT_QPA_PLATFORM=minimal $INSTALLER $ARGS --script $SCRIPT | grep \"\\(QTCI\\|operation\\)\"\n\tfi\nfi\n\n\n"
  },
  {
    "path": "bin/increase-android-version-code",
    "content": "#!/usr/bin/python\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n# Based on the solution from http://stackoverflow.com/questions/6758685/auto-increment-version-code-in-android-app\n\nimport sys\nimport os\nfrom xml.dom.minidom import parse\n\n\nif len(sys.argv) < 2:\n    print(\"increase_version_code_android AndroidManifest.xml\")\n    quit()\n\nmanifest = sys.argv[1]\n\ndom1 = parse(manifest)\nversionCode = int(dom1.documentElement.getAttribute(\"android:versionCode\")) + 1\n\ndom1.documentElement.setAttribute(\"android:versionCode\", str(versionCode))\n\nwith open(manifest, 'wb') as f:\n    for line in dom1.toxml(\"utf-8\"):\n        f.write(line)\n"
  },
  {
    "path": "bin/increase-ios-build-number",
    "content": "#!/bin/bash\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n\nset -e\n\nINFOPLIST_FILE=`xcodebuild -showBuildSettings | grep INFOPLIST_FILE | sed -e \"s/.*=//g\"`\nbuildNumber=`/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" $INFOPLIST_FILE`\nbuildNumber=$(($buildNumber+1))\nxcrun agvtool new-version -all $buildNumber\n"
  },
  {
    "path": "bin/increase-macos-build-number",
    "content": "#!/bin/bash\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n\nset -e\n\nif [ $# -lt 1 ];\nthen\n    echo $0 Info.plist\n    exit -1\nfi\n\n\nINFOPLIST_FILE=$1\nbuildNumber=`/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" $INFOPLIST_FILE`\nbuildNumber=$(($buildNumber+1))\n/usr/libexec/PlistBuddy -c \"Set CFBundleVersion $buildNumber\" $INFOPLIST_FILE\n\n"
  },
  {
    "path": "bin/install-android-sdk",
    "content": "#!/bin/bash\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n\n# Install Android SDK to current folder\n\nset -e #quit on error\n\nif [ $# -lt 1 ];\nthen\n    echo install-android-sdk packages\n    echo\n    echo Example:\n    echo     install-android-sdk platform-tool,build-tools-20.0.0,android-19\n    exit -1\nfi\n\nNDK_VERSION=${NDK_VERSION:=r17c}\n\n# e.g: platform-tool,build-tools-20.0.0,android-19\nPACKAGES=$1\n\necho Downloading Android SDK...\nwget -c -nv https://dl.google.com/android/android-sdk_r23.0.2-linux.tgz\n\necho Downloading Android NDK...\nwget -c -nv https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux-x86_64.zip\n\necho Extacting Android SDK...\ntar -zxf android-sdk_r23.0.2-linux.tgz\n\necho Upgrading Android SDK...\n(sleep 5 ; while true ; do sleep 1 ; printf 'y\\r\\n' ; done ) | ./android-sdk-linux/tools/android update sdk -u -a -t $PACKAGES\n\necho Installing Android NDK...\n(unzip android-ndk-${NDK_VERSION}-linux-x86_64.zip)\n\necho Android SDK and NDK installed\n./android-sdk-linux/platform-tools/adb kill-server\n\necho\necho export PATH=$PWD/android-sdk-linux/tools:$PATH\necho export ANDROID_NDK_ROOT=$PWD/android-ndk-${NDK_VERSION}\necho export ANDROID_SDK_ROOT=$PWD/android-sdk-linux\n\n"
  },
  {
    "path": "bin/run-unittests",
    "content": "#!/bin/bash\n# Build and run an unit test project\n\n# QT-CI Project\n# License: Apache-2.0\n# https://github.com/benlau/qtci\n\nset -e\n\nusage() {\n    echo run-unittests pro_file\n}\n\nwhile :; do\n  case $1 in \n    -h|--help)\n\tusage\n\texit \n    ;;\n    --qpa-platform)\n\tPLATFORM=$2\n        shift\n    ;;\n    *) \n      PRO=$1\n      break\n   esac\n   shift\ndone\n\nif [ -z \"$PRO\" ]\nthen\n   usage\n   exit -1\nfi\n\nPRO=$1\n\nSRCDIR=`dirname $PRO`\n\nif [ -f $SRCDIR/qpm.json ]\nthen\n    (cd $SRCDIR;qpm install)\nfi\n\nTARGET=`cat $PRO | grep \"TARGET *=\" | sed \"s/^TARGET *= *//\"`\n\necho \"Target executable: $TARGET\"\n\nqmake CONFIG+=debug $PRO\nif [ -z \"${QT_CI_SILENT}\" ]\nthen\n    make\nelse\n    echo \"Compiling...\"\n    make > /dev/null\nfi\necho \"Build Completed\"\n\nif [ ! -z \"$PLATFORM\" ]\nthen\n   export QT_QPA_PLATFORM=$PLATFORM\nfi\n\n./$TARGET\n"
  },
  {
    "path": "bin/set-file-suffix",
    "content": "#!/bin/sh\n\nif [ \"$#\" -ne 2 ]\nthen\n    echo set-file-suffix file suffix\n    exit -1\nfi\n\nNAME=`echo \"$1\" | cut -d'.' -f1`\nEXTENSION=`echo \"$1\" | cut -d'.' -f2`\n\nmv \"$1\" \"${NAME}-$2.$EXTENSION\"\n"
  },
  {
    "path": "bin/upgrade-qpm-packages",
    "content": "#!/usr/bin/python\n\nimport json\nimport sys\nimport os\nfrom subprocess import call\n\ntry:\n  f = open(\"qpm.json\", \"r\")\n\n  txt = f.read()\n\n  content = json.loads(txt)\n\n  for row in content[\"dependencies\"]:\n    token = row.split(\"@\")\n    pkg = token[0]\n    print pkg\n    call([\"qpm\", \"install\", pkg])\n\nexcept IOError:\n  print \"Unable to read qpm.json\"\n  sys.exit(-1)\n\nexcept ValueError:\n  print \"Corrupted json file\"\n  sys.exit(-1)\n\n\n"
  },
  {
    "path": "docker/Dockerfile",
    "content": "FROM ubuntu:18.04\nVOLUME [\"/host/qtci\", \"/host/download\"]\n\n# USERID should be same as the current user.\nARG USERID\nARG USERNAME=ci\n\nENV DISPLAY=\":0\"\n\nRUN useradd --create-home --no-user-group -u $USERID $USERNAME -s /bin/bash && adduser $USERNAME sudo\n\nRUN apt-get update && \\\n\tapt-get install -y --no-install-recommends ansible sudo && \\\n\trm -rf /var/lib/apt/lists/* && \\\n    apt-get clean \n\nADD ansible.yml /host/ansible.yml\n\nRUN ansible-playbook /host/ansible.yml && \\\n\trm -rf /var/lib/apt/lists/* && \\\n    apt-get clean \n\nUSER $USERNAME\n\nWORKDIR /home/$USERNAME\n\nCMD [\"bash\"]\n\n"
  },
  {
    "path": "docker/README.md",
    "content": "QTCI Docker Images\n===============\n\nIt is a docker container to build and develop Qt application\n\nSetup\n\n```\nnpm install\nnpm run docker_image_build\nnpm run docker_container_build\nnpm run docker_container_start\n```\n\nInstall and Use Specific Qt version\n```\nnpm use:qt5.9.2\n```\n\n```\nnpm run shell\n```\n\nConfiguration\n=====\n\nMount your own directory\n\n```\nnpm config set qtci:docker_container_build_args \"-v HOST_DIR:DOCKER_DIR\"\nnpm run docker_container_build\n```\n\nChange Docker Image name\n```\nnpm config set qtci:docker_image new_name\nnpm run docker_image_build\n```\n\nChange Docker Container Name\n\n```\nnpm config set qtci:docker_container new_name\nnpm run docker_container_build\n```\n"
  },
  {
    "path": "docker/ansible-qt5.10.1.yml",
    "content": "---\n- import_playbook: ansible.yml\n- hosts: localhost\n  vars:\n    qtver: 5.10.1\n    url: https://download.qt.io/archive/qt/5.10/5.10.1/qt-opensource-linux-x64-5.10.1.run\n    file: qt-opensource-linux-x64-5.10.1.run\n    hash: md5:8bc46db7cd82d738fa0015aea0bf7cb1\n    install_path: /opt/qt5.10.1\n    packages: qt.qt5.5101.gcc_64\n  tasks:\n  - name: Download Qt\n    become: yes\n    become_user: ci\n    get_url:\n      url: \"{{url}}\"\n      dest: /host/download/{{file}}\n      checksum: \"{{hash}}\"\n  - name: Check Installation\n    stat:\n       path: \"{{ install_path }}\"\n    register: qt_installation_result\n  - name: Install Qt\n    shell: DISPLAY=\"\" QT_CI_PACKAGES=\"{{packages}}\" /host/qtci/bin/extract-qt-installer /host/download/{{file}} {{install_path}}\n    when: qt_installation_result.stat.exists == False\n  - name: QT Path in .bashrc\n    blockinfile:\n      dest: /home/ci/.bashrc\n      marker_begin: \"QT_PATH_BEGIN\"\n      marker_end: \"QT_PATH_END\"\n      block: |\n        export PATH={{install_path}}/{{qtver}}/gcc_64/bin:$PATH\n"
  },
  {
    "path": "docker/ansible-qt5.11.2.yml",
    "content": "---\n- import_playbook: ansible.yml\n- hosts: localhost\n  vars:\n    qtver: 5.11.2\n    url: https://download.qt.io/archive/qt/5.11/5.11.2/qt-opensource-linux-x64-5.11.2.run\n    file: qt-opensource-linux-x64-5.11.2.run\n    hash: md5:974fda61267cfb6e45984ee5f0a285f8\n    install_path: /opt/qt5.11.2\n    packages: qt.qt5.5112.gcc_64\n  tasks:\n  - name: Download Qt\n    become: yes\n    become_user: ci\n    get_url:\n      url: \"{{url}}\"\n      dest: /host/download/{{file}}\n      checksum: \"{{hash}}\"\n  - name: Check Installation\n    stat:\n       path: \"{{ install_path }}\"\n    register: qt_installation_result\n  - name: Show packages\n    shell: DISPLAY=\"\" /host/qtci/bin/extract-qt-installer --list-packages /host/download/{{file}} > /host/qtci/meta/qt-{{qtver}}-packages.txt\n    when: qt_installation_result.stat.exists == False\n  - name: Install Qt\n    shell: DISPLAY=\"\" QT_CI_PACKAGES=\"{{packages}}\" /host/qtci/bin/extract-qt-installer /host/download/{{file}} {{install_path}}\n    when: qt_installation_result.stat.exists == False\n  - name: QT Path in .bashrc\n    blockinfile:\n      dest: /home/ci/.bashrc\n      marker_begin: \"QT_PATH_BEGIN\"\n      marker_end: \"QT_PATH_END\"\n      block: |\n        export PATH={{install_path}}/{{qtver}}/gcc_64/bin:$PATH\n"
  },
  {
    "path": "docker/ansible-qt5.9.2.yml",
    "content": "---\n- import_playbook: ansible.yml\n- hosts: localhost\n  vars:\n    qtver: 5.9.2\n    url: https://download.qt.io/archive/qt/5.9/5.9.2/qt-opensource-linux-x64-5.9.2.run\n    file: qt-opensource-linux-x64-5.9.2.run\n    hash: md5:6b607f21a1953c3a272de7d5a4094a47\n    install_path: /opt/qt5.9.2\n    packages: qt.592.gcc_64,qt.592.qtwebengine\n  tasks:\n  - name: Download Qt\n    become: yes\n    become_user: ci\n    get_url:\n      url: \"{{url}}\"\n      dest: /host/download/{{file}}\n      checksum: \"{{hash}}\"\n  - name: Check Installation\n    stat:\n       path: \"{{ install_path }}\"\n    register: qt_installation_result\n  - name: Install Qt\n    shell: QT_CI_PACKAGES=\"{{packages}}\" /host/qtci/bin/extract-qt-installer /host/download/{{file}} {{install_path}}\n    when: qt_installation_result.stat.exists == False\n  - name: QT Path in .bashrc\n    blockinfile:\n      dest: /home/ci/.bashrc\n      marker_begin: \"QT_PATH_BEGIN\"\n      marker_end: \"QT_PATH_END\"\n      block: |\n        export PATH={{install_path}}/{{qtver}}/gcc_64/bin:$PATH\n    \n"
  },
  {
    "path": "docker/ansible.yml",
    "content": "---\n- hosts: localhost\n  vars:\n    user: ci\n  tasks:\n    - name: Install Ubuntu Packages\n      become: yes\n      become_user: root\n      apt:  name={{item}} state=present update_cache=yes\n      with_items:\n        - build-essential\n        - golang\n        - mesa-common-dev\n        - qbs\n        - git\n        - vim\n        - ca-certificates\n    - name: /etc/sudoers\n      blockinfile:\n        dest: /etc/sudoers\n        block: |\n           ci ALL=(ALL) NOPASSWD: ALL\n    - name: QTCI Path in .bashrc\n      blockinfile:\n        dest: /home/{{user}}/.bashrc\n        marker_begin: \"QTCI_PATH_BEGIN\"\n        marker_end: \"QTCI_PATH_END\"\n        block: |\n           source /host/qtci/path.env\n    - name: Check is qpm installed\n      shell: command -v qpm > /dev/null 2>&1\n      register: is_qpm_exist\n      ignore_errors: true\n    - name: qpm\n      become: yes\n      become_user: root\n      environment:\n        GOPATH: /usr/local\n      shell: \"go get qpm.io/qpm\"\n      when: is_qpm_exist.rc != 0\n"
  },
  {
    "path": "docker/download/README.md",
    "content": ""
  },
  {
    "path": "docker/package.json",
    "content": "{\n  \"name\": \"qtci\",\n  \"version\": \"0.0.1\",\n  \"description\": \"QTCI Docker Environment\",\n  \"main\": \"index.js\",\n  \"config\": {\n    \"docker_image\": \"qtci/qtapp-builder\",\n    \"docker_container\": \"qtapp-builder\",\n    \"docker_container_build_args\": \"\",\n    \"docker_container_exec_args\": \"\"\n  },\n  \"scripts\": {\n  \t\"docker_image_build\": \"docker build --build-arg USERID=`id -u` -t $npm_package_config_docker_image .\",\n  \t\"docker_image_remove\": \"docker image rm  $npm_config_docker_image\",\n  \t\"docker_container_build\": \"run-script-os\",\n      \"docker_container_build:darwin\": \"docker run --name $npm_package_config_docker_container $npm_package_config_docker_container_build_args -v ${PWD}/download:/host/download --name $npm_package_config_docker_containe -d -t $npm_package_config_docker_image\",\n      \"docker_container_build:linux\": \"docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined  -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY $npm_package_config_docker_container_build_args  -v ${PWD}/..:/host/qtci -v ${PWD}/download:/host/download --name $npm_package_config_docker_container -d -t $npm_package_config_docker_image\",\n    \"docker_container_start\": \"docker start $npm_package_config_docker_container\",\n    \"docker_container_remove\": \"docker container stop $npm_package_config_docker_container && docker container rm $npm_package_config_docker_container\",\n    \"docker_container_run_ansible\": \"docker exec --user=`id -u` -e COLUMNS=\\\"`tput cols`\\\" -e LINES=\\\"`tput lines`\\\" -it $npm_package_config_docker_container bash -c 'sudo ansible-playbook /host/qtci/docker/ansible.yml' \",\n    \"use:qt5.9.2\": \"docker exec --user=`id -u` -e COLUMNS=\\\"`tput cols`\\\" -e LINES=\\\"`tput lines`\\\" -it $npm_package_config_docker_container bash -c 'sudo ansible-playbook /host/qtci/docker/ansible-qt5.9.2.yml' \",\n    \"use:qt5.10.1\": \"docker exec --user=`id -u` -it $npm_package_config_docker_container bash -c 'sudo ansible-playbook /host/qtci/docker/ansible-qt5.10.1.yml' \",\n    \"use:qt5.11.2\": \"docker exec --user=`id -u` -e COLUMNS=\\\"`tput cols`\\\" -e LINES=\\\"`tput lines`\\\" -it $npm_package_config_docker_container bash -c 'sudo ansible-playbook /host/qtci/docker/ansible-qt5.11.2.yml' \",\n    \"shell\": \"docker exec --user=`id -u` -e COLUMNS=\\\"`tput cols`\\\" -e LINES=\\\"`tput lines`\\\" -it $npm_package_config_docker_container bash\"\n  },\n  \"author\": \"Ben Lau\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"run-script-os\": \"1.0.3\"\n  }\n}\n"
  },
  {
    "path": "meta/qt-5.11.2-packages.txt",
    "content": "\n[230] QTCI:  Welcome Page\n[1937] QTCI:  Introduction Page\n[1937] QTCI:  Retrieving meta information from remote repository\n[1970] QTCI:  Set target installation page: /tmp/Qt\n[1973] QTCI:  ComponentSelectionPageCallback\n[1980] QTCI:  Available components: 61\n[1980] QTCI:  Packages:  qt qt.qt5.5112 qt.tools qt.license.thirdparty qt.license.gplv3except qt.license.lgpl qt.installer.changelog qt.license.python qt.qt5.5112.gcc_64 qt.qt5.5112.android_x86 qt.qt5.5112.android_armv7 qt.qt5.5112.src qt.qt5.5112.qtcharts qt.qt5.5112.qtdatavis3d qt.qt5.5112.qtpurchasing qt.qt5.5112.qtvirtualkeyboard qt.qt5.5112.qtwebengine qt.qt5.5112.qtnetworkauth qt.qt5.5112.qtremoteobjects qt.qt5.5112.qtwebglplugin qt.qt5.5112.qtscript qt.qt5.5112.doc qt.qt5.5112.examples qt.qt5.5112.qtcharts.android_x86 qt.qt5.5112.qtcharts.android_armv7 qt.qt5.5112.qtcharts.gcc_64 qt.qt5.5112.qtdatavis3d.gcc_64 qt.qt5.5112.qtdatavis3d.android_x86 qt.qt5.5112.qtdatavis3d.android_armv7 qt.qt5.5112.qtpurchasing.android_armv7 qt.qt5.5112.qtpurchasing.android_x86 qt.qt5.5112.qtpurchasing.gcc_64 qt.qt5.5112.qtvirtualkeyboard.gcc_64 qt.qt5.5112.qtwebengine.gcc_64 qt.qt5.5112.qtnetworkauth.gcc_64 qt.qt5.5112.qtnetworkauth.android_armv7 qt.qt5.5112.qtnetworkauth.android_x86 qt.qt5.5112.qtremoteobjects.gcc_64 qt.qt5.5112.qtremoteobjects.android_x86 qt.qt5.5112.qtremoteobjects.android_armv7 qt.qt5.5112.qtwebglplugin.gcc_64 qt.qt5.5112.qtscript.gcc_64 qt.qt5.5112.qtscript.android_x86 qt.qt5.5112.qtscript.android_armv7 qt.qt5.5112.doc.qtscript qt.qt5.5112.doc.qtnetworkauth qt.qt5.5112.doc.qtwebengine qt.qt5.5112.doc.qtvirtualkeyboard qt.qt5.5112.doc.qtremoteobjects qt.qt5.5112.doc.qtpurchasing qt.qt5.5112.doc.qtdatavis3d qt.qt5.5112.doc.qtcharts qt.qt5.5112.examples.qtdatavis3d qt.qt5.5112.examples.qtvirtualkeyboard qt.qt5.5112.examples.qtremoteobjects qt.qt5.5112.examples.qtpurchasing qt.qt5.5112.examples.qtscript qt.qt5.5112.examples.qtnetworkauth qt.qt5.5112.examples.qtwebengine qt.qt5.5112.examples.qtcharts qt.tools.qtcreator\n"
  },
  {
    "path": "path.env",
    "content": "\nDIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nexport PATH=$PATH:$DIR/bin:$DIR/recipes\n\n"
  },
  {
    "path": "recipes/README.md",
    "content": "Scripts to create pre-defined development environment\n"
  },
  {
    "path": "recipes/install-qt",
    "content": "#!/bin/bash -e\n# Reference:\n#   https://github.com/musescore/MuseScore/blob/master/build/travis/job_macos/install.sh\n\nQT_VERSION=${1:-5.12.0}\nQT_TARGET_CATALOG=${2:-$PWD}\nQT_CI_DOWNLOADER=${QT_CI_DOWNLOADER:-\"wget -c -N\"}\n\nif [ \"$(uname)\" = \"Darwin\" ]; then\n  DOWNLOAD_URL=https://download.qt.io/archive/qt/$(echo ${QT_VERSION} | cut -d \".\" -f -2)/${QT_VERSION}/qt-opensource-mac-x64-${QT_VERSION}.dmg\n  COMPILER=clang_64\nelif [ \"$(uname)\" = \"Linux\" ]; then\n  DOWNLOAD_URL=https://download.qt.io/archive/qt/$(echo ${QT_VERSION} | cut -d \".\" -f -2)/${QT_VERSION}/qt-opensource-linux-x64-${QT_VERSION}.run\n  COMPILER=gcc_64\nelse\n  echo \"Unsupported system.\" >&2\n  exit 1\nfi\nINSTALLER=$(basename $DOWNLOAD_URL)\nENVFILE=${QT_TARGET_CATALOG}/qt-${QT_VERSION}.env\n\necho Downloading Qt\n${QT_CI_DOWNLOADER} ${DOWNLOAD_URL} || exit 1\n\necho Installing Qt\nif [ \"$(uname)\" = \"Darwin\" ]; then\n  INSTALLER_NAME=${INSTALLER%.*}\n  APPFILE=/Volumes/${INSTALLER_NAME}/${INSTALLER_NAME}.app/Contents/MacOS/${INSTALLER_NAME}\n  hdiutil attach ${PWD}/${INSTALLER}\n  extract-qt-installer $APPFILE ${QT_TARGET_CATALOG}/Qt\n  hdiutil detach /Volumes/${INSTALLER_NAME}\nelif [ \"$(uname)\" = \"Linux\" ]; then\n  extract-qt-installer ${PWD}/${INSTALLER} ${QT_TARGET_CATALOG}/Qt\nfi\n\necho Create ${ENVFILE}\nif [ -d \"${QT_TARGET_CATALOG}/Qt/${QT_VERSION}/${COMPILER}/bin\" ]; then\n  echo \"export PATH=${QT_TARGET_CATALOG}/Qt/${QT_VERSION}/${COMPILER}/bin:$PATH\" > ${ENVFILE}\nelif [ -d \"${QT_TARGET_CATALOG}/Qt/$(echo ${QT_VERSION} | cut -d \".\" -f -2)/${COMPILER}/bin\" ]; then\n  # some packages use an abbreviated version x.y in the path instead of x.y.z\n  echo \"export PATH=${QT_TARGET_CATALOG}/Qt/$(echo ${QT_VERSION} | cut -d \".\" -f -2)/${COMPILER}/bin:$PATH\" > ${ENVFILE}\nfi\n\n"
  },
  {
    "path": "recipes/install-qt-5.9.2",
    "content": "#!/bin/sh\n\necho Downloading Qt\nINSTALLER=qt-opensource-linux-x64-5.9.2.run\nENVFILE=qt-5.9.2.env\nexport QT_CI_PACKAGES=\"qt.592.gcc_64,qt.592.qtwebengine\" \nwget -q -c https://download.qt.io/archive/qt/5.9/5.9.2/qt-opensource-linux-x64-5.9.2.run\necho Installing Qt\n\necho \"Selected ${QT_CI_PACKAGES} packages\"\nextract-qt-installer $PWD/$INSTALLER $PWD/Qt\n\necho Create $ENVFILE\ncat << EOF > $ENVFILE\nexport PATH=$PWD/Qt/5.9.2/gcc_64/bin:$PATH\nEOF\n"
  },
  {
    "path": "recipes/install-qt-5.9.5-android-19",
    "content": "#!/bin/sh\n\nURL=https://download.qt.io/archive/qt/5.9/5.9.5/qt-opensource-linux-x64-5.9.5.run\nFILE=`basename $URL`\nNAME=qt-5.9.5-android-19\nexport QT_CI_PACKAGES=qt.595.android_armv7\n\necho Downloading Qt\nwget -q -c --no-check-certificate -nv $URL\necho Installing Qt\nextract-qt-installer --disable-progress-report $FILE $PWD/Qt\ninstall-android-sdk platform-tool,build-tools-22.0.1,android-19\n\necho Create $NAME.env\ncat << EOF > $NAME.env\nexport QT_ROOT=$PWD/Qt\nexport QT_HOME=$PWD/Qt/5.9.5\nexport PATH=$PWD/Qt/5.9.5/android_armv7/bin:$PWD/android-sdk-linux/tools:$PATH\nexport ANDROID_NDK_ROOT=$PWD/android-ndk-r17c\nexport ANDROID_SDK_ROOT=$PWD/android-sdk-linux\nEOF\n"
  },
  {
    "path": "recipes/install-qt-online",
    "content": "#!/bin/bash -e\n# Install Qt by online installer\n\nfunction usage() {\n    echo \"Usage:\"\n    echo \"install-qt-online \\\"packages\\\" output_path\"\n    echo \"Example\"\n    echo \"install-qt-online 'qt.qt5.5121.gcc_64' /opt/Qt\"\n    exit -1\n}\n\nif [ $# -lt 2 ]\nthen\n\tusage\nfi\n\nexport QT_CI_PACKAGES=${1}\nQT_TARGET_CATALOG=${2:-$PWD}\nQT_CI_DOWNLOADER=${QT_CI_DOWNLOADER:-\"wget -c -N\"}\n\nif [ \"$(uname)\" = \"Darwin\" ]; then\n  DOWNLOAD_URL=https://download.qt.io/archive/online_installers/3.0/qt-unified-mac-x64-3.0.6-online.dmg\n  COMPILER=clang_64\nelif [ \"$(uname)\" = \"Linux\" ]; then\n  DOWNLOAD_URL=https://download.qt.io/archive/online_installers/3.0/qt-unified-linux-x64-3.0.6-online.run\n  COMPILER=gcc_64\nelse\n  echo \"Unsupported system.\" >&2\n  exit 1\nfi\n\nINSTALLER=$(basename $DOWNLOAD_URL)\nENVFILE=${QT_TARGET_CATALOG}/qt-${QT_VERSION}.env\n\necho Downloading Qt\n${QT_CI_DOWNLOADER} ${DOWNLOAD_URL} || exit 1\n\necho Installing Qt\n\nif [ \"$(uname)\" = \"Darwin\" ]; then\n  INSTALLER_NAME=${INSTALLER%.*}\n  APPFILE=/Volumes/${INSTALLER_NAME}/${INSTALLER_NAME}.app/Contents/MacOS/${INSTALLER_NAME}\n  hdiutil attach ${PWD}/${INSTALLER}\n  extract-qt-installer $APPFILE ${QT_TARGET_CATALOG}/Qt\n  hdiutil detach /Volumes/${INSTALLER_NAME}\nelif [ \"$(uname)\" = \"Linux\" ]; then\n  extract-qt-installer ${PWD}/${INSTALLER} ${QT_TARGET_CATALOG}/Qt\nfi\n\n"
  },
  {
    "path": "recipes/qt-5.5.1",
    "content": "#!/bin/sh\n\necho Downloading Qt\nINSTALLER=qt-opensource-linux-x64-5.5.1.run\nENVFILE=qt-5.5.1.env\nwget -c https://download.qt.io/archive/qt/5.5/5.5.1/qt-opensource-linux-x64-5.5.1.run\necho Installing Qt\nextract-qt-installer $PWD/$INSTALLER $PWD/Qt\n\necho Create $ENVFILE\ncat << EOF > $ENVFILE\nexport PATH=$PWD/Qt/5.5/gcc_64/bin:$PATH\nEOF\n"
  },
  {
    "path": "recipes/qt-5.5.1-android-19",
    "content": "#!/bin/sh\n\necho Qt 5.5.1 + Android is not supported by QtCi any more\nexit -1\necho Downloading Qt\nwget -q -c --no-check-certificate -nv https://download.qt.io/archive/qt/5.5/5.5.1/qt-opensource-linux-x64-android-5.5.1.run\necho Installing Qt\nextract-qt-installer qt-opensource-linux-x64-android-5.5.1.run $PWD/Qt\ninstall-android-sdk platform-tool,build-tools-22.0.1,android-19\n\necho Create qt-5.5.1-android-19.env\ncat << EOF > qt-5.5.1-android-19.env\nexport QT_ROOT=$PWD/Qt\nexport QT_HOME=$PWD/Qt/5.5\nexport PATH=$PWD/Qt/5.5/android_armv7/bin:$PWD/android-sdk-linux/tools:$PATH\nexport ANDROID_NDK_ROOT=$PWD/android-ndk-r17c\nexport ANDROID_SDK_ROOT=$PWD/android-sdk-linux\nEOF\n"
  },
  {
    "path": "recipes/qt-5.5.1-android-travis",
    "content": "#!/bin/sh\n\necho Downloading Qt\nwget -c --no-check-certificate -nv https://download.qt.io/archive/qt/5.5/5.5.1/qt-opensource-linux-x64-android-5.5.1.run\necho Installing Qt\nextract-qt-installer qt-opensource-linux-x64-android-5.5.1.run $PWD/Qt\n\n#Travis do not come with NDK\necho Installing NDK\nwget -c -nv http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin\n(7zr x android-ndk-r10c-linux-x86_64.bin | grep -v ^Extract)\n\necho Create qt-5.5.1-android-travis.env\ncat << EOF > qt-5.5.1-android-travis.env\nexport QT_ROOT=$PWD/Qt\nexport QT_HOME=$PWD/Qt/5.5\nexport ANDROID_SDK_ROOT=/usr/local/android-sdk \nexport ANDROID_NDK_ROOT=$PWD/android-ndk-r10c\nexport PATH=$PWD/Qt/5.5/android_armv7/bin:$PWD/android-sdk-linux/tools:$PATH\nEOF\n"
  },
  {
    "path": "recipes/qt-5.7",
    "content": "#!/bin/sh\n\necho Downloading Qt\nINSTALLER=qt-opensource-linux-x64-5.7.0.run\nENVFILE=qt-5.7.env\nwget -c https://download.qt.io/archive/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run\necho Installing Qt\nextract-qt-installer $PWD/$INSTALLER $PWD/Qt\n\necho Create $ENVFILE\ncat << EOF > $ENVFILE\nexport PATH=$PWD/Qt/5.7/gcc_64/bin:$PATH\nEOF\n"
  },
  {
    "path": "recipes/qt-5.7-osx",
    "content": "#!/bin/sh\n# Reference:\n#   https://github.com/musescore/MuseScore/blob/master/build/travis/job_macos/install.sh\n\necho Downloading Qt\nset -v\nset -e\n\nDOWNLOAD_URL=https://download.qt.io/archive/qt/5.7/5.7.0/qt-opensource-mac-x64-clang-5.7.0.dmg\nINSTALLER=`basename $DOWNLOAD_URL`\nINSTALLER_NAME=${INSTALLER%.*}\nENVFILE=qt-5.7.0-osx.env\nAPPFILE=/Volumes/${INSTALLER_NAME}/${INSTALLER_NAME}.app/Contents/MacOS/${INSTALLER_NAME}\necho $INSTALLER_NAME\necho $APPFILE\n\nwget -c $DOWNLOAD_URL\nhdiutil mount ${INSTALLER}\nls /Volumes\necho Installing Qt\nextract-qt-installer $APPFILE $PWD/Qt\n\necho Create $ENVFILE\ncat << EOF > $ENVFILE\nexport PATH=$PWD/Qt/5.7/clang_64/bin:$PATH\nEOF\n"
  },
  {
    "path": "recipes/qt-5.8.0",
    "content": "#!/bin/sh\n\necho Downloading Qt\nINSTALLER=qt-opensource-linux-x64-5.8.0.run\nENVFILE=qt-5.8.0.env\nwget -q -c https://download.qt.io/archive/qt/5.8/5.8.0/qt-opensource-linux-x64-5.8.0.run\necho Installing Qt\nextract-qt-installer $PWD/$INSTALLER $PWD/Qt\n\necho Create $ENVFILE\ncat << EOF > $ENVFILE\nexport PATH=$PWD/Qt/5.8/gcc_64/bin:$PATH\nEOF\n"
  },
  {
    "path": "recipes/qt-5.9.5-osx",
    "content": "#!/bin/sh\n# Reference:\n#   https://github.com/musescore/MuseScore/blob/master/build/travis/job_macos/install.sh\n\necho Downloading Qt\nset -v\nset -e\n\nDOWNLOAD_URL=https://download.qt.io/archive/qt/5.9/5.9.5/qt-opensource-mac-x64-5.9.5.dmg\nINSTALLER=`basename $DOWNLOAD_URL`\nINSTALLER_NAME=${INSTALLER%.*}\nENVFILE=qt-5.9.5-osx.env\nAPPFILE=/Volumes/${INSTALLER_NAME}/${INSTALLER_NAME}.app/Contents/MacOS/${INSTALLER_NAME}\necho $INSTALLER_NAME\necho $APPFILE\n\nwget -nv -c $DOWNLOAD_URL\nhdiutil attach ${INSTALLER}\nls /Volumes\necho Installing Qt\nextract-qt-installer $APPFILE $PWD/Qt\nhdiutil detach /Volumes/${INSTALLER_NAME}\n\necho Create $ENVFILE\ncat << EOF > $ENVFILE\nexport PATH=$PWD/Qt/5.9.5/clang_64/bin:$PATH\nEOF\n"
  }
]