Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditor: Check save was successful before closing
[xestiaab/.git] / source / tools / updateversion.pl
1 #!/usr/bin/perl
3 #############################################################################
4 # Xestia Address Book: Version Updater                                      #
5 # (c) 2017 Xestia Address Book                                              #
6 #############################################################################
7 # This file is part of Xestia Address Book.                                 #
8 #                                                                           #
9 # Xestia Address Book is free software: you can redistribute it and/or      #
10 # modify it under the terms of the GNU General Public License as published  #
11 # by the Free Software Foundation, version 3 of the license.                #
12 #                                                                           #
13 # Xestia Address Book is distributed in the hope that it will be useful,    #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of            #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the              #
16 # GNU General Public License for more details.                              #
17 #                                                                           #
18 # You should have received a copy of the GNU General Public License along   #
19 # with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>      #
20 #############################################################################
22 use strict;
23 use warnings;
24 use Tie::File;
26 # Get the version number.
28 if (!$ARGV[0]){
29         print "Error: No version specified!\n";
30         exit;
31 }
33 my $version = $ARGV[0];
35 my $filename;
36 my $file_handle;
37 my @file_data;
39 # Split the version information down.
41 my @version_split = split(/(\.)/, $version);
43 my $version_major = $version_split[0];
44 my $version_minor = $version_split[2];
46 # Update source/version.h
48 $filename = "../version.h";
50 tie(@file_data, 'Tie::File', $filename);
51 foreach my $file_data_line(@file_data) {
53         # Look for XSDAB_VERSION
55         if ($file_data_line =~ /^\#define\ XSDAB_VERSION/){
56                 my $line_output = "#define XSDAB_VERSION \"";
57                 $line_output .= $version;
58                 $line_output .= "\"";
59                 $file_data_line = $line_output;
60         }       
62         # Look for XSDAB_USERAGENT
64         if ($file_data_line =~ /^\#define\ XSDAB_USERAGENT/){
65                 my $line_output = "#define XSDAB_USERAGENT \"XestiaAddressBook/";
66                 $line_output .= $version;
67                 $line_output .= "\"";
68                 $file_data_line = $line_output;
69         }       
71 }
73 # Update projects/msw/xestiaab.rc
75 $filename = "../../projects/msw/xestiaab.rc";
76 tie(@file_data, 'Tie::File', $filename);
77 foreach my $file_data_line(@file_data) {
79         # Look for FILEVERSION
81         if ($file_data_line =~ /^    FILEVERSION/){
82                 my $line_output = "    FILEVERSION     ";
83                 $line_output .= $version_major;
84                 $line_output .= ",";
85                 $line_output .= $version_minor;
86                 $line_output .= ",0,0";
87                 $file_data_line = $line_output;
88         }       
90         # Look for PRODUCTVERSION
92         if ($file_data_line =~ /^    PRODUCTVERSION/){
93                 my $line_output = "    PRODUCTVERSION  ";
94                 $line_output .= $version_major;
95                 $line_output .= ",";
96                 $line_output .= $version_minor;
97                 $line_output .= ",0,0";
98                 $file_data_line = $line_output;
99         }       
103 # Update projects/osx/XestiaAddressBook.xcodeproj/project.pbxproj
105 $filename = "../../projects/osx/XestiaAddressBook.xcodeproj/project.pbxproj";
106 tie(@file_data, 'Tie::File', $filename);
107 foreach my $file_data_line(@file_data) {
109         # Look for PRODUCT_VERSION
111         if ($file_data_line =~ /^\t\t\t\tPRODUCT_VERSION/){
112                 my $line_output = "\t\t\t\tPRODUCT_VERSION = ";
113                 $line_output .= $version;
114                 $line_output .= ";";
115                 $file_data_line = $line_output;
116         }
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