Ver código fonte

Add build number into versioning scheme

This is an enabler to improve update experience
Daniel Molkentin 12 anos atrás
pai
commit
f5e8efd435

+ 5 - 4
OwnCloudCPack.cmake

@@ -9,10 +9,11 @@ else ()
 endif()
 
 include( VERSION.cmake )
-set( CPACK_PACKAGE_VERSION_MAJOR  ${VERSION_MAJOR} )
-set( CPACK_PACKAGE_VERSION_MINOR  ${VERSION_MINOR} )
-set( CPACK_PACKAGE_VERSION_PATCH  ${VERSION_PATCH} )
-set( CPACK_PACKAGE_VERSION  ${VERSION} )
+set( CPACK_PACKAGE_VERSION_MAJOR  ${MIRALL_VERSION_MAJOR} )
+set( CPACK_PACKAGE_VERSION_MINOR  ${MIRALL_VERSION_MINOR} )
+set( CPACK_PACKAGE_VERSION_PATCH  ${MIRALL_VERSION_PATCH} )
+set( CPACK_PACKAGE_VERSION_BUILD  ${MIRALL_VERSION_BUILD} )
+set( CPACK_PACKAGE_VERSION  ${MIRALL_VERSION_FULL} )
 
 if(APPLE)
     set( CPACK_GENERATOR "DragNDrop" )

+ 20 - 5
VERSION.cmake

@@ -1,6 +1,21 @@
-set( VERSION_MAJOR 1 )
-set( VERSION_MINOR 5 )
-set( VERSION_PATCH 0 )
-set( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}beta2")
-set( SOVERSION 0 )
+set( MIRALL_VERSION_MAJOR 1 )
+set( MIRALL_VERSION_MINOR 5 )
+set( MIRALL_VERSION_PATCH 0 )
+set( MIRALL_SOVERSION 0 )
 
+set( MIRALL_VERSION_SUFFIX "" CACHE STRING "e.g. beta1, beta2, rc1" )
+set( MIRALL_VERSION_BUILD  "0" CACHE STRING "Integer ID. Generated by the build system")
+
+# Composite defines
+# Used e.g. for libraries Keep at x.y.z.
+set( MIRALL_VERSION "${MIRALL_VERSION_MAJOR}.${MIRALL_VERSION_MINOR}.${MIRALL_VERSION_PATCH}" )
+# Version with Build ID. Used in the installer
+set( MIRALL_VERSION_FULL ${MIRALL_VERSION} )
+set( MIRALL_VERSION_STRING ${MIRALL_VERSION} )
+set( MIRALL_VERSION_FULL "${MIRALL_VERSION_FULL}.${MIRALL_VERSION_BUILD}" )
+
+if( MIRALL_VERSION_SUFFIX )
+  set( MIRALL_VERSION_STRING "${MIRALL_VERSION} ${MIRALL_VERSION_SUFFIX} (build ${MIRALL_VERSION_BUILD})" )
+else( MIRALL_VERSION_SUFFIX )
+  set( MIRALL_VERSION_STRING "${MIRALL_VERSION} (build ${MIRALL_VERSION_BUILD})" )
+endif( MIRALL_VERSION_SUFFIX )

+ 3 - 3
cmake/modules/MacOSXBundleInfo.plist.in

@@ -17,15 +17,15 @@
         <key>CFBundleInfoDictionaryVersion</key>
         <string>6.0</string>
         <key>CFBundleLongVersionString</key>
-        <string>@APPLICATION_NAME@ @VERSION@</string>
+        <string>@APPLICATION_NAME@ @MIRALL_VERSION_FULL@</string>
         <key>CFBundlePackageType</key>
         <string>APPL</string>
         <key>CFBundleSignature</key>
         <string>????</string>
         <key>CFBundleVersion</key>
-        <string>@VERSION@</string>
+        <string>@VERSION_FULL@</string>
         <key>CFBundleShortVersionString</key>
-        <string>@VERSION@</string>
+        <string>@VERSION_FULL@</string>
         <key>NSHumanReadableCopyright</key>
         <string>(C) 2012 @APPLICATION_VENDOR@</string>
 </dict>

+ 7 - 3
cmake/modules/NSIS.template.in

@@ -49,7 +49,8 @@
 
 !define VER_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@"
 !define VER_MINOR "@CPACK_PACKAGE_VERSION_MINOR@"
-!define VER_BUILD "@CPACK_PACKAGE_VERSION_PATCH@"
+!define VER_PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
+!define VER_BUILD "@CPACK_PACKAGE_VERSION_BUILD@"
 !define VERSION "@CPACK_PACKAGE_VERSION@"
 
 ;-----------------------------------------------------------------------------
@@ -205,7 +206,10 @@ Function PageReinstall
    IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
    minor_check:
       ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
-      IntCmp $R0 ${VER_MINOR} build_check new_version older_version
+      IntCmp $R0 ${VER_MINOR} rev_check new_version older_version
+   rev_check:
+      ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
+      IntCmp $R0 ${VER_PATCH} build_check new_version older_version
    build_check:
       ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
       IntCmp $R0 ${VER_BUILD} same_version new_version older_version
@@ -410,7 +414,7 @@ Section -post
    WriteRegStr HKLM "Software\${APPLICATION_NAME}" "" $INSTDIR
    WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
    WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
-   WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${REVISION}"
+   WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
    WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
 
    ;Add or Remove Programs entry.

+ 2 - 2
src/CMakeLists.txt

@@ -199,8 +199,8 @@ add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc})
 qt5_use_modules(${synclib_NAME} Widgets Network Xml WebKitWidgets Sql)
 
 set_target_properties( ${synclib_NAME}  PROPERTIES
-	VERSION ${VERSION}
-	SOVERSION ${SOVERSION}
+	VERSION ${MIRALL_VERSION}
+	SOVERSION ${MIRALL_SOVERSION}
 )
 
 target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} )

+ 1 - 1
src/mirall/owncloudtheme.cpp

@@ -60,7 +60,7 @@ QString ownCloudTheme::about() const
                "Based on Mirall by Duncan Mac-Vicar P.</small></p>"
                "%7"
                )
-            .arg(MIRALL_STRINGIFY(MIRALL_VERSION))
+            .arg(MIRALL_VERSION_STRING)
             .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN))
             .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN))
             .arg(devString);

+ 5 - 0
src/mirall/theme.cpp

@@ -193,6 +193,11 @@ bool Theme::systrayUseMonoIcons() const
     return _mono;
 }
 
+QString Theme::updateCheckUrl() const
+{
+    return QLatin1String("https://updates.owncloud.com/client/");
+}
+
 QString Theme::about() const
 {
     return QString::null;

+ 5 - 0
src/mirall/theme.h

@@ -170,6 +170,11 @@ public:
      */
     bool systrayUseMonoIcons() const;
 
+    /**
+     * @brief Where to check for new Updates.
+     */
+    virtual QString updateCheckUrl() const;
+
 protected:
     QIcon themeIcon(const QString& name, bool sysTray = false) const;
     Theme() {}

+ 5 - 7
src/mirall/updatedetector.cpp

@@ -41,8 +41,7 @@ void UpdateDetector::versionCheck( Theme *theme )
 {
     connect(_accessManager, SIGNAL(finished(QNetworkReply*)), this,
             SLOT(slotVersionInfoArrived(QNetworkReply*)) );
-    QUrl url(QLatin1String("https://download.owncloud.com/clientupdater.php"));
-    QString ver = QString::fromLatin1("%1.%2.%3").arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
+    QUrl url(Theme::instance()->updateCheckUrl());
 
     QString platform = QLatin1String("stranger");
 #ifdef Q_OS_LINUX
@@ -60,7 +59,8 @@ void UpdateDetector::versionCheck( Theme *theme )
     if( !sysInfo.isEmpty() ) {
         url.addQueryItem(QLatin1String("client"), sysInfo );
     }
-    url.addQueryItem( QLatin1String("version"), ver );
+    url.addQueryItem( QLatin1String("version"),
+                      QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION_FULL)) );
     url.addQueryItem( QLatin1String("platform"), platform );
     url.addQueryItem( QLatin1String("oem"), theme->appName() );
 
@@ -99,9 +99,6 @@ QString UpdateDetector::getSystemInfo()
 
 void UpdateDetector::showDialog()
 {
-    // if the version tag is set, there is a newer version.
-    QString ver = QString::fromLatin1("%1.%2.%3")
-            .arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
     QDialog *msgBox = new QDialog;
 
     QIcon info = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0);
@@ -121,7 +118,8 @@ void UpdateDetector::showDialog()
     QLabel *lbl = new QLabel;
     QString txt = tr("<p>A new version of the %1 Client is available.</p>"
                      "<p><b>%2</b> is available for download. The installed version is %3.<p>")
-            .arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring()).arg(ver);
+            .arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring())
+            .arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION_FULL)));
 
     lbl->setText(txt);
     lbl->setTextFormat(Qt::RichText);

+ 12 - 7
src/mirall/version.h.in

@@ -19,17 +19,22 @@
 #define MIRALL_TOSTRING(s) #s
 
 /* MIRALL version macros */
-#define MIRALL_VERSION_INT_(a, b, c) ((a) << 16 | (b) << 8 | (c))
+#define MIRALL_VERSION_INT_(a, b, c, d) ((a) << 24 | (b) << 16 | (c << 8) | (d))
 
 /* MIRALL version */
-#define MIRALL_VERSION_MAJOR  @VERSION_MAJOR@ 
-#define MIRALL_VERSION_MINOR  @VERSION_MINOR@
-#define MIRALL_VERSION_MICRO  @VERSION_PATCH@
-#define MIRALL_VERSION        @VERSION@
+#define MIRALL_VERSION_MAJOR @MIRALL_VERSION_MAJOR@
+#define MIRALL_VERSION_MINOR @MIRALL_VERSION_MINOR@
+#define MIRALL_VERSION_PATCH @MIRALL_VERSION_PATCH@
+#define MIRALL_VERSION_BUILD @MIRALL_VERSION_BUILD@
+
+#define MIRALL_VERSION       @MIRALL_VERSION@
+#define MIRALL_VERSION_FULL  @MIRALL_VERSION_FULL@
+
+#define MIRALL_VERSION_STRING "@MIRALL_VERSION_STRING@"
 
 #define MIRALL_VERSION_INT MIRALL_VERSION_INT_(MIRALL_VERSION_MAJOR, \
                                            MIRALL_VERSION_MINOR, \
-                                           MIRALL_VERSION_MICRO)
-
+                                           MIRALL_VERSION_PATCH, \
+                                           MIRALL_VERSION_BUILD)
 
 #endif // VERSION_H