Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 52 additions & 44 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ jobs:
name: Run integration tests
command: export PATH=.:$PATH && npm --prefix ./glean run test:integration

samples-tests:
webext-sample-tests:
docker:
- image: cimg/python:3.8.8-node
steps:
- checkout
- run:
name: Install JavaScript dependencies for Glean
command: npm --prefix ./glean install
# JS webext sample related jobs
# JS sample related jobs
- run:
name: Install JavaScript dependencies for the JS web extension sample
command: |
Expand All @@ -88,7 +88,7 @@ jobs:
name: Run JS web extension sample test
command: |
export PATH=.:$PATH && npm --prefix ./samples/web-extension/javascript run test
# TS webext sample related jobs
# TS sample related jobs
- run:
name: Install Typescript dependencies for the TS web extension sample
command: |
Expand All @@ -102,7 +102,15 @@ jobs:
name: Run TS web extension sample test
command: |
export PATH=.:$PATH && npm --prefix ./samples/web-extension/typescript run test
# Node.js sample related jobs

node-sample-tests:
docker:
- image: cimg/python:3.8.8-node
steps:
- checkout
- run:
name: Install JavaScript dependencies for Glean
command: npm --prefix ./glean install
- run:
name: Install JavaScript dependencies for the Node.js sample
command: |
Expand All @@ -117,55 +125,54 @@ jobs:
command: |
export PATH=.:$PATH && npm --prefix ./samples/node run test

check-size:
qt-sample-tests:
docker:
- image: cimg/node:16.1.0
- image: cimg/python:3.8.8-node
steps:
- checkout
- run:
name: Get and post build sizes to GitHub PR
command: |
./benchmarks/run.sh

check-qt-js:
docker:
- image: cimg/python:3.9.4-node
steps:
- checkout
name: Install JavaScript dependencies for Glean
command: npm --prefix ./glean install
- run:
name: Install JavaScript dependencies and build Glean.js for Qt
name: Install Qt dependencies
command: |
npm --prefix ./glean install
npm --prefix ./glean run build:qt
sudo apt-get update
sudo apt-get install -y gcc g++ make cmake \
qtbase5-dev qt5-default qt5-qmake qttools5-dev-tools qtdeclarative5-dev \
qtdeclarative5-dev-tools qml-module-qttest qml-module-qtquick2 \
qml-module-qtquick-localstorage qml-module-qtquick-controls2
sudo apt-get install xvfb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why's that separate and not part of the first apt-get install?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, no reason really. It is not direcly Qt related, and I added it at a different time during development.

- run:
name: Setup Qt dependency
name: Build and install Qt Glean.js library
command: |
# The following commands are copied from the VPN Qt setup for Linux
# See: https://github.com/mozilla-mobile/mozilla-vpn-client/blob/main/.github/workflows/linux.yaml#L18-L21
#
# Add external PPA, latest version of QT is 5.12.x for Ubuntu 20.04
sudo add-apt-repository ppa:beineri/opt-qt-5.15.2-focal -y
sudo apt update
sudo apt install git qt515tools qt515svg qt515networkauth-no-lgpl qt515charts-no-lgpl libgl-dev libpolkit-gobject-1-dev devscripts debhelper cdbs quilt qt515graphicaleffects qt515imageformats qt515quickcontrols2 libxcb-image0-dev libxcb-shape0-dev libxcb-sync0-dev libxcb-render-util0-dev libxcb-xfixes0-dev libxcb-icccm4-dev libx11-xcb-dev libxcb-keysyms1-dev libasound2-dev libaudio-dev libcups2-dev libdbus-1-dev libglu1-mesa-dev libmng-dev libtiff5-dev libxcursor-dev libxi-dev libxinerama-dev libxmu-dev libxrandr-dev libxv-dev libedit-dev libvulkan-dev qt515websockets -y
npm --prefix ./glean run build:qt
cp -r glean/dist/qt/org/ samples/qt/src/App/org/
- run:
name: Run the Qt sample app and check for errors
name: Build the Node.js Glean generated files sample
command: |
cd samples/qt-qml-app
cd samples/qt
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
glean_parser translate metrics.yaml pings.yaml -f javascript -o generated \
--option platform=qt --option version="0.22"
glean_parser translate src/App/metrics.yaml src/App/pings.yaml \
-f javascript -o src/App/generated \
--option platform=qt --option version="0.22"
- run:
name: Run Qt sample tests
command: |
cd samples/qt
qmake -r
QML_IMPORT_TRACE=1 xvfb-run make check

sudo apt-get install xvfb
xvfb-run python main.py &> qml.log &
# Wait for app to start
sleep 10
if ! grep -q "Initialized Glean succesfully." "qml.log"; then
echo "\n\n\033[1;91m** Failed to initialize Glean in Qt! See more logs below. **\033[0m\n\n"
cat qml.log
exit 1
fi
check-size:
docker:
- image: cimg/node:16.1.0
steps:
- checkout
- run:
name: Get and post build sizes to GitHub PR
command: |
./benchmarks/run.sh

# via https://circleci.com/blog/deploying-documentation-to-github-pages-with-continuous-integration/
docs-deploy:
Expand Down Expand Up @@ -195,7 +202,6 @@ jobs:
git config user.name "moz-glean"
npm --prefix ./glean run publish:docs


publish:
docker:
- image: cimg/node:16.1.0
Expand Down Expand Up @@ -233,15 +239,17 @@ workflows:
jobs:
- lint
- test
- check-qt-js
- samples-tests
- webext-sample-tests
- node-sample-tests
- qt-sample-tests
- hold:
type: approval
requires:
- lint
- test
- check-qt-js
- samples-tests
- webext-sample-tests
- node-sample-tests
- qt-sample-tests
filters:
branches:
ignore:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.22.0...main)

* [#811](https://github.com/mozilla/glean.js/pull/811): Apply various fixes to the Qt entry point file.
* Expose `ErrorType`. This is only useful for testing purposes;
* Fix version of `QtQuick.LocalStorage` plugin;
* Fix the way to access the lib from inside the `shutdown` method. Previous to this fix, it is not possible to use the `shutdown` method;
* Expose the `Glean.testRestGlean` API.

# v0.22.0 (2021-10-06)

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.21.1...v0.22.0)
Expand Down
3 changes: 1 addition & 2 deletions bin/update-glean-parser-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ run $SED -i.bak -E \
"${WORKSPACE_ROOT}/${FILE}"
run rm "${WORKSPACE_ROOT}/${FILE}.bak"

# Update the version in samples/qt-qml-app/requirements.txt
FILE=samples/qt-qml-app/requirements.txt
FILE=samples/qt/requirements.txt
run $SED -i.bak -E \
-e "s/glean_parser==[0-9.]+/glean_parser==${NEW_VERSION}/" \
"${WORKSPACE_ROOT}/${FILE}"
Expand Down
24 changes: 22 additions & 2 deletions glean/src/index/qt.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

.pragma library

.import QtQuick.LocalStorage 2.15 as LocalStorage
.import QtQuick.LocalStorage 2.0 as LocalStorage
.import "glean.lib.js" as Glean

const ErrorType = Glean.Glean.default.ErrorType;

/**
* Initialize Glean. This method should only be called once, subsequent calls will be no-op.
*
Expand Down Expand Up @@ -99,7 +101,25 @@ function setSourceTags(value) {
* @returns A promise which resolves once shutdown is complete.
*/
function shutdown() {
return Glean.shutdown();
return Glean.Glean.default.shutdown();
}

/**
* Test-only API**
*
* Resets the Glean singleton to its initial state and re-initializes it.
*
* TODO: Only allow this function to be called on test mode (depends on Bug 1682771).
*
* @param applicationId The application ID (will be sanitized during initialization).
* @param uploadEnabled Determines whether telemetry is enabled.
* If disabled, all persisted metrics, events and queued pings (except
* first_run_date) are cleared. Default to `true`.
* @param config Glean configuration options.
* @returns A promise that resolves when the initialization is complete.
*/
function testResetGlean(applicationId, uploadEnabled, config) {
return Glean.Glean.default.testResetGlean(applicationId, uploadEnabled, config);
}

const _private = Glean.Glean.default._private;
41 changes: 0 additions & 41 deletions samples/qt-qml-app/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions samples/qt-qml-app/main.py

This file was deleted.

3 changes: 0 additions & 3 deletions samples/qt-qml-app/requirements.txt

This file was deleted.

78 changes: 78 additions & 0 deletions samples/qt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*

# QtCreator 4.8< compilation database
compile_commands.json

# QtCreator local machine specific files for imported projects
*creator.user*

*_qmlcache.qrc

# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb

# Xcode artifacts
.xcode/
Debug-*/
Release-*/
Info.plist

# Glean stuff
generated/
org/

# Generated stuff
*.app/
*.qrc
Loading