From 530e7494dd5148a8844c083f6de414fc5dd1a5df Mon Sep 17 00:00:00 2001
From: con <qtc-committer@nokia.com>
Date: Mon, 28 Mar 2011 15:31:27 +0200
Subject: [PATCH] Automatic versioning for the qml tools.

Reviewed-by: Thomas Hartmann
---
 .../qml/qmldump/{Info.plist => Info.plist.in} | 10 +++++-----
 .../{Info_mac.plist => Info.plist.in}         | 19 ++++++++++++++++---
 .../qtcreator/qml/qmlobserver/qmlobserver.pro |  3 ++-
 share/qtcreator/static.pro                    | 10 ++++++++++
 .../qmlpuppet/{Info.plist => Info.plist.in}   | 10 +++++-----
 src/tools/qmlpuppet/qmlpuppet.pro             |  8 ++++++--
 6 files changed, 44 insertions(+), 16 deletions(-)
 rename share/qtcreator/qml/qmldump/{Info.plist => Info.plist.in} (82%)
 rename share/qtcreator/qml/qmlobserver/{Info_mac.plist => Info.plist.in} (55%)
 rename src/tools/qmlpuppet/{Info.plist => Info.plist.in} (83%)

diff --git a/share/qtcreator/qml/qmldump/Info.plist b/share/qtcreator/qml/qmldump/Info.plist.in
similarity index 82%
rename from share/qtcreator/qml/qmldump/Info.plist
rename to share/qtcreator/qml/qmldump/Info.plist.in
index bf62990d113..d34a234d9fe 100644
--- a/share/qtcreator/qml/qmldump/Info.plist
+++ b/share/qtcreator/qml/qmldump/Info.plist.in
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
+<plist version=\"1.0\">
 <dict>
         <key>NSHumanReadableCopyright</key>
         <string>(C) 2008-2011 Nokia Corporation
@@ -20,9 +20,9 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
         <key>CFBundleIdentifier</key>
     <string>com.nokia.qtcreator.qmldump</string>
         <key>CFBundleVersion</key>
-        <string>2.1.83</string>
+        <string>$$QTCREATOR_VERSION</string>
         <key>CFBundleShortVersionString</key>
-        <string>2.1.83</string>
+        <string>$$QTCREATOR_VERSION</string>
     <key>LSUIElement</key>
     <string>1</string>
 </dict>
diff --git a/share/qtcreator/qml/qmlobserver/Info_mac.plist b/share/qtcreator/qml/qmlobserver/Info.plist.in
similarity index 55%
rename from share/qtcreator/qml/qmlobserver/Info_mac.plist
rename to share/qtcreator/qml/qmlobserver/Info.plist.in
index 08775479baf..d5b7bb1a0f5 100644
--- a/share/qtcreator/qml/qmlobserver/Info_mac.plist
+++ b/share/qtcreator/qml/qmlobserver/Info.plist.in
@@ -1,7 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.1">
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\">
+<plist version=\"0.1\">
 <dict>
+        <key>NSHumanReadableCopyright</key>
+        <string>(C) 2008-2011 Nokia Corporation
+Commercial Usage
+
+Licensees holding valid Qt Commercial licenses may use this file in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
+
+GNU Lesser General Public License Usage
+
+Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation and appearing in the file LICENSE.LGPL included in the packaging of this file.  Please review the following information to ensure the GNU Lesser General Public License version 2.1 requirements will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</string>
 	<key>CFBundleIconFile</key>
 	<string>@ICON@</string>
 	<key>CFBundleIdentifier</key>
@@ -14,6 +23,10 @@
 	<string>@TYPEINFO@</string>
 	<key>CFBundleExecutable</key>
 	<string>@EXECUTABLE@</string>
+        <key>CFBundleVersion</key>
+        <string>$$QTCREATOR_VERSION</string>
+        <key>CFBundleShortVersionString</key>
+        <string>$$QTCREATOR_VERSION</string>
         <key>UTExportedTypeDeclarations</key>
           <array>
             <dict>
diff --git a/share/qtcreator/qml/qmlobserver/qmlobserver.pro b/share/qtcreator/qml/qmlobserver/qmlobserver.pro
index 5ef9da0ed3c..3bafb54ca24 100644
--- a/share/qtcreator/qml/qmlobserver/qmlobserver.pro
+++ b/share/qtcreator/qml/qmlobserver/qmlobserver.pro
@@ -60,8 +60,9 @@ symbian {
         LIBS += -lavkon -lcone
     }
 }
+OTHER_FILES+=Info.plist
 mac {
-    QMAKE_INFO_PLIST=Info_mac.plist
+    QMAKE_INFO_PLIST=Info.plist
     TARGET=QMLObserver
     ICON=qml.icns
 } else {
diff --git a/share/qtcreator/static.pro b/share/qtcreator/static.pro
index 205ab9e6bd3..c9b997a1bf2 100644
--- a/share/qtcreator/static.pro
+++ b/share/qtcreator/static.pro
@@ -96,3 +96,13 @@ QMAKE_EXTRA_COMPILERS += unconditionalCopy2build
         INSTALLS += $$data_dir
     }
 }
+
+# do version magic for app bundles
+macx {
+   dumpinfo.input = qml/qmldump/Info.plist.in
+   dumpinfo.output = $$IDE_DATA_PATH/qml/qmldump/Info.plist
+   QMAKE_SUBSTITUTES += dumpinfo
+   observerinfo.input = qml/qmlobserver/Info.plist.in
+   observerinfo.output = $$IDE_DATA_PATH/qml/qmlobserver/Info.plist
+   QMAKE_SUBSTITUTES += observerinfo
+}
diff --git a/src/tools/qmlpuppet/Info.plist b/src/tools/qmlpuppet/Info.plist.in
similarity index 83%
rename from src/tools/qmlpuppet/Info.plist
rename to src/tools/qmlpuppet/Info.plist.in
index 6d42d6331a6..7d0d6a1039b 100644
--- a/src/tools/qmlpuppet/Info.plist
+++ b/src/tools/qmlpuppet/Info.plist.in
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
+<plist version=\"1.0\">
 <dict>
         <key>NSHumanReadableCopyright</key>
         <string>(C) 2008-2011 Nokia Corporation
@@ -20,9 +20,9 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
 	<key>CFBundleIdentifier</key>
     <string>com.nokia.qtcreator.qmlpuppet</string>
 	<key>CFBundleVersion</key>
-	<string>2.1.83</string>
+	<string>$$QTCREATOR_VERSION</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.1.83</string>
+	<string>$$QTCREATOR_VERSION</string>
     <key>LSUIElement</key>
     <string>1</string>
 </dict>
diff --git a/src/tools/qmlpuppet/qmlpuppet.pro b/src/tools/qmlpuppet/qmlpuppet.pro
index b4edaf1f3f2..f59765e533f 100644
--- a/src/tools/qmlpuppet/qmlpuppet.pro
+++ b/src/tools/qmlpuppet/qmlpuppet.pro
@@ -23,5 +23,9 @@ QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH)
 SOURCES += main.cpp
 RESOURCES += qmlpuppet.qrc
 
-OTHER_FILES += Info.plist
-macx:QMAKE_INFO_PLIST = Info.plist
+OTHER_FILES += Info.plist.in
+macx {
+    info.input = Info.plist.in
+    info.output = $$IDE_BIN_PATH/$${TARGET}.app/Contents/Info.plist
+    QMAKE_SUBSTITUTES += info
+}
-- 
GitLab