Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
updateversion.pl: Update versions in files as needed
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 23 Sep 2017 20:59:25 +0000 (21:59 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 23 Sep 2017 20:59:25 +0000 (21:59 +0100)
source/tools/updateversion.pl [new file with mode: 0755]

diff --git a/source/tools/updateversion.pl b/source/tools/updateversion.pl
new file mode 100755 (executable)
index 0000000..310a0b7
--- /dev/null
@@ -0,0 +1,118 @@
+#!/usr/bin/perl
+
+#############################################################################
+# Xestia Address Book: Version Updater                                     #
+# (c) 2017 Xestia Address Book                                             #
+#############################################################################
+# This file is part of Xestia Address Book.                                #
+#                                                                          #
+# Xestia Address Book is free software: you can redistribute it and/or      #
+# modify it under the terms of the GNU General Public License as published  #
+# by the Free Software Foundation, version 3 of the license.               #
+#                                                                          #
+# Xestia Address Book 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 General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License along   #
+# with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>     #
+#############################################################################
+
+use strict;
+use warnings;
+use Tie::File;
+
+# Get the version number.
+
+if (!$ARGV[0]){
+       print "Error: No version specified!\n";
+       exit;
+}
+
+my $version = $ARGV[0];
+
+my $filename;
+my $file_handle;
+my @file_data;
+
+# Split the version information down.
+
+my @version_split = split(/(\.)/, $version);
+
+my $version_major = $version_split[0];
+my $version_minor = $version_split[2];
+
+# Update source/version.h
+
+$filename = "../version.h";
+
+tie(@file_data, 'Tie::File', $filename);
+foreach my $file_data_line(@file_data) {
+
+       # Look for XSDCAL_VERSION
+
+       if ($file_data_line =~ /^\#define\ XSDCAL_VERSION/){
+               my $line_output = "#define XSDCAL_VERSION \"";
+               $line_output .= $version;
+               $line_output .= "\"";
+               $file_data_line = $line_output;
+       }       
+
+       # Look for XSDCAL_USERAGENT
+
+       if ($file_data_line =~ /^\#define\ XSDCAL_USERAGENT/){
+               my $line_output = "#define XSDCAL_USERAGENT \"XestiaCalendar/";
+               $line_output .= $version;
+               $line_output .= "\"";
+               $file_data_line = $line_output;
+       }       
+
+}
+
+# Update projects/msw/xestiacalendar.rc
+
+#$filename = "../../projects/msw/xestiacalendar.rc";
+#tie(@file_data, 'Tie::File', $filename);
+#foreach my $file_data_line(@file_data) {
+#
+#      # Look for FILEVERSION
+#
+#      if ($file_data_line =~ /^    FILEVERSION/){
+#              my $line_output = "    FILEVERSION     ";
+#              $line_output .= $version_major;
+#              $line_output .= ",";
+#              $line_output .= $version_minor;
+#              $line_output .= ",0,0";
+#              $file_data_line = $line_output;
+#      }       
+#
+#      # Look for PRODUCTVERSION
+#
+#      if ($file_data_line =~ /^    PRODUCTVERSION/){
+#              my $line_output = "    PRODUCTVERSION  ";
+#              $line_output .= $version_major;
+#              $line_output .= ",";
+#              $line_output .= $version_minor;
+#              $line_output .= ",0,0";
+#              $file_data_line = $line_output;
+#      }       
+#
+#}
+
+# Update projects/osx/XestiaCalendar.xcodeproj/project.pbxproj
+
+$filename = "../../projects/osx/XestiaCalendar.xcodeproj/project.pbxproj";
+tie(@file_data, 'Tie::File', $filename);
+foreach my $file_data_line(@file_data) {
+
+       # Look for PRODUCT_VERSION
+
+       if ($file_data_line =~ /^\t\t\t\tPRODUCT_VERSION/){
+               my $line_output = "\t\t\t\tPRODUCT_VERSION = ";
+               $line_output .= $version;
+               $line_output .= ";";
+               $file_data_line = $line_output;
+       }
+
+}
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy