~zsombi/ubuntu-ui-toolkit/10-viewitem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env sh
#
# Copyright 2013 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
QML="modules/Ubuntu/*/qmldir modules/Ubuntu/Components/*/qmldir"
CPP="Ubuntu.Components Ubuntu.Layouts Ubuntu.PerformanceMetrics Ubuntu.Test"

echo Dumping QML API of C++ components
echo '' > plugins.qmltypes
ERRORS=0
for i in $CPP; do
    # Silence spam on stderr due to fonts
    # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
    # https://bugreports.qt-project.org/browse/QTBUG-36243
    ALARM_BACKEND=memory qmlplugindump $i 0.1 modules 1>> plugins.qmltypes
    test $? != 0 && ERRORS=1
done
test $ERRORS = 1 && echo Error: qmlplugindump failed && exit 1

echo Running QML API check for $QML
# Palette and UbuntuColors gets included in Qt > 5.2 qmlplugindump even though it's qml
BUILTINS=QQuick,QQml,U1db::,Palette,UbuntuColors python3 tests/qmlapicheck.py $QML plugins.qmltypes > components.api.new
test $? != 0 && echo Error: qmlapicheck.py failed && exit 1

echo Verifying the diff between existing and generated API
diff -Fqml -u components.api components.api.new
test $? != 0 && ERRORS=1

if [ "x$ERRORS" != "x1" ]; then
    echo API is all fine.
    exit 0
else
    echo API test failed with errors. Did you forget to update components.api?
    exit 1
fi