Build and Test

Version added 26-Jun-2018| Modified 20-Sep-2018

After developing the QML app, you must build and verify its functionality.

 

Add Recipe File

webOS OSE uses OpenEmbedded of Yocto project to build its components. You must write a recipe that configures the build environment. For more details about the recipe, see Yocto project reference manual.

  • Create and update the file : <qml-app-name>.bb

  • Directory : build-webos/meta-webosose/meta-webos/recipes-webos/<qml-app-name>

where <qml-app-name> is the name of the qml app. For the sample qml app, <qml-app-name> must be replaced by 'com.example.app.qml'.

SUMMARY = "QML App"
SECTION = "webos/apps"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
 
DEPENDS = "qtbase qt-features-webos qtdeclarative"
RDEPENDS_${PN} += "qml-webos-framework qml-webos-bridge"

WEBOS_VERSION="1.0.0"
PR = "r0"
 
inherit webos_qmake5
inherit webos_submissions
inherit webos_app
 
FILES_${PN} += "${webos_applicationsdir}"

A brief explanation of the above file:

  • Line(1~4) : Basic descriptions of the component.

  • Line(6) : Lists a package's build dependencies. Add "qtbase", "qt-features-webos", "qtdeclarative".

  • Line(7) : Lists a package's runtime dependencies (other packages) that must be installed in order for the built package to run correctly. Add "qml-webos-bridge" and "qml-webos-framework".

  • Line(9) : Version of the component. For the webOS OSE component, this field is mandatory.

  • Line(10) : Revision version of the recipe. Each recipe requires a counter to track its modification history. Make sure that you increment the version when you edit the recipe, unless you only change the value of the WEBOS_VERSION field or comments.

  • Line(12) :  webos_qmake5, component that uses qmake for configuration.

  • Line(13) : Inherit the WEBOS_VERSION value. If you develop your component on a local repository, this entry is required.

  • Line(14) : Added since the component is an app.

  • Line(16) : ${webos_applicationsdir} indicates /usr/palm/applications, ${PN} is package name. com.example.app.qml set to ${PN}.

 

Configure Local Source Directory

To build a component that is located on the local system, you must specify the directory information.

  • Create and update the file : webos-local.conf

  • Directory : build-webos

For the sample QML app (com.example.app.qml), you must provide the local path where the source exists.

INHERIT += "externalsrc"
EXTERNALSRC_pn-com.example.app.qml = "/home/username/project/com.example.app.qml/"
EXTERNALSRC_BUILD_pn-com.example.app.qml = "/home/username/project/com.example.app.qml/build/"
PR_append_pn-com.example.app.qml =".local0"

A brief explanation of the above file:

  • Line(1) : Inherit "externalsrc" bbclass.

  • Line(2) : The local source directory. It is recommended that all path to webos-local directory end with a /.

  • Line(3) : The local build directory.

  • Line(4) : [Optional] Set appended PR version for local source build.

 

Build, Run, and Verify

  1. Build the QML app.

    To build the component on the OpenEmbedded environment, enter the following commands on the shell:

    build-webos$ source oe-init-build-env
    build-webos$ bitbake com.example.app.qml

    For more information, see Building webOS OSE.

  2. Copy the IPK to target.

    com.example.app.qml
    ├── README.md
    ├── appinfo.json
    ├── build
    ├── com.example.app.qml.pro
    ├── icon.png
    ├── main.qml
    ├── oe-logs -> /home/username/build/build-webos/BUILD/work/raspberrypi3-webos-linux-gnueabi/com.example.app.qml/1.0.0-r0.local0/temp
    └── oe-workdir -> /home/username/build/build-webos/BUILD/work/raspberrypi3-webos-linux-gnueabi/com.example.app.qml/1.0.0-r0.local0

    When the build is successful, oe-related directories are created under the root directory. These directories are linked to the directory where the build output is generated from the actual build-webos sub-directory.

    If you go to oe-workdir/deploy-ipks/raspberrypi3, you can see that com.example.app.qml_1.0.0-r0.local0_raspberrypi3.ipk file.

    com.example.app.qml/oe-workdir/deploy-ipks/raspberrypi3$
    └── com.example.app.qml_1.0.0-r0.local0_raspberrypi3.ipk

    Copy the IPK file to target.

    ~/project/com.example.app.qml/oe-workdir/deploy-ipks/raspberrypi3$ scp com.example.app.qml_1.0.0-r0.local0_raspberrypi3.ipk root@192.168.0.5:/media/internal/downloads/
    
  3. Install the app on the target.

    Connect to target with ssh and install com.example.app.qml_1.0.0-r0.local0_raspberrypi3.ipk

    $ ssh root@192.168.0.5
    root@raspberrypi3:~# cd /media/internal/downloads/
    root@raspberrypi3:/media/internal/downloads# opkg install com.example.app.qml_1.0.0-r0.local0_raspberrypi3.ipk
    Installing com.example.app.qml (1.0.0) on root.
    Configuring com.example.app.qml.
  4. Discovery of LS2 configuration files.

    In order to make LS2 daemon scan the LS2 configuration files of com.example.app.qml, enter 'ls-control' command or reboot target.

    root@raspberrypi3:/media/internal/downloads# ls-control scan-services
      telling hub to reload setting and rescan all directories
  5. Restart SAM or reboot target.

    This step is required so that app is scanned by SAM.

    root@raspberrypi3:/# systemctl restart sam
  6. Run the QML app.

    Use the "windows" key or "F1" key on keyboard to show the Launcher. Click the app icon to see the window titled "QML app" with the following page:

    qml-app-display.jpg

  7. Verify the execution of the QML app.

    • Using SAM:

      You can check whether the app is running by using SAM. For more SAM methods, see com.webos.service.applicationmanager.

      luna-send -i -f luna://com.webos.service.applicationmanager/running '{"subscribe":true}'
      {
          "subscribed": true,
          "running": [
              {
                  "id": "com.example.app.qml",
                  "webprocessid": "",
                  "defaultWindowType": "card",
                  "appType": "native_qml",
                  "processid": "2779"
              }
          ],
          "returnValue": true
      }
    • Using Logs:

      • When the app launched at first.

        When the app is launched and registered by SAM successfully, it gets "registered" message in response from SAM. (in /var/log/messages on target)

        user.info qml-runner [] QMLApp REGISTER_APP {
            "payload": {
                "message": "registered",
                "returnValue": true     
            }
        }
      • Launch the app when the app is in foreground and running.

        Specify the "params" parameter to pass specific value to the app via SAM as follows:

        root@raspberrypi3:~# luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id":"com.example.app.qml", "params":{"count":"second launch"}}'
        {
            "returnValue": true
        }

        See the log.

        user.info qml-runner [] QMLApp REGISTER_APP {
            "payload": {
                "message": "relaunch",
                "parameters": {
                    "count": "second launch"
                },
            "returnValue": true     
            }
        }
Except as noted, this content is licensed under Creative Commons Attribution 4.0 and sample code is licensed under Apache License 2.0.