Merge lp:~osomon/oxide/versions into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: 1442
Proposed branch: lp:~osomon/oxide/versions
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 204 lines (+85/-5)
8 files modified
qt/core/api/oxideqglobal.cc (+13/-1)
qt/core/api/oxideqglobal.h (+5/-2)
qt/core/common/oxide_version.h.in (+23/-0)
qt/core/core.gyp (+18/-0)
qt/qmlplugin/oxide.qmltypes (+2/-0)
qt/quick/api/oxideqquickglobal.cc (+9/-1)
qt/quick/api/oxideqquickglobal_p.h (+7/-1)
qt/tests/qmltests/api/tst_OxideGlobal.qml (+8/-0)
To merge this branch: bzr merge lp:~osomon/oxide/versions
Reviewer Review Type Date Requested Status
Chris Coulson Approve
Review via email: mp+291518@code.launchpad.net

Commit message

Add a 'version' and a 'chromiumVersion' properties to the Oxide global object.

To post a comment you must log in.
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks for this.

My main issue with this is that it leaves a build artefact in the source tree - pre-processed headers should be in the build directory really. It may be non-trivial with the current approach (using cmake to create a header for the core library, configured with gyp) to include a header from the build-directory - you'd probably need to pass an include path to gyp just for this.

It might be better to generate this the same way that chrome_version.h is already generated (from gyp, using third_party/chromium/src/build/util/version.py and having the file in qt/core/common). I just verified that it's possible to re-use Chromium's version.py (qt/VERSION is formatted to work with this already).

I've left a couple of comments inline too.

review: Needs Fixing
lp:~osomon/oxide/versions updated
1432. By Olivier Tilloy

No static constructors.

1433. By Olivier Tilloy

Rename oxideGetOxideVersion() to oxideGetVersion().

1434. By Olivier Tilloy

Generate oxide_version.h from gyp to avoid leaving a build artefact in the source tree.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Comments addressed.

Revision history for this message
Chris Coulson (chrisccoulson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qt/core/api/oxideqglobal.cc'
2--- qt/core/api/oxideqglobal.cc 2016-04-02 13:30:04 +0000
3+++ qt/core/api/oxideqglobal.cc 2016-04-14 13:18:24 +0000
4@@ -1,5 +1,5 @@
5 // vim:expandtab:shiftwidth=2:tabstop=2:
6-// Copyright (C) 2014 Canonical Ltd.
7+// Copyright (C) 2014-2016 Canonical Ltd.
8
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11@@ -28,7 +28,9 @@
12
13 #include "qt/core/browser/oxide_qt_browser_platform_integration.h"
14 #include "qt/core/browser/oxide_qt_browser_startup.h"
15+#include "qt/core/common/oxide_version.h"
16 #include "shared/browser/oxide_browser_process_main.h"
17+#include "shared/common/chrome_version.h"
18
19 using namespace oxide::qt;
20
21@@ -113,3 +115,13 @@
22
23 content::RenderProcessHost::SetMaxRendererProcessCount(count);
24 }
25+
26+QString oxideGetChromeVersion() {
27+ static QString kChromeVersion = QStringLiteral(CHROME_VERSION_STRING);
28+ return kChromeVersion;
29+}
30+
31+QString oxideGetVersion() {
32+ static QString kOxideVersion = QStringLiteral(OXIDE_VERSION_STRING);
33+ return kOxideVersion;
34+}
35
36=== modified file 'qt/core/api/oxideqglobal.h'
37--- qt/core/api/oxideqglobal.h 2016-01-13 18:16:11 +0000
38+++ qt/core/api/oxideqglobal.h 2016-04-14 13:18:24 +0000
39@@ -1,5 +1,5 @@
40 // vim:expandtab:shiftwidth=2:tabstop=2:
41-// Copyright (C) 2014 Canonical Ltd.
42+// Copyright (C) 2014-2016 Canonical Ltd.
43
44 // This library is free software; you can redistribute it and/or
45 // modify it under the terms of the GNU Lesser General Public
46@@ -57,4 +57,7 @@
47 OXIDE_QTCORE_EXPORT size_t oxideGetMaxRendererProcessCount();
48 OXIDE_QTCORE_EXPORT void oxideSetMaxRendererProcessCount(size_t count);
49
50-#endif // OXIDE_QTCORe_GLOBAL
51+OXIDE_QTCORE_EXPORT QString oxideGetChromeVersion();
52+OXIDE_QTCORE_EXPORT QString oxideGetVersion();
53+
54+#endif // OXIDE_QTCORE_GLOBAL
55
56=== added directory 'qt/core/common'
57=== added file 'qt/core/common/oxide_version.h.in'
58--- qt/core/common/oxide_version.h.in 1970-01-01 00:00:00 +0000
59+++ qt/core/common/oxide_version.h.in 2016-04-14 13:18:24 +0000
60@@ -0,0 +1,23 @@
61+// vim:expandtab:shiftwidth=2:tabstop=2:
62+// Copyright (C) 2016 Canonical Ltd.
63+
64+// This library is free software; you can redistribute it and/or
65+// modify it under the terms of the GNU Lesser General Public
66+// License as published by the Free Software Foundation; either
67+// version 2.1 of the License, or (at your option) any later version.
68+
69+// This library is distributed in the hope that it will be useful,
70+// but WITHOUT ANY WARRANTY; without even the implied warranty of
71+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
72+// Lesser General Public License for more details.
73+
74+// You should have received a copy of the GNU Lesser General Public
75+// License along with this library; if not, write to the Free Software
76+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
77+
78+#ifndef OXIDE_QTCORE_COMMON_VERSION
79+#define OXIDE_QTCORE_COMMON_VERSION
80+
81+#define OXIDE_VERSION_STRING "@MAJOR@.@MINOR@.@PATCH@"
82+
83+#endif // OXIDE_QTCORE_COMMON_VERSION
84
85=== modified file 'qt/core/core.gyp'
86--- qt/core/core.gyp 2016-04-09 18:08:10 +0000
87+++ qt/core/core.gyp 2016-04-14 13:18:24 +0000
88@@ -59,6 +59,7 @@
89 '<(INTERMEDIATE_DIR)',
90 'api/includes',
91 '<(DEPTH)',
92+ '<(SHARED_INTERMEDIATE_DIR)/oxide',
93 ],
94 'ldflags': [
95 '-Wl,-rpath=\$$ORIGIN/<(oxide_libexecdir)',
96@@ -323,6 +324,23 @@
97 'moc_input': 'browser/oxide_qt_url_request_delegated_job.cc',
98 'includes': [ 'moc.gypi' ]
99 },
100+ {
101+ 'action_name': 'oxide_version_header',
102+ 'inputs': [
103+ 'common/oxide_version.h.in',
104+ '../VERSION'
105+ ],
106+ 'outputs': [
107+ '<(SHARED_INTERMEDIATE_DIR)/oxide/qt/core/common/oxide_version.h'
108+ ],
109+ 'action': [
110+ 'python',
111+ '<(DEPTH)/build/util/version.py',
112+ '-f', '../VERSION',
113+ '-i', '<@(_inputs)',
114+ '-o', '<@(_outputs)'
115+ ]
116+ },
117 ],
118 'conditions': [
119 ['component=="shared_library"', {
120
121=== modified file 'qt/qmlplugin/oxide.qmltypes'
122--- qt/qmlplugin/oxide.qmltypes 2016-04-04 15:11:30 +0000
123+++ qt/qmlplugin/oxide.qmltypes 2016-04-14 13:18:24 +0000
124@@ -253,6 +253,8 @@
125 Property { name: "maxRendererProcessCount"; type: "int" }
126 Property { name: "availableAudioCaptureDevices"; type: "QVariant"; isReadonly: true }
127 Property { name: "availableVideoCaptureDevices"; type: "QVariant"; isReadonly: true }
128+ Property { name: "chromiumVersion"; type: "string"; isReadonly: true }
129+ Property { name: "version"; type: "string"; isReadonly: true }
130 Method { name: "defaultWebContext"; type: "OxideQQuickWebContext*" }
131 }
132 Component {
133
134=== modified file 'qt/quick/api/oxideqquickglobal.cc'
135--- qt/quick/api/oxideqquickglobal.cc 2016-01-13 18:16:11 +0000
136+++ qt/quick/api/oxideqquickglobal.cc 2016-04-14 13:18:24 +0000
137@@ -1,5 +1,5 @@
138 // vim:expandtab:shiftwidth=2:tabstop=2:
139-// Copyright (C) 2013-2015 Canonical Ltd.
140+// Copyright (C) 2013-2016 Canonical Ltd.
141
142 // This library is free software; you can redistribute it and/or
143 // modify it under the terms of the GNU Lesser General Public
144@@ -211,4 +211,12 @@
145 return d->video_capture_devices_;
146 }
147
148+QString OxideQQuickGlobal::chromiumVersion() const {
149+ return oxideGetChromeVersion();
150+}
151+
152+QString OxideQQuickGlobal::oxideVersion() const {
153+ return oxideGetVersion();
154+}
155+
156 #include "moc_oxideqquickglobal_p.cpp"
157
158=== modified file 'qt/quick/api/oxideqquickglobal_p.h'
159--- qt/quick/api/oxideqquickglobal_p.h 2016-01-13 18:16:11 +0000
160+++ qt/quick/api/oxideqquickglobal_p.h 2016-04-14 13:18:24 +0000
161@@ -1,5 +1,5 @@
162 // vim:expandtab:shiftwidth=2:tabstop=2:
163-// Copyright (C) 2013-2015 Canonical Ltd.
164+// Copyright (C) 2013-2016 Canonical Ltd.
165
166 // This library is free software; you can redistribute it and/or
167 // modify it under the terms of the GNU Lesser General Public
168@@ -37,6 +37,9 @@
169 Q_PROPERTY(QVariant availableAudioCaptureDevices READ availableAudioCaptureDevices NOTIFY availableAudioCaptureDevicesChanged)
170 Q_PROPERTY(QVariant availableVideoCaptureDevices READ availableVideoCaptureDevices NOTIFY availableVideoCaptureDevicesChanged)
171
172+ Q_PROPERTY(QString chromiumVersion READ chromiumVersion CONSTANT)
173+ Q_PROPERTY(QString version READ oxideVersion CONSTANT)
174+
175 Q_ENUMS(ProcessModel)
176
177 Q_DECLARE_PRIVATE(OxideQQuickGlobal)
178@@ -66,6 +69,9 @@
179 QVariant availableAudioCaptureDevices();
180 QVariant availableVideoCaptureDevices();
181
182+ QString chromiumVersion() const;
183+ QString oxideVersion() const;
184+
185 Q_INVOKABLE OxideQQuickWebContext* defaultWebContext();
186
187 Q_SIGNALS:
188
189=== modified file 'qt/tests/qmltests/api/tst_OxideGlobal.qml'
190--- qt/tests/qmltests/api/tst_OxideGlobal.qml 2016-03-24 23:23:20 +0000
191+++ qt/tests/qmltests/api/tst_OxideGlobal.qml 2016-04-14 13:18:24 +0000
192@@ -28,4 +28,12 @@
193 compare(devices[0].displayName.substr(0, 13), "fake_device_0");
194 compare(devices[0].position, "unspecified");
195 }
196+
197+ function test_OxideGlobal3_chromiumVersion() {
198+ verify(/^\d+\.\d+\.\d+\.\d+$/.test(Oxide.chromiumVersion));
199+ }
200+
201+ function test_OxideGlobal3_oxideVersion() {
202+ verify(/^\d+\.\d+\.\d+$/.test(Oxide.version));
203+ }
204 }

Subscribers

People subscribed via source and target branches